Bug 234606 - [Cairo] Add support for premultiplied alpha interpolated color stop gradients in the Cairo backend
Summary: [Cairo] Add support for premultiplied alpha interpolated color stop gradients...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-22 09:40 PST by Sam Weinig
Modified: 2021-12-29 09:41 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 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).
Comment 1 Adrian Perez 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.)
Comment 2 Fujii Hironori 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.
Comment 3 Radar WebKit Bug Importer 2021-12-29 09:41:16 PST
<rdar://problem/86985929>