Re: [csswg-drafts] [css-color-4] Premultiplication in cylindrical spaces and mixing (#11238)

Oops, I realize I made a mistake in formulating this question, as I believed that `color-mix` was capable of representing the Porter-Duff `over` operator, and, now, looking at it more closely, it seems that it is only capable of representing `lerp` but with an additional alpha scaling step.

So I think there are two separate concerns. One is the mismatch as pointed out, which I agree with @facelessuser is most likely a spec drafting issue. The second is whether the color representation is suitable for *compositing,* which is the main question I'm trying to raise right now. We do already have an `interpolate` method which does the `color-mix` functionality except for the scaling by 1 / (p1 + p2), and we have a separate `mul_alpha` which can perform that additional step.

To me, interpolation and compositing are closely related. In particular, I believe compositing color-a / alpha over opaque color-b should match `color-mix(color-a alpha, color-b)`. In rectangular spaces, that is not controversial, but if we allow compositing in cylindrical spaces, it is.

So strike "another way of phrasing this," and the last paragraph should read: For context, this came up when we were starting to contemplate an `over` method in our new Rust [color](https://github.com/linebender/color) crate. My original hope is that the `PremulColor` type we defined for CSS Color Level 4 interpolation would also efficiently support compositing, but that is not looking hopeful at the moment.

Apologies for the confusion.

-- 
GitHub Notification of comment by raphlinus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11238#issuecomment-2484769651 using your GitHub account


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

Received on Tuesday, 19 November 2024 05:56:42 UTC