Re: Extract image from Gtk::Image
- From: Andreas Bauer <baueran rsise anu edu au>
- To: José Alburquerque <jaalburquerque cox net>
- Cc: gtkmm-list gnome org
- Subject: Re: Extract image from Gtk::Image
- Date: Mon, 1 Jun 2009 16:54:43 +1000
On Mon, Jun 01, 2009 at 02:47:34AM -0400, José Alburquerque wrote:
> On Mon, 2009-06-01 at 02:21 -0400, José Alburquerque wrote:
> > That's right. I quickly read the docs, ignoring that the images that
> > the Gdk::Pixbuf::create() methods accepts are Gdk::Image and not
> > Gtk::Image. Still, Gtk::Image has get_pixbuf() which should work
> > instead of using Gdk::Pixbuf::create().
>
> Then again, getting a Gdk::Pixbuf from a Gtk::Image depends on its
> storage type (see:
> http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Image.html#d4e3b782ceebdc884a50dd93ed4c3e2c) so using Gtk::Image::get_pixbuf() will work only if it is already using a Gdk::Pixbuf internally.
Thanks - I figured it out now with your mails. Here's how I ended up
doing it (code somewhat simplified):
Glib::RefPtr<Gdk::Pixbuf> icon_pixbuf = _mypic.get_pixbuf();
Glib::RefPtr<Gdk::Pixbuf> chosen_icon_pb
= Gdk::Pixbuf::create_subpixbuf(icon_pixbuf, 0, 0, 32, 32);
_icon = new Gtk::Image(chosen_icon_pb);
Cheers,
Andreas.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]