• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cairo_pattern_set_matrix函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cairo_pattern_set_matrix函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_pattern_set_matrix函数的具体用法?C++ cairo_pattern_set_matrix怎么用?C++ cairo_pattern_set_matrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cairo_pattern_set_matrix函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pattern_set_matrix

static PyObject *
pattern_set_matrix (PycairoPattern *o, PyObject *args) {
  PycairoMatrix *m;

  if (!PyArg_ParseTuple (args, "O!:Pattern.set_matrix",
			 &PycairoMatrix_Type, &m))
    return NULL;

  cairo_pattern_set_matrix (o->pattern, &m->matrix);
  Py_RETURN_NONE;
}
开发者ID:jpe,项目名称:py2cairo-py3k,代码行数:11,代码来源:pattern.c


示例2: mume_bitblt_image

void mume_bitblt_image(
    cairo_t *cr, int x1, int y1, int w1, int h1,
    cairo_pattern_t *p, int x2, int y2)
{
    cairo_matrix_t om;
    cairo_pattern_get_matrix(p, &om);
    cairo_save(cr);
    cairo_new_path(cr);
    _mume_bitblt_image(cr, x1, y1, w1, h1, p, x2, y2);
    cairo_restore(cr);
    cairo_pattern_set_matrix(p, &om);
}
开发者ID:tomnotcat,项目名称:mume,代码行数:12,代码来源:mume-drawing.c


示例3: mark_paint_group

//=================================================================================
// mark_paint_group
//=================================================================================
void mark_paint_group(Qdr *qdr, cairo_t *cr, cairo_pattern_t *pattern, int _x, int _y)
{
	int idx = qdr->group.data[_x][_y];
	
	if(qdr->group.attr[idx].count==1 && qdr->group.image){
		int x = (_x + qdr->margin) * qdr->msize;
		int y = (_y + qdr->margin) * qdr->msize;

		if(!pattern){
			struct QDRBindImage b;
			//cairo_surface_t *surface = cairo_image_surface_create_from_png(qdr->group.image);
			cairo_surface_t *surface = image_surface_create(&b, qdr->group.image);
			if(!surface)
				return;
			
			int w = cairo_image_surface_get_width(surface);
			int h = cairo_image_surface_get_height(surface);
			
			pattern = cairo_pattern_create_for_surface(surface);
			
			//scaling
			if(w>qdr->msize || h>qdr->msize){
				int big = w>h ? w : h;
				double scaling = (double)qdr->msize/big;
				
				cairo_matrix_t matrix;
				cairo_matrix_init_scale(&matrix, 1/scaling, 1/scaling);
				cairo_pattern_set_matrix(pattern, &matrix);
			}
			cairo_surface_destroy(surface);
			if(b.data)
				free(b.data);
		}
		
		//umm...
		if(qdr->group.is_mark){
			cairo_set_source_rgba(cr, qdr->group.attr[idx].r, qdr->group.attr[idx].g, qdr->group.attr[idx].b, qdr->group.attr[idx].a);
			cairo_fill(cr);
		}
		
		cairo_translate(cr, x, y);
			cairo_set_source(cr, pattern);
			//cairo_pattern_set_filter (cairo_get_source(cr), CAIRO_FILTER_GAUSSIAN);
			cairo_rectangle(cr, 0, 0, qdr->msize, qdr->msize);
			//cairo_fill(cr);
		cairo_translate(cr, -x, -y);
		
		return;
	}

	cairo_set_source_rgba(cr, qdr->group.attr[idx].r, qdr->group.attr[idx].g, qdr->group.attr[idx].b, qdr->group.attr[idx].a);
	cairo_fill(cr);
}
开发者ID:devilstan,项目名称:sqr,代码行数:56,代码来源:qdr_group.c


示例4: clear

