[cairo] create an image from window for printing

David L idht4n at hotmail.com
Fri Jan 19 11:12:50 PST 2007

>From: Fabian Förg <fabian.foerg at gmx.de>
>To: cairo at cairographics.org
>Subject: [cairo] create an image from window for printing
>Date: Fri, 19 Jan 2007 19:51:03 +0100
>is it possible to capture a gtk-window, save it as an image file and use 
>that file for printing with cairo?
>At first, I tried this:
>pixmap = gdk_pixmap_new(window->window, window->allocation.width, 
>window->allocation.height, -1);
>This should save the window as a pixmap.
>In order to print it, I tried gdk_cairo_set_source_pixbuf, but the function 
>requires a pixbuf as an argument.
>How can I convert the pixmap to a pixbuf and is my approach alright?

I'm not sure if your approach is right, but you can convert a pixmap to
a pixbuf like this I think:

GdkPixbuf *pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL,  0, 0, 
0, 0, -1, -1);

Search for the thread entitled "Re: export GdkPixmap to graphics file?"
on the gtk-list and you'll find a discussion about this.

Good luck...


>cairo mailing list
>cairo at cairographics.org

FREE online classifieds from Windows Live Expo – buy and sell with people 
you know 

More information about the cairo mailing list