const version of Gdk::Pixbuf::save()



Hello,

In the documentation of Pixbuf
(http://developer.gnome.org/gtkmm/3.4/classGdk_1_1Pixbuf.html) I can not
find const versions of save methods (save, save_to_buffer). I wonder why?

In my application I show some calculated image data employing a
Gtk::Image that is initialized with a Glib::RefPtr <Gdk::Pixbuf>.
Within my saving method I fetch the data as follow:

1 Gtk::Image const& img (my_canvas->getImage()); // getImage() is const
2 Glib::RefPtr<const Gdk::Pixbuf> pix_buf (img.get_pixbuf());
3 pix_buf.save(fname, "png"); // fname is a std::string

The compiler complains:
error: passing ‘const Gdk::Pixbuf’ as ‘this’ argument of ‘void
Gdk::Pixbuf::save(const string&, const Glib::ustring&)’ discards
qualifiers [-fpermissive]

In line 3 of the above code I need the save method to be const.

In general maybe this is not the appropriate way to save the image?

Thank you for your effort to read my text and hopefully answer my questions

tom


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