void
S9xGTKDisplayDriver::output (void *src,
                             int  src_pitch,
                             int  x,
                             int  y,
                             int  width,
                             int  height,
                             int  dst_width,
                             int  dst_height)
{
    if (last_known_width != dst_width || last_known_height != dst_height)
    {
        clear ();

        last_known_width = dst_width;
        last_known_height = dst_height;
    }

    cairo_t *cr = window->get_cairo ();

    cairo_surface_t *surface;

    surface = cairo_image_surface_create_for_data ((unsigned char *) src, CAIRO_FORMAT_RGB16_565, width, height, src_pitch);

    cairo_set_source_surface (cr, surface, 0, 0);

    if (width != dst_width || height != dst_height)
    {
        cairo_matrix_t matrix;
        cairo_pattern_t *pattern = cairo_get_source (cr);;

        cairo_matrix_init_identity (&matrix);
        cairo_matrix_scale (&matrix,
                            (double) width / (double) dst_width,
                            (double) height / (double) dst_height);
        cairo_matrix_translate (&matrix, -x, -y);
        cairo_pattern_set_matrix (pattern, &matrix);
        cairo_pattern_set_filter (pattern,
                                  Settings.BilinearFilter
                                       ? CAIRO_FILTER_BILINEAR
                                       : CAIRO_FILTER_NEAREST);
    }

    cairo_rectangle (cr, x, y, dst_width, dst_height);
    cairo_fill (cr);

    cairo_surface_finish (surface);
    cairo_surface_destroy (surface);

    window->release_cairo ();
    window->set_mouseable_area (x, y, width, height);
}
开发者ID:snes9xgit,项目名称:snes9x,代码行数:52,代码来源:gtk_display_driver_gtk.cpp


示例5: tileImage

cairo_pattern_t* Pattern::createPlatformPattern(const AffineTransform& patternTransform) const
{
    cairo_surface_t* surface = tileImage()->nativeImageForCurrentFrame();
    if (!surface)
        return 0;

    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface);
    const cairo_matrix_t* pattern_matrix = reinterpret_cast<const cairo_matrix_t*>(&patternTransform);
    cairo_pattern_set_matrix(pattern, pattern_matrix);
    if (m_repeatX || m_repeatY)
        cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
    return pattern;
}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:13,代码来源:PatternCairo.cpp


示例6: gtk_css_style_render_icon_surface

void
gtk_css_style_render_icon_surface (GtkCssStyle            *style,
                                   cairo_t                *cr,
                                   cairo_surface_t        *surface,
                                   double                  x,
                                   double                  y)
{
  const GtkCssValue *shadows;
  cairo_matrix_t matrix, transform_matrix;
  GdkRectangle extents;

  g_return_if_fail (GTK_IS_CSS_STYLE (style));
  g_return_if_fail (cr != NULL);
  g_return_if_fail (surface != NULL);

  shadows = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);

  if (!get_surface_extents (surface, &extents))
    {
      /* weird infinite surface, no special magic for you */
      cairo_set_source_surface (cr, surface, x, y);
      _gtk_css_shadows_value_paint_icon (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW), cr);
      cairo_paint (cr);
      return;
    }

  cairo_translate (cr, x + extents.x, y + extents.y);

  if (_gtk_css_transform_value_get_matrix (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM), &transform_matrix))
    {
      cairo_pattern_t *pattern;

      /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */
      cairo_matrix_init_translate (&matrix, extents.width / 2, extents.height / 2);
      cairo_matrix_multiply (&matrix, &transform_matrix, &matrix);
      cairo_matrix_translate (&matrix, - extents.width / 2, - extents.height / 2);
      if (cairo_matrix_invert (&matrix) != CAIRO_STATUS_SUCCESS)
        {
          g_assert_not_reached ();
        }
      cairo_matrix_translate (&matrix, extents.x, extents.y);

      pattern = cairo_pattern_create_for_surface (surface);
      cairo_pattern_set_matrix (pattern, &matrix);
      cairo_set_source (cr, pattern);
      cairo_pattern_destroy (pattern);

      _gtk_css_shadows_value_paint_icon (shadows, cr);
      cairo_paint (cr);
    }
}
开发者ID:Distrotech,项目名称:gtk,代码行数:51,代码来源:gtkrendericon.c


