[cairo] Loading images
Olivier Andrieu
oliv__a at users.sourceforge.net
Tue Feb 24 06:29:43 PST 2004
Sanjay Gupta [Tuesday 24 February 2004] :
>
> Hi List,
> How can i work with images loaded through
> gdkpixbuf library.
> cairo_surface_create_for_image accepts a char* but
> gdk_pixbuf_new_from_file() function of gdkpixbuf library
> returns me a GdkPixbuf structure. Can anyone tell me
> how to use GdkPixbuf struct with cairo?
gdk_pixbuf_get_pixels () gives you a pointer to the actual pixel
buffer.
But you'll have to do some conversion because gdk-pixbuf and Cairo
have sensibly different ways of representing the pixel data:
- 24 bits data are "packed" in gdk-pixbuf but not in Cairo
(ie there is 3 bytes per pixel in gdk-pixbuf but 4 in Cairo)
- 32 bits data have different ordering of the color components
--
Olivier
More information about the cairo
mailing list