GNOME Bugzilla – Bug 777698
status-notifier: Transparency issues with Pixmap icons
Last modified: 2017-01-25 11:59:20 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.
Created attachment 344156 [details] [review] status-notifier: Fix item icons transparency Patch fixing transparency by applying premultiplication to the data as Cairo expects it.
Can you provide more info? Why should panel modify data it received? I would say that problem is in app that provides icon...
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
Since you can get already pre-multiplied data, converting all icons sounds wrong, no?
(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.
Created attachment 344177 [details] [review] status-notifier: cairo wants premultiplied alpha
Review of attachment 344177 [details] [review]: Looks good.