示例7: _mume_bitblt_image

static inline void _mume_bitblt_image(
    cairo_t *cr, int x1, int y1, int w1, int h1,
    cairo_pattern_t *p, int x2, int y2)
{
    /* Similar to BitBlt in win32 GDI. */
    if (w1 > 0 && h1 > 0) {
        cairo_matrix_t matrix;
        cairo_matrix_init_translate(
            &matrix, x2 - x1, y2 - y1);
        cairo_pattern_set_matrix(p, &matrix);
        cairo_rectangle(cr, x1, y1, w1, h1);
        cairo_fill(cr);
    }
}
开发者ID:tomnotcat,项目名称:mume,代码行数:14,代码来源:mume-drawing.c


示例8: draw_n

static void
draw_n (cairo_t *cr, cairo_pattern_t *pat, double dest_size, int n)
{
  cairo_matrix_t mat;

  cairo_matrix_init_scale (&mat, SRC_WIDTH / dest_size, SRC_HEIGHT / dest_size);
  cairo_matrix_translate (&mat, n * -dest_size, 0.0);
  cairo_pattern_set_matrix (pat, &mat);

  cairo_set_source (cr, pat);
  cairo_new_path (cr);
  cairo_rectangle (cr, n * dest_size, 0.0, dest_size, dest_size);
  cairo_fill (cr);
}
开发者ID:jwmcglynn,项目名称:Gadgets,代码行数:14,代码来源:surface-pattern-big-scale-down.c


示例9: platformDestroy

cairo_pattern_t* Gradient::platformGradient(float globalAlpha)
{
    if (m_gradient && m_platformGradientAlpha == globalAlpha)
        return m_gradient;

    platformDestroy();
    m_platformGradientAlpha = globalAlpha;

    if (m_radial)
        m_gradient = cairo_pattern_create_radial(m_p0.x(), m_p0.y(), m_r0, m_p1.x(), m_p1.y(), m_r1);
    else
        m_gradient = cairo_pattern_create_linear(m_p0.x(), m_p0.y(), m_p1.x(), m_p1.y());

    Vector<ColorStop>::iterator stopIterator = m_stops.begin();
    while (stopIterator != m_stops.end()) {
#if !PLATFORM(JS) || USE(ACCELERATED_COMPOSITING)
        cairo_pattern_add_color_stop_rgba(m_gradient, stopIterator->stop,
                                          stopIterator->red, stopIterator->green, stopIterator->blue,
                                          stopIterator->alpha * globalAlpha);
#else
				// Swap the RGBA channels, canvas painting needs to be ARGB
				// but since the channels come out backwards as ABGR we just
				// swap the red and blue to get the same channel format without
				// haveing to go through all of the pixels and swap them post-blit.
				cairo_pattern_add_color_stop_rgba(m_gradient, stopIterator->stop,
																					stopIterator->blue, stopIterator->green, stopIterator->red,
																					stopIterator->alpha * globalAlpha);
#endif
        ++stopIterator;
    }

    switch (m_spreadMethod) {
    case SpreadMethodPad:
        cairo_pattern_set_extend(m_gradient, CAIRO_EXTEND_PAD);
        break;
    case SpreadMethodReflect:
        cairo_pattern_set_extend(m_gradient, CAIRO_EXTEND_REFLECT);
        break;
    case SpreadMethodRepeat:
        cairo_pattern_set_extend(m_gradient, CAIRO_EXTEND_REPEAT);
        break;
    }

    cairo_matrix_t matrix = m_gradientSpaceTransformation;
    cairo_matrix_invert(&matrix);
    cairo_pattern_set_matrix(m_gradient, &matrix);

    return m_gradient;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:49,代码来源:GradientCairo.cpp


示例10: updateMatrix

void QCairoPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags /*flags*/)
{
   //qDebug()<<"drawImage r="<<r<<" sr="<<sr;
    double              w, h;
    cairo_surface_t *image;
    QImage img;
    QRect sri=sr.toRect();
    if (sri.isValid() && (sri.x()!=0 || sri.y()!=0 || sri.size()!=sri.size())) {
        img=pm.copy(sri).convertToFormat(QImage::Format_ARGB32);
    } else {
        img=pm.convertToFormat(QImage::Format_ARGB32);
    }


    if (!img.isNull()) {
        cairo_format_t imgformat=CAIRO_FORMAT_ARGB32;

        updateMatrix();

        image = cairo_image_surface_create_for_data(img.bits(), imgformat, img.width(), img.height(), img.bytesPerLine());
        w = img.width();
        h = img.height();

        cairo_matrix_t cm;
        cairo_matrix_init_identity(&cm);
        cairo_matrix_translate (&cm, r.x(), r.y());
        if (sr.isValid()) cairo_matrix_scale(&cm, r.width() / sr.width(), r.height() / sr.height());
        //cairo_matrix_translate (&cm, -sr.x(), -sr.y());
        cairo_matrix_invert(&cm);

        cairo_pattern_t* brush=cairo_pattern_create_for_surface(image);
        cairo_pattern_set_matrix(brush, &cm);
        cairo_pattern_set_extend(brush, CAIRO_EXTEND_NONE);

        cairo_rectangle(cr, r.x(), r.y(), r.width(), r.height());
        cairo_set_source(cr, brush);
        cairo_fill_preserve(cr);
        cairo_set_source_rgba(cr, 0,0,0,0);
        cairo_set_line_width(cr, 0.0);
        cairo_stroke(cr);
        //cairo_fill(cr);

        //cairo_set_source_surface (cr, image, 0, 0);
        //cairo_paint(cr);
        releasePattern(brush);
        updateMatrix();
    }
}
开发者ID:jkriege2,项目名称:cairoQPaintDevice,代码行数:48,代码来源:qcairopaintengine.cpp


