[cairo] Saving Transparent Image
Niebruegge, William G
william.g.niebruegge at boeing.com
Fri Aug 17 07:19:15 PDT 2007
I have a GTK window using Cairo to create a transparent window (mostly
borrowed code, thank you internet). I would like to be able to save the
contents of this window into a png (or whatever format works). I can't
get the image to save with the transparency effect however. For
example, in this case, instead of getting a yellow tinted image with the
desktop in the background, I just get an opaque yellow image. I've
tried using:
* GdkPixbuf
GdkScreen* screen = gtk_widget_get_screen(widget);
GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen);
GdkPixbuf* pb = gdk_pixbuf_get_from_drawable(NULL,
widget->window, colormap, 0, 0, 0, 0, 200, 125);
gdk_pixbuf_save(pb, "test.png", "png", NULL, NULL);
* cairo_surface
cairo_surface_t* cs =
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 200, 125);
cairo_set_source_surface(cr, cs, 0.0, 0.0);
cairo_surface_t* cs2 = cairo_get_target(cr);
cairo_surface_write_to_png(cs2, "cairo_test.png");
Any ideas on how I can do this?
<<CairoWindow.cpp>> <<snapshot3.png>>
Thanks
william.g.niebruegge at boeing.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CairoWindow.cpp
Type: application/octet-stream
Size: 2732 bytes
Desc: CairoWindow.cpp
Url : http://lists.cairographics.org/archives/cairo/attachments/20070817/ddec1316/attachment-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snapshot3.png
Type: image/png
Size: 54707 bytes
Desc: snapshot3.png
Url : http://lists.cairographics.org/archives/cairo/attachments/20070817/ddec1316/attachment-0001.png
More information about the cairo
mailing list