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

C++ cairo_get_source函数代码示例

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

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



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

示例1: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *surface;
    uint32_t data[16] = {
        0xffffffff, 0xffffffff,		0xffff0000, 0xffff0000,
        0xffffffff, 0xffffffff,		0xffff0000, 0xffff0000,

        0xff00ff00, 0xff00ff00,		0xff0000ff, 0xff0000ff,
        0xff00ff00, 0xff00ff00,		0xff0000ff, 0xff0000ff
    };

    surface = cairo_image_surface_create_for_data ((unsigned char *) data,
              CAIRO_FORMAT_RGB24, 4, 4, 16);

    /* We use a non-zero offset larger than the source surface size to
     * stress cairo out a bit more. */
    cairo_set_source_surface (cr, surface, 10, 10);
    cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
    cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
    cairo_paint (cr);

    cairo_surface_destroy (surface);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:redheli,项目名称:cairo-gral,代码行数:26,代码来源:paint-repeat.c


示例2: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *image;
    cairo_t *cr2;

    image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 2, 2);

    /* Fill with an opaque background to avoid a separate rgb24 ref image */
    cairo_set_source_rgb (cr, 0, 0, 0);
    cairo_paint (cr);

    /* First check handling of pattern extents > surface extents */
    cairo_save (cr);
    cairo_scale (cr, width/2., height/2.);

    /* Create a solid black source to merge with the background */
    cr2 = cairo_create (image);
    cairo_set_source_rgb (cr2, 0, 0 ,0);
    cairo_paint (cr2);
    cairo_set_source_surface (cr, cairo_get_target (cr2), 0, 0);
    cairo_destroy (cr2);
    cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_BILINEAR);
    cairo_paint (cr);
    cairo_restore (cr);

    /* Then scale to smaller so we can see the full bilinear extents */
    cairo_save (cr);
    cairo_translate (cr, PAD, PAD);
    cairo_scale (cr, SCALE, SCALE);
    cairo_translate (cr, 0.5, 0.5);

    /* Create a 2x2 blue+red checkerboard source */
    cr2 = cairo_create (image);
    cairo_set_source_rgb (cr2, 1, 0 ,0); /* red */
    cairo_paint (cr2);
    cairo_set_source_rgb (cr2, 0, 0, 1); /* blue */
    cairo_rectangle (cr2, 0, 1, 1, 1);
    cairo_rectangle (cr2, 1, 0, 1, 1);
    cairo_fill (cr2);
    cairo_set_source_surface (cr, cairo_get_target (cr2), 0, 0);
    cairo_destroy (cr2);

    cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_BILINEAR);
    cairo_paint (cr);
    cairo_restore (cr);

    cairo_surface_destroy (image);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:51,代码来源:filter-bilinear-extents.c


示例3: cairo_pattern_get_rgba

void CairoDevice::PushPenColor( const VGColor & color)
{
	double r, g, b, a;
	cairo_pattern_get_rgba (cairo_get_source(fNativeDevice), &r, &g, &b, &a);	
	fPenColorStack.push (VGColor(cc2c(r), cc2c(g), cc2c(b), cc2c(a))); 
	SelectPenColor (color);
}
开发者ID:anttirt,项目名称:guidolib,代码行数:7,代码来源:CairoDevice.cpp


示例4: cairo_image_surface_get_width

