Creating a pixbuf from a Cairo image surface



I'm intending to create an image surface in Cairo, draw on it, and, when done, create a gdk pixbuf from the image surface. Eventually the pixbuf is sent to the server side and converted into an image, or, in an alternative scenario it is saved as an image on the client side.

The only problem (not really, just a drawback) I can see in this is the fact that cairo formats and what gdk_pixbuf_new_from_data requires do not match. AFAIK gdk requires data that is made of 24 bit RGB pixels and cairo creates 32 bit ARGB or XRGB (X is unused 8 bits) pixels. So it seems that I need to do a copy from one buffer to another in the last step in the process.

Am I correct? Or is there something built-in that I could use for the conversion.

Regards,

Ari

--
Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka / Geoinformation and positioning
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]