[cairo] How to copy one cairo_t's context to another?
micke at imendio.com
Mon Aug 13 03:50:43 PDT 2007
13 aug 2007 kl. 12.26 skrev Magicloud Magiclouds:
> I created a cairo_t from: layer =
> rect->width, rect->height)). And draw something on it. Then I want to
> copy them to the main cairo_t. How to do that?
First off all that code will leak the surface created and you need it
to be able to draw it onto the main cairo_t (called main_cairo_t below).
You'd want to do something along the lines of:
surface = cairo_iamge_surface_create (CAIRO_FORMAT_ARGB32, rect-
layer = cairo_create (surface);
/* Draw something on it */
/* Clean up the context */
/* Draw on the main surface with offset (offset_x, offset_y) */
cairo_set_source_surface (main_cairo_t, surface, offset_x, offset_y);
/* Carry on */
Hope it helps,
Imendio AB, http://www.imendio.com
More information about the cairo