[cairo] Cairo double buffer example

Carl Worth cworth at cworth.org
Fri Mar 13 11:52:57 PDT 2009

On Fri, 2009-03-13 at 17:33 +0100, David Björkevik wrote:
> Not an example, but an outline and some pointers:
> 1. Create a cairo image surface using cairo_image_surface_create
> 2. Create a cairo context using cairo_create(surface)
> 3. Do drawing to your new context
> 4. Destroy the context
> 5. Using your original (screen) context, use
> cairo_set_source_surface(context,surface,0,0)
> 6. Use cairo_paint(contxt) to transfer the thing
> 7. cairo_surface_destroy(surface)

That's a good outline, but one improvement would be to create a similar
surface rather than an image surface.

> For newer cairo you can also use cairo_push_group and
> cairo_pop_group_to_source.

And yes, this does make it much easier to follow your recipe, (and does
create a similar surface rather than always creating an image surface).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.cairographics.org/archives/cairo/attachments/20090313/2bfb5104/attachment.pgp 

More information about the cairo mailing list