Re: Taking screenshots?
- From: Dave Smith <davecindysmith comcast net>
- To: Juhana Sadeharju <kouhia nic funet fi>, gtk-app-devel-list gnome org
- Subject: Re: Taking screenshots?
- Date: Sat, 27 Dec 2003 16:38:51 -0500
On Saturday 27 December 2003 15:51, Juhana Sadeharju wrote:
How do I take screenshot of a window (and of its all widgets)?
What if I have a tab widget and I want take a "screenshot"
of an unvisible tab panel?
I use this code to generate a ".jpg" file from a screenshot. Assuming that
the widget pointer for your toplevel window is "main_window":
GdkWindow *root_window;
GdkPixbuf *screenshot;
gint win_width, win_height;
/* Get the pointer for the root window */
root_window = gtk_widget_get_root_window(main_window);
/* Get the root window's width and height */
gdk_window_get_geometry(root_window,NULL,NULL,&win_width,&win_height,NULL);
/* Take the screenshot */
screenshot = gdk_pixbuf_get_from_drawable(NULL,root_window,
gdk_colormap_get_system(),0,0,0,0,win_width,win_height);
/* "quality" = 70% gives a good image, but the file is only 20% as big */
/* Save the file to "foo.jpg" */
gdk_pixbuf_save(screenshot,"foo.jpg","jpeg",NULL,"quality","70",NULL);
/* Free it */
g_object_unref(screenshot);
This captures everything currently visible on your root window.
I don't believe that it is possible to capture an image that is invisible.
Dave
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]