Gdk::Pixbuf: get_pixels(): Const corrections.

parent 8028dfb9
......@@ -166,4 +166,9 @@ std::vector<PixbufFormat> Pixbuf::get_formats()
return Glib::SListHandler<PixbufFormat, PixbufFormatTraits>::slist_to_vector(gdk_pixbuf_get_formats(), Glib::OWNERSHIP_SHALLOW);
}
const guint8* Pixbuf::get_pixels(guint& length) const {
length = get_byte_length();
return gdk_pixbuf_read_pixels(const_cast<GdkPixbuf*>(gobj()));
}
} // namespace Gdk
......@@ -218,8 +218,18 @@ public:
_WRAP_METHOD(int get_n_channels() const, gdk_pixbuf_get_n_channels)
_WRAP_METHOD(bool get_has_alpha() const, gdk_pixbuf_get_has_alpha)
_WRAP_METHOD(int get_bits_per_sample() const, gdk_pixbuf_get_bits_per_sample)
_WRAP_METHOD(guint8* get_pixels() const, gdk_pixbuf_get_pixels)
_WRAP_METHOD(guint8* get_pixels(guint& length) const, gdk_pixbuf_get_pixels_with_length)
// Note that the const version uses gdk_pixbuf_read_pixels, not gdk_pixbuf_get_pixels(),
// because gdk_pixbuf_get_pixels() is documented as sometimes copying data internally
// so the caller can make changes, but a const version wouldn't ever do that.
_WRAP_METHOD(guint8* get_pixels(), gdk_pixbuf_get_pixels)
_WRAP_METHOD(const guint8* get_pixels() const, gdk_pixbuf_read_pixels)
_WRAP_METHOD(guint8* get_pixels(guint& length), gdk_pixbuf_get_pixels_with_length)
// We hand-code this because there is no gdk_pixbuf_read_pixels_with_length().
const guint8* get_pixels(guint& length) const;
_WRAP_METHOD(int get_width() const, gdk_pixbuf_get_width)
_WRAP_METHOD(int get_height() const, gdk_pixbuf_get_height)
_WRAP_METHOD(int get_rowstride() const, gdk_pixbuf_get_rowstride)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment