NEW234606
[Cairo] Add support for premultiplied alpha interpolated color stop gradients in the Cairo backend
https://bugs.webkit.org/show_bug.cgi?id=234606
Summary [Cairo] Add support for premultiplied alpha interpolated color stop gradients...
Sam Weinig
Reported 2021-12-22 09:40:34 PST
With https://bugs.webkit.org/show_bug.cgi?id=234492, we added support for choosing between premultiplied alpha and unpremultiplied alpha color stop interpolation for Gradient, but only for the CoreGraphics backend. To support CSS gradients, the Cairo needs to add support for both modes as well (the unpremultiplied case is still needed for SVG and Canvas).
Attachments
Adrian Perez
Comment 1 2021-12-22 13:47:35 PST
AFAIU, with Cairo we set the colors for the stops un-premultiplied (because there is no other option, that's what the public API allows), then Cairo pre-multiplies color values while building its internal state, then internally always does calculations using premultiplied values, meaning that when painting a gradient it will interpolate stop colors which are premultiplied — there is no way of telling Cairo to calculate interpolaton of gradient stops un-premultiplied. Meaning: with Cairo the way it paints gradiants the output is correct for CSS, but not SVG/Canvas. (Take this with some big grains of salt, I am not a graphics expert, what I *think* know is from looking sometimes inside Cairo in the last months.)
Fujii Hironori
Comment 2 2021-12-23 13:18:02 PST
(In reply to Adrian Perez from comment #1) > Meaning: with Cairo the way it paints gradiants the output > is correct for CSS, but not SVG/Canvas. Is this right? fast/gradients/alpha-premultiplied.html is failing for Cairo ports. This is not a test case for SVG or Canvas.
Radar WebKit Bug Importer
Comment 3 2021-12-29 09:41:16 PST
Note You need to log in before you can comment on or make changes to this bug.