Re: Extract image from Gtk::Image



On Mon, 2009-06-01 at 16:07 +1000, Andreas Bauer wrote:
> On Fri, May 22, 2009 at 05:06:39PM -0400, José Alburquerque wrote:
> 
> > > I have a somewhat largish Gtk::Image in my program, and would like to
> > > take out rectangular areas from it, which in turn should be
> > > represented as Gtk::Images for later use.
> > > 
> > > Does someone have any idea on how to achieve this with gtkmm? 
> > > 
> > > I assume I need to do something with a Pixbuffer as intermediate step,
> > > but it wasn't obvious to me on how to actually proceed.
> > 
> > Use one of the Gdk::Pixbuff::create() methods that accept a Gtk::Image.
> > After, construct your images with one of the Gtk::Image constructors. 
> 
> I think, the create methods accept Gdk::Image if at all, or am I
> missing something?

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().  Use
Gdk::Pixbuff::create_subpixbuf() for extracting sub-images. HTH.

-- 
José Alburquerque



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