gdk_pixbuf_save() and const argument issue



Hi,

I am a user of gtkmm library.

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

But this approach is not possible since the save() method of class
Gdk::Pixbuf is not const.

In gtkmm library Gdk::Pixbuf::save() and save_to_buffer() are C++
wrappers around the C functions gdk_pixbuf_save() and
gdk_pixbuf_save_to_buffer(), resp.

Those C++ methods are not declared const since the C functions take a
"GdkPixbuf* pixbuf" parameter (i.e. not const GdkPixbuf* pixbuf).

I wonder why the C functions do not take const GdkPixbuf* argument? Is
the pixbuf modified inside the save functions?

Tom




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