[gtkmm] how to show an image from file on Gnome::CanvasAA



Hi,
i'm trying to show an image loaded from a file, on the Gnome::Canvas, but i'm not able to do it.

i created the canvas am i'm able to drawing on it ellipse, line ecc... but not images.
To load and to show the image i use this code:

Gtk::Image *im = new Gtk::Image ("left.png");
Gnome::Canvas::Widget *wd = manage (new Gnome::Canvas::Widget(*roads,PoIIt->position.x,PoIIt->position.y, *im));

(where 'roads' is the layer on the canvas where to show the image)

I tryed also, with this code...:

Glib::RefPtr<Gdk::Pixbuf> image = Gdk::Pixbuf::create_from_file("left.png");
Gnome::Canvas::Pixbuf* pix = Gtk::manage(new Gnome::Canvas::Pixbuf ( *roads, PoIIt->position.x, PoIIt->position.y, image ));


but also this doesn't go...

Where is the problem? I don't see my image... and there are no errors...

Thank you very much
Paolo


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