/* Scale the surface with the width and height requested */
cairo_surface_t *
scale_surface      (cairo_surface_t  *surface,
                    gdouble           width,
                    gdouble           height)
{
  gdouble old_width = cairo_image_surface_get_width (surface);
  gdouble old_height = cairo_image_surface_get_height (surface);
	
  cairo_surface_t *new_surface = cairo_surface_create_similar(surface, CAIRO_CONTENT_COLOR_ALPHA, width, height);
  cairo_t *cr = cairo_create (new_surface);

  /* Scale *before* setting the source surface (1) */
  cairo_scale (cr, width / old_width, height / old_height);
  cairo_set_source_surface (cr, surface, 0, 0);

  /* To avoid getting the edge pixels blended with 0 alpha, which would 
   * occur with the default EXTEND_NONE. Use EXTEND_PAD for 1.2 or newer (2)
   */
  cairo_pattern_set_extend (cairo_get_source(cr), CAIRO_EXTEND_REFLECT); 

  /* Replace the destination with the source instead of overlaying */
  cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);

  /* Do the actual drawing */
  cairo_paint (cr);
   
  cairo_destroy (cr);

  return new_surface;
}
开发者ID:vulpineblaze,项目名称:cpe190_csus_f14,代码行数:31,代码来源:utils.c


示例5: lime_cairo_get_source

	value lime_cairo_get_source (value handle) {
		
		cairo_pattern_t* pattern = cairo_get_source ((cairo_t*)val_data (handle));
		cairo_pattern_reference (pattern);
		return CFFIPointer (pattern, gc_cairo_pattern);
		
	}
开发者ID:Gemioli,项目名称:lime,代码行数:7,代码来源:CairoBindings.cpp


示例6: cr_get_source

static VALUE
cr_get_source (VALUE self)
{
  VALUE rb_source = Qnil;
  cairo_pattern_t *source;
  source = cairo_get_source (_SELF);

  if (source)
    {
      rb_cairo_check_status (cairo_pattern_status (source));
      rb_source = rb_ivar_get (self, cr_id_source);
      if (NIL_P (rb_source) || RVAL2CRPATTERN (rb_source) != source)
        {
          rb_source = CRPATTERN2RVAL (source);
          rb_ivar_set (self, cr_id_source, rb_source);
        }
    }
  else
    {
      rb_source = Qnil;
      rb_ivar_set (self, cr_id_source, rb_source);
    }

  return rb_source;
}
开发者ID:exvayn,项目名称:cairo-1.8.1-i386,代码行数:25,代码来源:rb_cairo_context.c


示例7: matenu_menu_bar_reset_bg_pixmap

static void matenu_menu_bar_reset_bg_pixmap (MatenuMenuBar* self) {
	GdkPixmap* pixmap;
	cairo_t* cairo;
	cairo_pattern_t* pattern;
	GtkStyle* style;
	GdkPixmap* _tmp0_;
	g_return_if_fail (self != NULL);
	if (matenu_menu_bar_get_background (self)->type != MATENU_BACKGROUND_TYPE_PIXMAP) {
		return;
	}
	if (!GTK_WIDGET_REALIZED ((GtkWidget*) self)) {
		return;
	}
	g_assert (GDK_IS_DRAWABLE (((GtkWidget*) self)->window));
	g_assert (GDK_IS_DRAWABLE (self->priv->_background->pixmap));
	pixmap = gdk_pixmap_new ((GdkDrawable*) ((GtkWidget*) self)->window, ((GtkWidget*) self)->allocation.width, ((GtkWidget*) self)->allocation.height, -1);
	g_assert (GDK_IS_DRAWABLE (pixmap));
	cairo = gdk_cairo_create ((GdkDrawable*) pixmap);
	g_assert (cairo != NULL);
	gdk_cairo_set_source_pixmap (cairo, self->priv->_background->pixmap, (double) (-self->priv->_background->offset_x), (double) (-self->priv->_background->offset_y));
	pattern = cairo_get_source (cairo);
	cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
	cairo_rectangle (cairo, (double) 0, (double) 0, (double) ((GtkWidget*) self)->allocation.width, (double) ((GtkWidget*) self)->allocation.height);
	cairo_fill (cairo);
	style = _g_object_ref0 (gtk_widget_get_style ((GtkWidget*) self));
	style->bg_pixmap[(gint) GTK_STATE_NORMAL] = (_tmp0_ = _g_object_ref0 (pixmap), _g_object_unref0 (style->bg_pixmap[(gint) GTK_STATE_NORMAL]), _tmp0_);
	gtk_style_set_background (style, ((GtkWidget*) self)->window, GTK_STATE_NORMAL);
	gtk_widget_queue_draw ((GtkWidget*) self);
	_g_object_unref0 (style);
	_cairo_destroy0 (cairo);
	_g_object_unref0 (pixmap);
}
开发者ID:Extraterrestrial,项目名称:mate-globalmenu,代码行数:32,代码来源:menubar.c


