Reputation: 11
While using GDK in C/C++, I try to copy a GdkPixbuf with a transparent background over another GdkPixbuf, gdk_pixbuf_copy_area() says:
(scrol:6227): GdkPixbuf-CRITICAL **: 10:41:37.084: gdk_pixbuf_copy_area: assertion '!(gdk_pixbuf_get_has_alpha (src_pixbuf) && !gdk_pixbuf_get_has_alpha (dest_pixbuf))' failed
If gdk_pixbuf_copy_area() won't do it, then how do I do this? I want to change the destination GdkPixbuf, not the display or window or whatever, so overlays and composites don't seem to be the answer.
thanks.
Upvotes: 1
Views: 276
Reputation: 18420
It looks, like your destination GdkPixbuf does not have an alpha channel, whereas your source GdkPixbuf does. This is an invalid combination.
Try to add an alpha channel to your destination Pixbuf with
dest_alpha = gdk_pixbuf_add_alpha(dest, false, 0, 0, 0);
prior to calling gdk_pixbuf_copy_area()
to get rid of this assert. Note, that this will create a new pixbuf with an alpha channel added (see the manpage gdk_pixbuf_add_alpha())
Upvotes: 0