GNOME Bugzilla – Bug 68801
Make gdk_pixbuf_render_to_drawable() use the alpha channel
Last modified: 2011-02-04 16:09:14 UTC
Sort of an API change, but won't actually break anything, and this would be very useful to avoid writing dumb custom clipping code all over the place. Browsing LXR, the function is rarely used, and when it is it's used because people are sure the image has no alpha channel - and in those cases nothing will change.
The one exception to the idea that it wouldn't break anything is when it is being used for threshold alpha rendering - then you get a mix between real alpha and threshold alpha which is probably not what was intended. (But if the source image was bilevel, there won't be a problem except for possible slowness.)
Another issue is that if you know you don't want to draw alpha, you can frequently draw a lot faster; even if alpha compositing can be made fast, not alpha compositing is faster. The pixbuf-engine could use this for opaque sections; of course, in a special case like this, it could also use GdkRGB directly instead of gdk_pixbuf_render()
I can't think of many examples where you know the image is opaque but create a pixbuf with an alpha channel anyhow - after all if you're being efficiency-minded, presumably you don't want to waste those bytes... The final desired API is probably: gdk_draw_pixbuf () and maybe: gdk_draw_pixbuf_ignoring_alpha () since render_to_drawable() is just a stopgap thing it makes sense to me to have it be equivalent to gdk_draw_pixbuf(). Plus I need it for the GtkImage desensitization patch. ;-)
Well, pixbuf-engine is an excellent example of such. It frequently cuts up an image into some areas that have alpha, and some that don't. But yes, it's probably a fairly uncommon case. Tue Jan 29 17:40:02 2002 Owen Taylor <otaylor@redhat.com> * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable): Call _gdk_draw_pixbuf(), thus enabling using this function for pixbufs with alpha. (#68801) * gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Move implementation of gdk_pixbuf_render_to_drawable() to here.