Skip to content

Commit 2863fba

Browse files
committed
[cAdded new section, sample code for color conversions #9934
1 parent dfbf5df commit 2863fba

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

css-color-hdr-1/Overview.bs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ WPT Display: open
9999
"What_is_ICtCp": {
100100
"href": "https://professional.dolby.com/siteassets/pdfs/ictcp_dolbywhitepaper_v071.pdf",
101101
"title": "What is ICtCp, v7.1",
102-
"publisher": "Dolby",
103-
102+
"publisher": "Dolby"
104103
}
105104
}
106105
</pre>
@@ -890,7 +889,7 @@ Converting JzCzHz colors to Jzazbz colors</h4>
890889
the Hunt-Pointer-Estevez (HPE) XYZ to LMS transform
891890
is used,
892891
normalized to a [=D65=] whitepoint.
893-
A crosstalk matrix is then applied,
892+
A 4% crosstalk matrix is then applied [[What_is_ICtCp]],
894893
to reduce the gamut hull concavities of BT.2020 RGB,
895894
thus reducing interpolation errors.
896895
The crosstalk also provides improved lines of constant hue
@@ -921,11 +920,12 @@ Converting JzCzHz colors to Jzazbz colors</h4>
921920
by a conversion from linear-light BT.2100 RGB [[Rec_BT.2100]],
922921
this conversion proceeds via LMS
923922
and thus, any other color space can also be represented
924-
by applying an XYZ to LMS transform.
923+
by applying an XYZ to LMS transform
924+
as shown in [[What_is_ICtCp]].
925925

926-
Note that unlike Lab, a [=D65=] whitepoint is used.
926+
Note that unlike CIE ''Lab'', a [=D65=] whitepoint is used.
927927

928-
Also unlike Lab, which has primarily been tested with
928+
Also unlike ''Lab'', which has primarily been tested with
929929
lower-intensity reflective colors,
930930
IC<sub>T</sub>C<sub>P</sub> has been tested with
931931
high-chroma,
@@ -1034,6 +1034,29 @@ Serializing values of the ''color()'' function</h3>
10341034
is recommended for internal storage).
10351035
Values must be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.
10361036

1037+
<!--
1038+
██████ ███████ ████████ ████████
1039+
██ ██ ██ ██ ██ ██ ██
1040+
██ ██ ██ ██ ██ ██
1041+
██ ██ ██ ██ ██ ██████
1042+
██ ██ ██ ██ ██ ██
1043+
██ ██ ██ ██ ██ ██ ██
1044+
██████ ███████ ████████ ████████
1045+
-->
1046+
1047+
<h2 id="color-conversion-code">
1048+
Sample code for Color Conversions</h2>
1049+
1050+
<em>This section is not normative.</em>
1051+
<wpt title="This section is not normative, it does not need tests."></wpt>
1052+
1053+
1054+
For clarity, <a href="https://drafts.csswg.org/css-color-4/multiply-matrices.js">a library</a> is used for matrix multiplication.
1055+
(This is more readable than inlining all the multiplies and adds).
1056+
The matrices are in <a href="https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/geometry/row-major-vs-column-major-vector">column-major order</a>.
1057+
1058+
This code also assumes all of the conversion code from
1059+
[[css-color-4#color-conversion-code]] is available.
10371060

10381061
<!--
10391062
████████ ████████ ██ ████████ ███ ████████

0 commit comments

Comments
 (0)