Re: drawing area to image file ???



42052670  wrote:

Can I save or snap my Drawing Area into image file such as JPG, GIF?


/* VERY SIMPLIFIED and UNTESTED example */
static void save_2_jpeg(GtkWidget *area)
{
GdkPixbuf *pixbuf;

   pixbuf = gdk_pixbuf_get_from_drawable(
                           NULL,
                           area->window,
                           gtk_widget_get_colormap(area),
                           0,0,
                           0,0,
                           -1,-1
   );    /* getting pixbuf */

gdk_pixbuf_save(pixbuf, "drawingarea.jpeg", "jpeg", NULL); /* saving pixbuf to jpeg */

   g_object_unref(pixbuf);    /* freeing pixbuf */
}

/* Olexiy */





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