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 777698 - status-notifier: Transparency issues with Pixmap icons
status-notifier: Transparency issues with Pixmap icons
Status: RESOLVED FIXED
Product: gnome-panel
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Panel Maintainers
Panel Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-24 15:20 UTC by Colomban Wendling
Modified: 2017-01-25 11:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
showcase (2.61 KB, image/png)
2017-01-24 15:20 UTC, Colomban Wendling
  Details
status-notifier: Fix item icons transparency (1.42 KB, patch)
2017-01-24 15:22 UTC, Colomban Wendling
none Details | Review
status-notifier: cairo wants premultiplied alpha (1.68 KB, patch)
2017-01-24 19:08 UTC, Alberts Muktupāvels
none Details | Review

Description Colomban Wendling 2017-01-24 15:20:49 UTC
Created attachment 344155 [details]
showcase

The icons data from the items is non-premultiplied, while Cairo expects premultiplied data.  This leads to ugly rendering of partially transparent icon areas (basically, white-ish instead of transparent).

Attached a capture showing the incorrect (left, current) and correct (right) rendering of the ownCloud icon.
Comment 1 Colomban Wendling 2017-01-24 15:22:09 UTC
Created attachment 344156 [details] [review]
status-notifier: Fix item icons transparency

Patch fixing transparency by applying premultiplication to the data as Cairo expects it.
Comment 2 Alberts Muktupāvels 2017-01-24 15:26:35 UTC
Can you provide more info?

Why should panel modify data it received? I would say that problem is in app that provides icon...
Comment 3 Colomban Wendling 2017-01-24 15:36:26 UTC
Well, admittedly the specification [1] is not clear, but premultiplied alpha being a less common image format (at the very least for storing), I wouldn't be surprised non-premultiplied is expected.
On the other hand Cairo expects premulitplied alpha [2], likely for faster and accurate blending.

In practice though I indeed changed this because several Qt apps showed issues with that;  but OTOH they are the only ones I came across that submitted icon pixmaps instead of icon names.

[1] https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/Icons/
[2] https://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t
Comment 4 Alberts Muktupāvels 2017-01-24 15:54:39 UTC
Since you can get already pre-multiplied data, converting all icons sounds wrong, no?
Comment 5 Colomban Wendling 2017-01-24 16:04:50 UTC
(In reply to Alberts Muktupāvels from comment #4)
> Since you can get already pre-multiplied data

Well, theoretically you could have a gazillion variants I guess, let's say non-linear colorspace :)

> converting all icons sounds wrong, no?

You mean you would like to try and detect whether the values are premultiplied?  I don't think there's a reliable way to detect premultiplication, is there?  You can detect some non-premultiplied cases I guess, when `alpha > channel`, but I don't think this would be reliable.

I myself feel comfortable guessing that image data will never be sent premultiplied, because it's an odd format to transfer data with, and I don't think there is any reason why a client would choose that unless its API gave it that.  And, if you chose to use GdkPixbuf instead of a CairoImageSurface, I don't imagine you'd have tried to handle premulitplied pixmap data -- at least I wouldn't have though about it.

But in any case yeah, until the specification makes it clear, using any format that can legitimately be labeled "ARGB32" would be valid by the spec, and so it's not really possible to blame the item or host choosing either.
Comment 6 Alberts Muktupāvels 2017-01-24 19:08:03 UTC
Created attachment 344177 [details] [review]
status-notifier: cairo wants premultiplied alpha
Comment 7 Colomban Wendling 2017-01-25 09:01:11 UTC
Review of attachment 344177 [details] [review]:

Looks good.