示例8: _cairo_image_surface_scale_bilinear_2x2

static cairo_surface_t *
_cairo_image_surface_scale_bilinear_2x2 (cairo_surface_t *image,
				         int              new_width,
				         int              new_height)
{
	cairo_surface_t *output;
	cairo_t         *cr;

	output = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
					     new_width,
					     new_height);
	cr = cairo_create (output);
	cairo_scale (cr,
		     (double) new_width / cairo_image_surface_get_width (image),
		     (double) new_height / cairo_image_surface_get_height (image));
	cairo_set_source_surface (cr, image, 0.0, 0.0);
	cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_BILINEAR);
	cairo_rectangle (cr, 0.0, 0.0, cairo_image_surface_get_width (image), cairo_image_surface_get_height (image));
	cairo_fill (cr);
	cairo_surface_flush (output);

	cairo_destroy (cr);

	return output;
}
开发者ID:cristiklein,项目名称:gthumb,代码行数:25,代码来源:cairo-scale.c


示例9: cairo_matrix_init_scale

	cairo_surface_t* Win32UIBinding::ScaleCairoSurface(
		cairo_surface_t* oldSurface, int newWidth, int newHeight)
	{
		cairo_matrix_t scaleMatrix;
		cairo_matrix_init_scale(&scaleMatrix,
			(double) cairo_image_surface_get_width(oldSurface) / (double) newWidth,
			(double) cairo_image_surface_get_height(oldSurface) / (double) newHeight);

		cairo_pattern_t* surfacePattern = cairo_pattern_create_for_surface(oldSurface);
		cairo_pattern_set_matrix(surfacePattern, &scaleMatrix);
		cairo_pattern_set_filter(surfacePattern, CAIRO_FILTER_BEST);

		cairo_surface_t* newSurface = cairo_surface_create_similar(
			oldSurface, CAIRO_CONTENT_COLOR_ALPHA, newWidth, newHeight);
		cairo_t* cr = cairo_create(newSurface);
		cairo_set_source(cr, surfacePattern);

		/* To avoid getting the edge pixels blended with 0 alpha, which would 
		 * occur with the default EXTEND_NONE. Use EXTEND_PAD for 1.2 or newer (2) */
		cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REFLECT);

		 /* Replace the destination with the source instead of overlaying */
		cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);

		/* Do the actual drawing */
		cairo_paint(cr);
		cairo_destroy(cr);

		return newSurface;
	 }
开发者ID:JamesHayton,项目名称:titanium_desktop,代码行数:30,代码来源:win32_ui_binding.cpp


示例10: getSource_func

static JSBool
getSource_func(JSContext *context,
               unsigned   argc,
               jsval     *vp)
{
    JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
    JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());

    cairo_t *cr;
    cairo_pattern_t *pattern;
    JSObject *pattern_wrapper;

    if (argc > 0) {
        gjs_throw(context, "Context.getSource() takes no arguments");
        return JS_FALSE;
    }

    cr = gjs_cairo_context_get_context(context, obj);
    pattern = cairo_get_source(cr);
    if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
        return JS_FALSE;

    /* pattern belongs to the context, so keep the reference */
    pattern_wrapper = gjs_cairo_pattern_from_pattern(context, pattern);
    if (!pattern_wrapper) {
        gjs_throw(context, "failed to create pattern");
        return JS_FALSE;
    }

    rec.rval().set(OBJECT_TO_JSVAL(pattern_wrapper));

    return JS_TRUE;
}
开发者ID:dreamsxin,项目名称:gjs,代码行数:33,代码来源:cairo-context.cpp


示例11: pp_piksl_draw

static gboolean pp_piksl_draw(GtkWidget* widget, cairo_t* cr) {

  ppPiksl* piksl = PP_PIKSL(widget);
                        
  cairo_set_source(cr, PP_APP->checker);
  
  cairo_rectangle(cr, 0, 0,
                  piksl->img_width*piksl->zoom,
                  piksl->img_height*piksl->zoom);
  cairo_fill(cr);

  // Render the graphics data...
  // Zoom the surface
  cairo_scale(cr, piksl->zoom, piksl->zoom);

  // Render each layer
  guint i;
  ppLayer* layer = NULL;
  for (i = 0; i < piksl->layers->len; ++i) {
  
    layer = g_ptr_array_index(piksl->layers, i);
    cairo_set_source_surface(cr, layer->surface, layer->x, layer->y);
    
    // Disable the gaussian filtering to preserve pixels
    cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_NEAREST);
      
    cairo_paint(cr);
  }
  
  return FALSE;
}
开发者ID:pyrated,项目名称:pikslpro,代码行数:31,代码来源:pppiksl.c


示例12: getSource_func

static bool
getSource_func(JSContext *context,
               unsigned   argc,
               JS::Value *vp)
{
    GJS_GET_PRIV(context, argc, vp, rec, obj, GjsCairoContext, priv);
    cairo_t *cr = priv ? priv->cr : NULL;
    cairo_pattern_t *pattern;
    JSObject *pattern_wrapper;

    if (argc > 0) {
        gjs_throw(context, "Context.getSource() takes no arguments");
        return false;
    }

    pattern = cairo_get_source(cr);
    if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
        return false;

    /* pattern belongs to the context, so keep the reference */
    pattern_wrapper = gjs_cairo_pattern_from_pattern(context, pattern);
    if (!pattern_wrapper) {
        gjs_throw(context, "failed to create pattern");
        return false;
    }

    rec.rval().setObject(*pattern_wrapper);

    return true;
}
开发者ID:GNOME,项目名称:gjs,代码行数:30,代码来源:cairo-context.cpp


示例13: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *surface;
    uint32_t data[16] = {
	0x80808080, 0x80808080,		0x80800000, 0x80800000,
	0x80808080, 0x80808080,		0x80800000, 0x80800000,

	0x80008000, 0x80008000,		0x80000080, 0x80000080,
	0x80008000, 0x80008000,		0x80000080, 0x80000080
    };

    surface = cairo_image_surface_create_for_data ((unsigned char *) data,
						   CAIRO_FORMAT_ARGB32, 4, 4, 16);

    cairo_test_paint_checkered (cr);

    cairo_scale (cr, 4, 4);

    cairo_set_source_surface (cr, surface, 2 , 2);
    cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
    cairo_paint (cr);

    cairo_surface_destroy (surface);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:jaglass,项目名称:WinCairoRequirements,代码行数:27,代码来源:paint-source-alpha.c


示例14: on_draw

static gint
on_draw(GtkWidget *widget, cairo_t *cr, gpointer userdata) {
	GdkPixbuf *pixbuf;
	pixbuf = gdk_pixbuf_new_from_file("/usr/share/themes/Ambiance/gtk-2.0/apps/img/panel.png", NULL);
	if (!pixbuf) {
		pixbuf = gdk_pixbuf_new_from_file("/usr/share/lxpanel/images/lubuntu-background.png", NULL);
	}
	if (!pixbuf) {
		pixbuf = gdk_pixbuf_new_from_file("/usr/share/themes/Greybird/ubiquity-panel-bg.png", NULL);
	}
	if (!pixbuf) {
		pixbuf = gdk_pixbuf_new_from_file("/usr/share/budgie-desktop/ubiquity-panel-bg.png", NULL);
	}
	if (!pixbuf) {
		pixbuf = gdk_pixbuf_new_from_file("/usr/share/ubiquity/pixmaps/panel.png", NULL);
	}
	if (pixbuf) {
		gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
		cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_PAD);
		cairo_paint(cr);
		g_object_unref(pixbuf);
	} else {
		g_warning("Could not find background image.");
	}
	struct {
		GtkWidget *container;
		cairo_t *cr;
	} data;
	data.container = widget;
	data.cr = cr;
	gtk_container_forall (GTK_CONTAINER(widget), draw_child, &data);
	return FALSE;
}
开发者ID:linuxmint,项目名称:ubiquity,代码行数:33,代码来源:panel.c


