Re: [fxtf-drafts] [compositing] Question: How to properly blend and composite isolated groups (#440)

> PS. You can [see our code for blending here](https://github.com/dequelabs/axe-core/blob/bdf806823b3a84070553940a5e492c1f281acf8c/lib/commons/color/flatten-colors.js).

Your code is giving me the correct result for your example, if used as follows:

```js
const A = new Color(255, 255, 255, 1.0);
const B = new Color(0, 128, 0, 0.25);
const C = new Color(255, 0, 0, 0.5);
const AB = flattenColors(B, A);
const ABC = flattenColors(C, AB, "difference")
```

I think the one thing it's missing is the final unpremultiplication at the end of `flattenColors`; `simpleAlphaCompositing` gives you a premultiplied component but the `Color` constructor takes unpremultiplied components. So the code will give incorrect results whenever the composited result is non-opaque.

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


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

Received on Monday, 1 November 2021 16:57:50 UTC