@@ -2149,22 +2149,28 @@ WebGPU allows all of the color spaces in the {{PredefinedColorSpace}} enum.
21492149Note, each color space is defined over an extended range, as defined by the referenced CSS definitions,
21502150to represent color values outside of its space (in both chrominance and luminance).
21512151
2152- <h4 id=out-of-gamut-premultiplied-rgba-value data-dfn-type=dfn>Out-of-Gamut Premultiplied RGBA Values
2152+ <h4>Out-of-Standard-Gamut Color Representation
2153+ <span id=out-of-gamut-premultiplied-rgba-value><!-- historical permalink --></span>
21532154</h4>
21542155
2155- An [=out-of-gamut premultiplied RGBA value=] is one where any of the R/G/B channel values
2156- exceeds the alpha channel value.
2156+ An [=out-of-standard-gamut color representation=] is one where any of the unpremultiplied
2157+ red/green/blue channel numeric values are outside of the 0-to-1 range.
2158+ In a premultiplied representation, the R/G/B value is outside the 0-to-`alpha` range.
2159+
2160+ Any numeric value in any gamut is a well-defined "color" according to that gamut's extended
2161+ color space (regardless of whether the point represents a real or imaginary color).
2162+ That "color" can be represented in other gamuts as well, where it may be in-gamut.
21572163
21582164<div class=example>
2159- For example, the premultiplied sRGB RGBA value `[0.52, 0, 0, 0.5]`
2160- represents the (unpremultiplied) color <code><a funcdef>color</a>(srgb 1.04 0 0 / 0.5)</code>.
2165+ For example, the unpremultiplied sRGB RGBA value `[1.04, 0, 0, 0.5]` and the
2166+ premultiplied sRGB RGBA value `[0.52, 0, 0, 0.5]` both represent the
2167+ CSS color <code><a funcdef>color</a>(srgb 1.04 0 0 / 0.5)</code>
2168+ which is equivalent to <code><a funcdef>color</a>(display-p3 0.95 0.21 0.15 / 0.5)</code>.
21612169</div>
21622170
2163- Just like any color value outside the sRGB color gamut, any value is a well-defined point in the
2164- extended color space (regardless of whether the point represents a real color).
21652171When a canvas containing such a value is
21662172[$get a copy of the image contents of a context|used as an image source$],
2167- the color value must not be clamped in the image value given to the calling algorithm
2173+ the returned image must represent the original color values without clamping,
21682174regardless of the canvas's {{GPUCanvasConfiguration/format}}.
21692175
21702176However, when a canvas containing such a value is displayed *on screen*, **if and only if** the
@@ -2227,15 +2233,14 @@ are ignored.
22272233Note:
22282234Grayscale images generally represent RGB values `(V, V, V)`, or RGBA values `(V, V, V, A)` in their color space.
22292235
2230- Colors are not lossily clamped during conversion: converting from one color space to another
2231- will result in values outside the range [0, 1] if the source color values were outside the range
2232- of the destination color space's gamut. For an sRGB destination, for example, this can occur if the
2233- source is rgba16float, in a wider color space like Display-P3, or is premultiplied and contains
2234- [=out-of-gamut premultiplied RGBA value|out-of-gamut values=]. <!-- FIXME? -->
2236+ Colors must not be lossily clamped during conversion: converting from one color space to another
2237+ may result in an [=out-of-standard-gamut color representation=] in the destination gamut,
2238+ which must be preserved. Refer to that section for details.
22352239
2236- Similarly, if the source value has a high bit depth (e.g. PNG with 16 bits per component) or
2237- extended range (e.g. canvas with `float16` storage), these colors are preserved through color space
2238- conversion, with intermediate computations having at least the precision of the source.
2240+ Similarly, precision must be preserved through color space conversion, with intermediate
2241+ computations being at least as precise as the less-precise of the source and destination
2242+ (for example copying a PNG with 16 bits per component, or a canvas with `float16` storage, into a
2243+ {{GPUTextureFormat/rgba16float}} texture).
22392244
22402245### Color Space Conversion Elision ### {#color-space-conversion-elision}
22412246
0 commit comments