示例15: scheduleScratchBufferPurge

WidgetRenderingContext::~WidgetRenderingContext()
{
    // We do not need to blit back to the target in the fallback case. See above.
    RenderThemeGtk* theme = static_cast<RenderThemeGtk*>(RenderTheme::defaultTheme().get());
    if (!theme->m_themePartsHaveRGBAColormap && m_graphicsContext->gdkWindow())
        return;

    // Don't paint the results back if there was an error.
    if (m_hadError) {
        scheduleScratchBufferPurge();
        return;
    }

    // FIXME: It's unclear if it is necessary to preserve the current source here.
    cairo_t* cairoContext = m_graphicsContext->platformContext()->cr();
    RefPtr<cairo_pattern_t> previousSource(cairo_get_source(cairoContext));

    // The blit rectangle is the original target rectangle adjusted for any extra space.
    IntRect fullTargetRect(m_targetRect);
    fullTargetRect.inflateX(m_extraSpace.width());
    fullTargetRect.inflateY(m_extraSpace.height());

    gdk_cairo_set_source_pixmap(cairoContext, gScratchBuffer, fullTargetRect.x(), fullTargetRect.y());
    cairo_rectangle(cairoContext, fullTargetRect.x(), fullTargetRect.y(), fullTargetRect.width(), fullTargetRect.height());
    cairo_fill(cairoContext);
    cairo_set_source(cairoContext, previousSource.get());
    scheduleScratchBufferPurge();
}
开发者ID:one11onewj,项目名称:platform_external_webkit,代码行数:28,代码来源:WidgetRenderingContext.cpp


示例16: getSource_func

static JSBool
getSource_func(JSContext *context,
               uintN      argc,
               jsval     *vp)
{
    JSObject *obj = JS_THIS_OBJECT(context, vp);
    cairo_t *cr;
    cairo_pattern_t *pattern;
    JSObject *pattern_wrapper;

    if (argc > 0) {
        gjs_throw(context, "Context.getSource() takes no arguments");
        return JS_FALSE;
    }

    cr = gjs_cairo_context_get_context(context, obj);
    pattern = cairo_get_source(cr);
    if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
        return JS_FALSE;

    /* pattern belongs to the context, so keep the reference */
    pattern_wrapper = gjs_cairo_pattern_from_pattern(context, pattern);
    if (!pattern_wrapper) {
        gjs_throw(context, "failed to create pattern");
        return JS_FALSE;
    }

    JS_SET_RVAL(context, vp, OBJECT_TO_JSVAL(pattern_wrapper));

    return JS_TRUE;
}
开发者ID:Cobinja,项目名称:cjs,代码行数:31,代码来源:cairo-context.c


示例17: record_replay

static cairo_test_status_t
record_replay (cairo_t *cr,
	       cairo_t *(*func)(cairo_t *,
				cairo_surface_t *(*pattern)(cairo_t *)),
	       cairo_surface_t *(*pattern)(cairo_t *),
	       int width, int height)
{
    cairo_surface_t *surface;
    int x, y;

    surface = record_get (func (record_create (cr), pattern));

    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
    cairo_set_source_surface (cr, surface, 0, 0);
    cairo_surface_destroy (surface);
    cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_NONE);

    for (y = 0; y < height; y += 2) {
	for (x = 0; x < width; x += 2) {
	    cairo_rectangle (cr, x, y, 2, 2);
	    cairo_clip (cr);
	    cairo_paint (cr);
	    cairo_reset_clip (cr);
	}
    }

    return CAIRO_TEST_SUCCESS;
}
开发者ID:AZed,项目名称:cairo,代码行数:28,代码来源:record-extend.c