示例11: _pattern_build_for_cairo

static cairo_pattern_t *
_pattern_build_for_cairo (DiaPattern *pattern, const Rectangle *ext)
{
  cairo_pattern_t *pat;
  gsize i;
  real x, y;
  DiaPatternType type;
  guint flags;
  Point p1, p2;
  real r;

  g_return_val_if_fail (pattern != NULL, NULL);

  dia_pattern_get_settings (pattern, &type, &flags);
  dia_pattern_get_points (pattern, &p1, &p2);
  dia_pattern_get_radius (pattern, &r);

  switch (type ) {
  case DIA_LINEAR_GRADIENT :
    pat = cairo_pattern_create_linear (p1.x, p1.y, p2.x, p2.y);
    break;
  case DIA_RADIAL_GRADIENT :
    pat = cairo_pattern_create_radial (p2.x, p2.y, 0.0, p1.x, p1.y, r);
    break;
  default :
    g_warning ("_pattern_build_for_cairo non such.");
    return NULL;
  }
  /* this must only be optionally done */
  if ((flags & DIA_PATTERN_USER_SPACE)==0) {
    cairo_matrix_t matrix;
    real w = ext->right - ext->left;
    real h = ext->bottom - ext->top;
    cairo_matrix_init (&matrix, w, 0.0, 0.0, h, ext->left, ext->top);
    cairo_matrix_invert (&matrix);
    cairo_pattern_set_matrix (pat, &matrix);
  }
  if (flags & DIA_PATTERN_EXTEND_PAD)
    cairo_pattern_set_extend (pat, CAIRO_EXTEND_PAD);
  else if (flags & DIA_PATTERN_EXTEND_REPEAT)
    cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT);
  else if (flags & DIA_PATTERN_EXTEND_REFLECT)
    cairo_pattern_set_extend (pat, CAIRO_EXTEND_REFLECT);

  dia_pattern_foreach (pattern, _add_color_stop, pat);

  return pat;
}
开发者ID:trilomix,项目名称:dia,代码行数:48,代码来源:diacairo-renderer.c


示例12: nativeImageForCurrentFrame

