Re: [fxtf-drafts] [css-compositing-2] Remove or fix definition of plus-darker (#447)

> I wrote a test in [web-platform-tests/wpt#41713](https://github.com/web-platform-tests/wpt/pull/41713) that tests the composite modes in canvas. It turns out my test objected to the formula in [#447 (comment)](https://github.com/w3c/fxtf-drafts/issues/447#issuecomment-1489513453) because it wasn't producing properly premultiplied colors: there were cases where the color result was greater than the alpha result, which isn't allowed.
> 
> However, my formula was sort of close; it appears (based on fiddling with my test) that what Safari implements for `plus-darker` is:
> 
> co = min(1, αs + αb) - min(1, αs x (1 - Cs) + αb x (1 - Cb)); αo = min(1, αs + αb);
> 
> (It's possible there's a simpler way to write this, but that's the expression I figured out that leads to Safari passing the test for `plus-darker`.)

I think the formula should be this:

co = max(0, Cb - (1 - Cs) * αs) = max(0, Cb + Cs * αs - αs);
αo = min(1, αs + αb);

This fits perfectly with what I see in Figma. 

-- 
GitHub Notification of comment by Nevodev
Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/447#issuecomment-3013293189 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 27 June 2025 14:34:01 UTC