Re: Question in using gdk_pixbuf_get_from_drawable()



Hi,

where does your "window" object come from ? Could you please give us the code where you initilized it ? I've tried to adapt your code in a simple example, and it just works... I get a screenshot of what is in the window, without the window decoration.

Cheers,

Luis

ying lcs a écrit :
Hi,

I have a question of using gdk_pixbuf_get_from_drawable(). I have the
following code which save the gdk window to a png file.
But something I get something which is totally not what is displayed
on the window. Can you please tell me what am I missing?

GdkWindow *window ;

if (window != NULL) {

      int x, y, width, height, depth;

      gdk_window_get_geometry( window, &x, &y, &width, &height, &depth );

      printf (" width=%d, height=%d\n", width, height);

      /* copy the pixmap from the treeview and from the title */
      pb = gdk_pixbuf_get_from_drawable(NULL,
                                        GDK_DRAWABLE(window),
                                        NULL, 0, 0, 0, 0, width, height);


      /* save the pixbuf to a png file */
      gdk_pixbuf_save(pb, filename, "png", NULL,
                      "compression", "9",
                      NULL);
    }

Thank you.


------------------------------------------------------------------------

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]