Re: cairo surface from GdkPixmap
- From: Dov Grobgeld <dov grobgeld gmail com>
- To: Andrew Cowie <andrew operationaldynamics com>
- Cc: gtk-list <gtk-devel-list gnome org>
- Subject: Re: cairo surface from GdkPixmap
- Date: Sun, 14 Jun 2009 08:23:40 +0300
Hi Andrew,
See my tutorial at:
http://giv.sourceforge.net/gtk-image-viewer/gtkimageviewer_tutorial.html
and search for "cairo" for an example of how to draw on a pixbuf with cairo. Basically all you need to do is:
cairo_surface_t *surface
= cairo_image_surface_create_for_data(gdk_pixbuf_get_pixels(pixbuf),
CAIRO_FORMAT_RGB24,
img_width,
img_height,
gdk_pixbuf_get_rowstride(pixbuf));
Beware cairo's and gdkpixbuf's ideas about r,g, and b, are swapped so you will need to swap the blue and the red channels when painting.
Regards,
Dov
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]