Re: [gtkmm] Displaying Images



On Mon, 12 Aug 2002 BelCollan2 netscape net wrote:

> What would be the easiest way to display different image types within
> a window using gtkmm?
> 
> I want to be able to create a window and fill it with an image,
> sometimes a jpeg image, sometimes a png etc. There does not seem to be
> a simple way of doing this, or do i miss something?

You first create a Gdk::Pixbuf:

	Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create ("filename.jpg");

Then you put it in a Gtk::Image widget:

	Gtk::Widget *image = new Gtk::Image (pixbuf);

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
Voltam IQ-teszten. Szerencsére negatív.




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