Re: How can i save (as image) a drawing_area/pixmap (only gtk-1.2)

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

 



King Heide wrote:
How can i save (as image) a drawing_area/pixmap (only gtk-1.2)?


Not sure if this helps or not (I don't know what have changed from gtk-1.2), but this is how I did it using gtk+ 2.4.



gboolean export_pixmap_to_jpeg(GtkWidget *widget, gchar *filename) { GdkPixbuf *pixbuf; GdkPixmap *pixmap; GtkWidget *canvas; canvas=(GtkWidget*) lookup_widget (GTK_WIDGET (widget), "canvas"); pixmap = g_object_get_data(G_OBJECT(canvas),"pixmap");

  pixbuf = gdk_pixbuf_get_from_drawable(NULL,pixmap,NULL,0,0,0,0,-1,-1);
  gdk_pixbuf_save(pixbuf,filename,"jpeg",NULL,"quality","100",NULL);
	
  g_object_unref(pixbuf);
  return TRUE;
}
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux