How to get a drawing area widget as a file?.




Hi all,
 
           Im desperately trying to get a drawing area widget as a bmp file but in vain. My code looks like this.....
 
 

colormap = gtk_widget_get_colormap(da_setting_ff);

gtk_widget_realize(da_setting_ff);

pixbuf = gdk_pixbuf_get_from_drawable(NULL,GTK_DRAWABLE(da_setting_ff)->window,colormap,da_setting_ff->allocation.x, da_setting_ff->allocation.y, 0, 0,da_setting_ff->allocation.width, da_setting_ff->allocation.height );

bpp = gdk_pixbuf_get_bits_per_sample(pixbuf);

printf("%d\n", bpp);

gdk_pixbuf_save (pixbuf, "/root/handle.bmp", "bmp",NULL, "100", NULL);

g_object_unref(pixbuf);

 
 
                             The above code was not working, I got an error saying something like "src != NULL failed". I would like to know whats wrong in that. Is there any other means to get the drawing area in to the pixbuf?.If so please let me know.
 

--
_____________
Regards,

K.Sadheeskumar.


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