[csswg-drafts] [css-images-4] sRGB assumption in cross-fade (#9700)

svgeesus has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-images-4] sRGB assumption in cross-fade ==
This issue was spun out of 
 - https://github.com/w3c/csswg-drafts/issues/9405

In CSS Images 4, [2.6.2. cross-fade Painting](https://drafts.csswg.org/css-images-4/#cross-fade-painting) it states:

> For the purpose of this calculation, each pixel’s color must be in pre-multiplied sRGB.

1. What to do with solid colors or pixel values specified in a non-sRGB colorspace is unspecified
2. The assumption is that the interpolation happens in (gamma-encoded) sRGB space, thus giving results that are too dark
3. There is no way to specify a different interpolation color space
4. The order of operations (when there are more than two colors or images in the cross-fade) is unspecified.

Steps to fix this:

1. Add a a [<color-interpolation-method>](https://drafts.csswg.org/css-color-4/#color-interpolation-method) token, as is already used in `color-mix()`, in `palette-mix()` and in linear, radial and conic gradients. This could be optional (with an sRGB default) or mandatory (since there are no implementations and thus no backwards compat risk)
2. Reference the order of operations from [12. Color Interpolation](https://drafts.csswg.org/css-color-4/#interpolation) so that premultiplication, handling of missing components, etc is consistent with the rest of CSS. This would need to be extended to handle missing components when there are 3 or more inputs, which looks messy, which is why pairwise interpolation is used everywhere else.
3. Define what happens when non-sRGB colors get converted to sRGB (extended range transfer function, components can exceed the range [0,1], as specified in [10.2. The Predefined [sRGB](https://drafts.csswg.org/css-color-4/#valdef-color-srgb) Color Space: the sRGB keyword](https://drafts.csswg.org/css-color-4/#predefined-sRGB))


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9700 using your GitHub account


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

Received on Tuesday, 12 December 2023 19:18:44 UTC