[cairo] How to export image_surface pixel data?

Steve Chaplin stevech1097 at yahoo.com.au
Sun Sep 25 18:07:16 PDT 2005

I know you can import/export an entire image in png format using
  cairo_surface_write_to_png() and 
But what if you wish to work directly with pixel data in memory instead
of reading/writing to files?

To import pixel data into cairo you can use

There does not seem to be a corresponding function to allow the export
of pixel data from cairo. I'd expect there to be something like
  "unsigned char *data = cairo_image_surface_get_data()"

I know you could create the surface yourself with
  cairo_image_surface_create_for_data() rather than
and keep the 'data' pointer around to use later. But what if the surface
was created by another library and the 'data' pointer is not available?


Send instant messages to your online friends http://au.messenger.yahoo.com 

More information about the cairo mailing list