After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332017 - Rounded corners are not transparent
Rounded corners are not transparent
Status: RESOLVED FIXED
Product: gnome-utils
Classification: Deprecated
Component: screenshot
2.13.x
Other All
: Normal normal
: ---
Assigned To: Jonathan Blandford
gnome-utils Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-02-21 11:18 UTC by Michael Hofmann
Modified: 2006-04-23 18:00 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
black corners (5.55 KB, image/png)
2006-02-21 11:18 UTC, Michael Hofmann
  Details
transparent corners (6.04 KB, image/png)
2006-02-21 11:19 UTC, Michael Hofmann
  Details
patch to fix this behaviour (841 bytes, patch)
2006-02-21 11:20 UTC, Michael Hofmann
none Details | Review

Description Michael Hofmann 2006-02-21 11:18:08 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:
Comment 1 Michael Hofmann 2006-02-21 11:18:51 UTC
Created attachment 59835 [details]
black corners
Comment 2 Michael Hofmann 2006-02-21 11:19:19 UTC
Created attachment 59836 [details]
transparent corners
Comment 3 Michael Hofmann 2006-02-21 11:20:35 UTC
Created attachment 59837 [details] [review]
patch to fix this behaviour
Comment 4 Emmanuele Bassi (:ebassi) 2006-02-21 12:05:34 UTC
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?
Comment 5 Michael Hofmann 2006-02-21 14:12:40 UTC
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.
Comment 6 Michael Hofmann 2006-02-21 14:39:51 UTC
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.
Comment 7 Emmanuele Bassi (:ebassi) 2006-04-23 18:00:56 UTC
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)