Re: const version of Gdk::Pixbuf::save()
- From: Murray Cumming <murrayc murrayc com>
- To: Kjell Ahlstedt <kjell ahlstedt bredband net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: const version of Gdk::Pixbuf::save()
- Date: Thu, 21 Jun 2012 20:23:48 +0200
On Thu, 2012-06-21 at 19:45 +0200, Kjell Ahlstedt wrote:
> Gdk::Pixbuf::save() and save_to_buffer() are C++ wrappers around the C
> functions gdk_pixbuf_savev() and gdk_pixbuf_save_to_buffer(), resp.
> Those C functions take a "GdkPixbuf* pixbuf" parameter (i.e. not const
> GdkPixbuf* pixbuf). I don't know why. It's unintuitive that they should
> modify the GdkPixbuf, but perhaps they do. Anyway, that's the reason why
> there are no const versions of the corresponding C++ member functions.
>
> A solution (not very attractive, I admit) is to take a copy of the
> Pixbuf with Gdk::Pixbuf::copy() and save the copy.
>
> If you don't get a better answer here, you can try asking on a gtk+ list
> (e.g. gtk-app-devel-list) why the gdk_pixbuf_save*() functions don't
> take const GdkPixbuf*.
The C APIs generally don't use const for complex data types. C doesn't
have everything that's needed to make const as useful, or not annoying,
as in C++. It doesn't mean much. If this should really be const in C++
then we can add that and deprecate the non-const method.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]