示例18: byzanz_layer_cursor_render

static void
byzanz_layer_cursor_render (ByzanzLayer *layer,
                            cairo_t *    cr)
{
  ByzanzLayerCursor *clayer = BYZANZ_LAYER_CURSOR (layer);
  XFixesCursorImage *cursor = clayer->cursor;
  cairo_surface_t *cursor_surface;

  if (clayer->cursor == NULL)
    return;

  cursor_surface = cairo_image_surface_create_for_data ((guchar *) cursor->pixels,
      CAIRO_FORMAT_ARGB32, cursor->width * sizeof (unsigned long) / 4, cursor->height,
      cursor->width * sizeof (unsigned long));
  
  cairo_save (cr);

  cairo_translate (cr, clayer->cursor_x - cursor->xhot, clayer->cursor_y - cursor->yhot);

  /* This is neeed to map an unsigned long array to a uint32_t array */
  cairo_scale (cr, 4.0 / sizeof (unsigned long), 1);
#if G_BYTE_ORDER == G_BIG_ENDIAN
  cairo_translate (cr, (4.0 - sizeof (unsigned long)) / sizeof (unsigned long), 0);
#endif

  cairo_set_source_surface (cr, cursor_surface, 0, 0);
  /* Next line is also neeed for mapping the unsigned long array to a uint32_t array */
  cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
  cairo_paint (cr);
  cairo_restore (cr);

  cairo_surface_destroy (cursor_surface);
}
开发者ID:smtechnocrat,项目名称:byzanz,代码行数:33,代码来源:byzanzlayercursor.c


示例19: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    const cairo_test_context_t *ctx = cairo_test_get_context (cr);
    char *filename;
    cairo_surface_t *surface;

    xasprintf (&filename, "%s/%s", ctx->srcdir,
	       "create-from-png.ref.png");

    surface = cairo_image_surface_create_from_png (filename);
    if (cairo_surface_status (surface)) {
	cairo_test_status_t result;

	result = cairo_test_status_from_status (ctx,
						cairo_surface_status (surface));
	if (result == CAIRO_TEST_FAILURE) {
	    cairo_test_log (ctx, "Error reading PNG image %s: %s\n",
			    filename,
			    cairo_status_to_string (cairo_surface_status (surface)));
	}

	free (filename);
	return result;
    }

    cairo_set_source_surface (cr, surface, 0, 0);
    cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
    cairo_paint (cr);

    cairo_surface_destroy (surface);

    free (filename);
    return CAIRO_TEST_SUCCESS;
}
开发者ID:499940913,项目名称:moon,代码行数:35,代码来源:create-from-png.c


示例20: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    int i, j;
    cairo_surface_t *surface;

    surface = cairo_image_surface_create_for_data ((unsigned char *) &black_pixel,
						   CAIRO_FORMAT_ARGB32,
						   1, 1, 4);

    /* Fill background white */
    cairo_set_source_rgb (cr, 1, 1, 1);
    cairo_paint (cr);

    /* Draw in black */
    cairo_set_source_rgb (cr, 0, 0, 0);

    cairo_translate (cr, PAD, PAD);
    cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);

    for (i = 0; i < POINTS; i++)
	for (j = 0; j < POINTS; j++) {
	    cairo_set_source_surface (cr, surface,
				      2 * i + i * STEP, 2 * j + j * STEP);
	    cairo_pattern_set_filter (cairo_get_source (cr),
				      CAIRO_FILTER_NEAREST);
	    cairo_paint (cr);
	}

    cairo_surface_destroy (surface);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:AliYousuf,项目名称:cairo,代码行数:33,代码来源:a1-image-sample.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ cairo_identity_matrix函数代码示例发布时间:2022-05-30
下一篇:
C++ cairo_get_matrix函数代码示例发布时间: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