Re: Generating widget images offscreen?
- From: Tristan Van Berkom <tristan van berkom gmail com>
- To: Joshua Outwater <joshua outwater sun com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Generating widget images offscreen?
- Date: Sun, 31 Oct 2004 00:09:17 -0400
On Mon, 11 Oct 2004 15:07:08 -0700, Joshua Outwater
<joshua outwater sun com> wrote:
Hi,
I am trying to create an application that will create an instance of a
widget (GtkButton, GtkLabel, ...), set a particular state, and then take
a snapshot of the widget. So far I am assuming I would use
gtk_widget_set_state with the particular state I want to widget to
render in.
You should be able to do something like
/* create an offscreen drawable */
GdkPixmap *pixmap = gdk_pixmap_new(...);
/* copy the widget's rendered data to your pixmap */
gdk_draw_drawable ( ... GDK_DRAWABLE( widget->winodw) ,
GDK_DRAWABLE(pixmap) ... );
Then there should be a function that allows you to make a
GdkPixbuf from a GdkDrawable (which I cant remember the name...),
and then you have gdk_pixbuf_save (...) .
Note that you should use widget->allocation to specify which source
coordinates and dimentions you are going to copy, widget->window
is sometimes a parent window in the case of GTK_NO_WINDOW widgets
(in which case widget->allocation.[xy] will not always be 0)
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]