GNOME Bugzilla – Bug 332017
Rounded corners are not transparent
Last modified: 2006-04-23 18:00:56 UTC
Please describe the problem: Transparency is not used in the resulting png file if there is no alpha channel in the gdk pixmap of the window. This results in black areas for e.g. rounded corners that should be transparent. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 59835 [details] black corners
Created attachment 59836 [details] transparent corners
Created attachment 59837 [details] [review] patch to fix this behaviour
as you can see (even in your patch), the presence alpha channel of the screenshot is controlled by the (eventual) presence of an alpha channel in the pixbuf obtained from the window. your patch blindly bypasses this check and sets the alpha channel as always present; so you should at least remove the call to gdk_pixbuf_get_has_alpha(). but I think this is not a bug of gnome-screenshot: the absence of an alpha channel in the pixbuf returned by gdk_pixbuf_get_from_drawable() is the real issue here, and forcibly adding an alpha channel isn't the best course of action in my opinion. Also: what happens if I *don't* want a screenshot to have an alpha channel?
The check is still necessary to parse the pixels for the X11_EXTENSIONS_SHAPE_H case where the pixmap is manually assembled from the pixels of the rectangles (3 instead of 4 bytes without alpha channel). There is no alpha channel necessary to provide rounded corners, they are not anti-aliased which would require one. The rectangles create the appearance of an alpha channel that has to be kept to be visible in the png file. A compromise could be the generation of a 3 channel png file for the case of only one rectangle or the non-existence of the X11_EXTENSIONS_SHAPE_H include file and a 4 channel file for several rectangles or alpha transparency in the pixmap itself. So I think this is the fault of gnome-screenshot :-). The current version is not capturing my screen although it is displayed correctly.
Hmm, I'm not sure about the 1 rectangle case. Maybe there are windows that have only one smaller rectangle inside but are otherwise transparent, so an additional check of the coordinates would be necessary.
Fixed in HEAD, thanks for the patch. 2006-04-23 Emmanuele Bassi <ebassi@cvs.gnome.org> * screenshot-utils.c (screenshot_get_pixbuf): Fix transparency for shaped windows (closes bug #332017)