void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
                        const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect)
{
    cairo_surface_t* image = nativeImageForCurrentFrame();
    if (!image) // If it's too early we won't have an image yet.
        return;

    cairo_t* cr = context->platformContext();
    context->save();

    IntRect imageSize = enclosingIntRect(tileRect);
    OwnPtr<ImageBuffer> imageSurface = ImageBuffer::create(imageSize.size(), false);

    if (!imageSurface)
        return;

    if (tileRect.size() != size()) {
        cairo_t* clippedImageContext = imageSurface->context()->platformContext();
        cairo_set_source_surface(clippedImageContext, image, -tileRect.x(), -tileRect.y());
        cairo_paint(clippedImageContext);
        image = imageSurface->image()->nativeImageForCurrentFrame();
    }

    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);
    cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);

    // Workaround to avoid the unwanted gradient effect (#14017)
    cairo_pattern_set_filter(pattern, CAIRO_FILTER_NEAREST);

    cairo_matrix_t pattern_matrix = cairo_matrix_t(patternTransform);
    cairo_matrix_t phase_matrix = {1, 0, 0, 1, phase.x() + tileRect.x() * patternTransform.a(), phase.y() + tileRect.y() * patternTransform.d()};
    cairo_matrix_t combined;
    cairo_matrix_multiply(&combined, &pattern_matrix, &phase_matrix);
    cairo_matrix_invert(&combined);
    cairo_pattern_set_matrix(pattern, &combined);

    context->setCompositeOperation(op);
    cairo_set_source(cr, pattern);
    cairo_pattern_destroy(pattern);
    cairo_rectangle(cr, destRect.x(), destRect.y(), destRect.width(), destRect.height());
    cairo_fill(cr);

    context->restore();

    if (imageObserver())
        imageObserver()->didDraw(this);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:47,代码来源:BCImageCairo.cpp


示例13: _eventd_nd_cairo_limit_size

static cairo_surface_t *
_eventd_nd_cairo_limit_size(cairo_surface_t *source, gint max_width, gint max_height)
{
    gdouble s = 1.0;
    gint width, height;
    cairo_surface_t *surface;
    cairo_t *cr;
    cairo_pattern_t *pattern;
    cairo_matrix_t matrix;

    width = cairo_image_surface_get_width(source);
    height = cairo_image_surface_get_height(source);

    if ( ( width > max_width ) && ( height > max_height ) )
    {
        if ( width > height )
            s = (gdouble) max_width / (gdouble) width;
        else
            s = (gdouble) max_height / (gdouble) height;
    }
    else if ( width > max_width )
        s = (gdouble) max_width / (gdouble) width;
    else if ( height > max_height )
        s = (gdouble) max_height / (gdouble) height;
    else
        return source;

    width *= s;
    height *= s;

    surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
    cr = cairo_create(surface);

    cairo_matrix_init_scale(&matrix, 1. / s, 1. / s);

    pattern = cairo_pattern_create_for_surface(source);
    cairo_pattern_set_matrix(pattern, &matrix);

    cairo_set_source(cr, pattern);
    cairo_paint(cr);

    cairo_pattern_destroy(pattern);
    cairo_destroy(cr);
    cairo_surface_destroy(source);

    return surface;
}
开发者ID:Keruspe,项目名称:eventd,代码行数:47,代码来源:icon.c


