[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Re: possibility of export image?
From:       Oliver Nittka <nittka () esem ! com>
Date:       2006-11-23 9:00:33
Message-ID: 45656331.4020907 () esem ! com
[Download RAW message or body]

oedipus schrieb:
> Hi,
> 
> is it possible with the gtkmm libary to export a Gtk::Image or
> Gtk::Drawingarea into some kind of image format, like jpg or png? If that is

"widget" is a Gtk::Image* or a Gtk::DrawingArea*:

Glib::RefPtr<Gdk::Drawable> drwbl = widget->get_window();
Glib::RefPtr<Gdk::Pixbuf> pxb;
pxb = Gdk::Pixbuf::create(drwbl, drwbl->get_colormap(),
                           0, 0, 0, 0,
                           widget->get_width(),widget->get_height());
try {
  pxb->save("Image.png", "png");
}
catch (Glib::Exception &e) {
  std::cerr << "could not save: " << e.what() << std::endl;
}

> Thank you in advance
> Alex

HTH
  --o
-- 
Oliver Nittka
ESEM Grünau GmbH & Co. KG
Dornierstraße 6, 88677 Markdorf/Germany
phone: +49 7544 9583-25, fax: +49 7544 9583-60
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic