[cairo] Possibly silly Windows question ...

jerry at chordia.co.uk jerry at chordia.co.uk
Tue Aug 27 12:32:15 PDT 2013

Revisiting Cairo after a very long spell in AGG world so please be gentle.
Assuming a cairo_surface_t is acquired using the following pattern:

cairo_surface_t* surface = cairo_image_surface_create
// get a cairo_t from the surface
cairo_t* ct = cairo_create (surface);
// initialize to clean state
// mythical drawing 
// clean up

can one then do this?

// flush may be required ...
// get raw pixel data as ARGB32
char* pixels = cairo_image_surface_get_data (surface);
// blit pixel data, args obviously elided

If this is valid then does any available hardware acceleration still get
applied to the drawing operations? I'm slightly at a loss to see how it
would (?)

The motivations here are to try and:

Draw things as quickly as possible - i.e. only create surfaces when client
is resized
cache as many Cairo objects as possible to avoid the Create/Paint/Delete
pattern that crops up in the few extant Windows examples.
Only have to blit when painting is required (WM_PAINT received)

Many thanks.

More information about the cairo mailing list