Re: Images



Am Mittwoch, den 10.06.2009, 14:03 +1000 schrieb Andreas Bauer:

> If you just want to load and display an image, then I think Gtk::Image
> is what you want as opposed to a Pixbuf.  Just add the loaded
> Gtk::Image (which seems to work, if I interpret your mail correctly)
> then to, say, your window's VBox and all should be well.

> P.S. Recently I discussed on this list a problem related to converting
> Pixbuf and Gtk::Image to each other ("Extract image from Gtk::Image").
> You may want to go and look for this thread.

You are right about the actions to take, but I sense some confusion in
your explanation.  To clarify:

- A Gtk::Image is simply a widget that can display an image.
- A Gdk::Pixbuf actually contains image data.

The term "conversion" is misleading. When you pass a Gdk::Pixbuf to
Gtk::Image, it will not be converted to anything. All it does is to tell
the Gtk::Image to use the data from that pixbuf as a source for painting
itself in the expose event handler.

> On Sat, Jun 06, 2009 at 08:01:31PM -0500, sgayda2 illinois edu wrote:
> > 
> > I am trying to load an image and display it. I tried using the image
> class and then giving it a filename, and it starts up but the image
> does not get displayed. I tried with an incorrect filename and it
> failed as expected so it wasnt the file. I also tried it by using the
> create_from_file and that works. It creates pixbuf of the correct size
> but when i pass it on to the image the image still has a height of 1
> even though the pixbuf says 48.

As Andreas said, just show us the code and we will be able to help.

--Daniel




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