示例14: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_pattern_t *pattern;
    cairo_matrix_t matrix;

    /* Paint a diagonal division as a test image */
    cairo_set_source_rgb (cr, 1, 1, 1);	/* White */
    cairo_paint (cr);

    cairo_move_to (cr, SIZE,    0);
    cairo_line_to (cr, SIZE, SIZE);
    cairo_line_to (cr, 0,    SIZE);

    cairo_set_source_rgb (cr, 0, 0, 0);
    cairo_fill (cr);

    /* Create a pattern with the target surface as the source,
     * offset by SIZE/2
     */
    pattern = cairo_pattern_create_for_surface (cairo_get_group_target (cr));

    cairo_matrix_init_translate (&matrix, - SIZE / 2, - SIZE / 2);
    cairo_pattern_set_matrix (pattern, &matrix);

    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);

    /* Copy two rectangles from the upper-left quarter of the image to
     * the lower right.  It will work if we use cairo_fill(), but the
     * cairo_clip() cairo_paint() combination fails because the clip
     * on the surface as a destination affects it as the source as
     * well.
     */
    cairo_rectangle (cr,
                     2 * SIZE / 4, 2 * SIZE / 4,
                     SIZE / 4,     SIZE / 4);
    cairo_rectangle (cr,
                     3 * SIZE / 4, 3 * SIZE / 4,
                     SIZE / 4,     SIZE / 4);
    cairo_clip (cr);
    cairo_paint (cr);

    return CAIRO_TEST_SUCCESS;

}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:46,代码来源:self-copy.c


示例15: _mume_stretch_image

static inline void _mume_stretch_image(
    cairo_t *cr, int x1, int y1, int w1, int h1,
    cairo_pattern_t *p, int x2, int y2, int w2, int h2)
{
    /* Similar to StretchBlt in win32 GDI. */
    if (w1 > 0 && h1 > 0 && w2 > 0 && h2 > 0) {
        cairo_matrix_t matrix;
        double hr = (double)w2 / (double)w1;
        double vr = (double)h2 / (double)h1;
        cairo_matrix_init_translate(
            &matrix, (double)x2 - x1 * hr, (double)y2 - y1 * vr);
        cairo_matrix_scale(&matrix, hr, vr);
        cairo_pattern_set_matrix(p, &matrix);
        cairo_rectangle(cr, x1, y1, w1, h1);
        cairo_fill(cr);
    }
}
开发者ID:tomnotcat,项目名称:mume,代码行数:17,代码来源:mume-drawing.c


示例16: tileImage

cairo_pattern_t* Pattern::createPlatformPattern(const AffineTransform&) const
{
    NativeImageCairo* image = tileImage()->nativeImageForCurrentFrame();
    if (!image)
        return 0;

    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image->surface());

    // cairo merges patter space and user space itself
    cairo_matrix_t matrix = m_patternSpaceTransformation;
    cairo_matrix_invert(&matrix);
    cairo_pattern_set_matrix(pattern, &matrix);

    if (m_repeatX || m_repeatY)
        cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
    return pattern;
}
开发者ID:Moondee,项目名称:Artemis,代码行数:17,代码来源:PatternCairo.cpp


示例17: save

void Context::copySurface( const SurfaceBase &surface, const Area &srcArea, const Rectf &dstRect )
{
	if( ( dstRect.getWidth() == 0 ) || ( dstRect.getHeight() == 0 ) )
		return;

	save();
	cairo_set_source_surface( mCairo, const_cast<SurfaceBase&>( surface ).getCairoSurface(), 0, 0 );
	cairo_pattern_t *sourcePattern = cairo_get_source( mCairo );
	cairo_matrix_t m;
	cairo_matrix_init_identity( &m );
	cairo_matrix_scale( &m, srcArea.getWidth() / (float)dstRect.getWidth(), srcArea.getHeight() / (float)dstRect.getHeight() );
	cairo_matrix_translate( &m, srcArea.getX1() - dstRect.getX1(), srcArea.getY1() - dstRect.getY1() );
	cairo_pattern_set_matrix( sourcePattern, &m );
	cairo_rectangle( mCairo, dstRect.getX1(), dstRect.getY1(), dstRect.getWidth(), dstRect.getHeight() );
	cairo_fill( mCairo );
	restore();
}
开发者ID:Justinmaurer,项目名称:Cinder,代码行数:17,代码来源:Cairo.cpp


示例18: update_pattern_transform

