Hi all,

I'm trying to display a static image in a Gtk::Image widget.  I have
the image as a Cairo::ImageSurface, so I assumed I could call
Gtk::Image::set(surface) however this does not work - the widget
changes from the "missing image" icon to blank (all white.)

If instead I call Gdk::Pixbuf::create(surface, 0, 0, width, height) and
pass the resulting Pixbuf to Gtk::Image::set() then it works.

I am wondering why the set() call works when I pass a Gdk::Pixbuf, but
not when I pass a Cairo::Surface?

Passing the Cairo::Surface is easier for me (don't have to have code to
retrieve image dimensions) so I'd rather do that if I can.

  auto cimg = Cairo::ImageSurface::create(...);
  ...
  Glib::RefPtr<Gtk::Image> ctImage = ...

  // This works
  //ctImage->set(Gdk::Pixbuf::create(cimg, 0, 0, width, height));

  // This doesn't work - why?
  ctImage->set(cimg);

Many thanks,
Adam.


_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to