static void 
update_pattern_transform (struct graphics2d *gr)
{
  double a, b, c, d, tx, ty;
  cairo_matrix_t *mat = NULL;

  g_assert (gr != NULL);
  if (gr->pattern == NULL)
    return;

  return;
  /* temporarily disabled: ambiguous behavior */
  /*   cairo_get_matrix (gr->cr, &a, &b, &c, &d, &tx, &ty); */
  mat = cairo_matrix_create ();
  g_assert (mat != NULL);
  cairo_matrix_set_affine (mat, a, b, c, d, tx, ty);
  cairo_pattern_set_matrix (gr->pattern, mat);
  cairo_matrix_destroy (mat);
}
开发者ID:aosm,项目名称:gcc_40,代码行数:19,代码来源:gnu_java_awt_peer_gtk_GdkGraphics2D.c


示例19: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *mask_surface;
    cairo_pattern_t *mask;
    static uint32_t data[] = {
	0x80000000, 0x80000000,
	0x80000000, 0x80000000,
    };
    cairo_matrix_t matrix;

    mask_surface = cairo_image_surface_create_for_data ((unsigned char *) data,
							CAIRO_FORMAT_ARGB32, 2, 2, 8);
    mask = cairo_pattern_create_for_surface (mask_surface);
    cairo_surface_destroy (mask_surface);

    cairo_set_source_rgb (cr, 1.0, 0, 0);

    /* We can translate with the CTM, with the pattern matrix, or with
     * both. */

    /* 1. CTM alone. */
    cairo_save (cr);
    {
	cairo_translate (cr, 2, 2);
	cairo_mask (cr, mask);
    }
    cairo_restore (cr);

    /* 2. Pattern matrix alone. */
    cairo_matrix_init_translate (&matrix, -4, -4);
    cairo_pattern_set_matrix (mask, &matrix);

    cairo_mask (cr, mask);

    /* 3. CTM + pattern matrix */
    cairo_translate (cr, 2, 2);
    cairo_mask (cr, mask);

    cairo_pattern_destroy (mask);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:Dirbaio,项目名称:libgdiplus,代码行数:43,代码来源:mask-ctm.c


示例20: _cairo_default_context_pop_group

static cairo_pattern_t *
_cairo_default_context_pop_group (void *abstract_cr)
{
    cairo_default_context_t *cr = abstract_cr;
    cairo_surface_t *group_surface;
    cairo_pattern_t *group_pattern;
    cairo_surface_t *parent_surface;
    cairo_matrix_t group_matrix;
    cairo_status_t status;

    /* Verify that we are at the right nesting level */
    if (unlikely (! _cairo_gstate_is_group (cr->gstate)))
	return _cairo_pattern_create_in_error (CAIRO_STATUS_INVALID_POP_GROUP);

    /* Get a reference to the active surface before restoring */
    group_surface = _cairo_gstate_get_target (cr->gstate);
    group_surface = cairo_surface_reference (group_surface);

    status = _cairo_gstate_restore (&cr->gstate, &cr->gstate_freelist);
    assert (status == CAIRO_STATUS_SUCCESS);

    parent_surface = _cairo_gstate_get_target (cr->gstate);

    group_pattern = cairo_pattern_create_for_surface (group_surface);
    status = group_pattern->status;
    if (unlikely (status))
        goto done;

    _cairo_gstate_get_matrix (cr->gstate, &group_matrix);
    cairo_pattern_set_matrix (group_pattern, &group_matrix);

    /* If we have a current path, we need to adjust it to compensate for
     * the device offset just removed. */
    _cairo_path_fixed_translate (cr->path,
				 _cairo_fixed_from_int (parent_surface->device_transform.x0 - group_surface->device_transform.x0),
				 _cairo_fixed_from_int (parent_surface->device_transform.y0 - group_surface->device_transform.y0));

done:
    cairo_surface_destroy (group_surface);

    return group_pattern;
}
开发者ID:MiKTeX,项目名称:miktex,代码行数:42,代码来源:cairo-default-context.c



注:本文中的cairo_pattern_set_matrix函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cairo_perf_timer_elapsed函数代码示例发布时间:2022-05-30
下一篇:
C++ cairo_pattern_set_filter函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap