Skip to content

Commit a398179

Browse files
committed
correct image-p3 transfer functions in sample code
1 parent 928af8f commit a398179

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

css-color-4/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3435,7 +3435,7 @@ Changes</h2>
34353435
<li>Rename P3 to image-p3; avoid claiming this is DCI P3, as these are not the same</li>
34363436
<li>Improved description of the parameters to the "color()" function</li>
34373437
<li>Disallow predefined spaces from "@color-profile" identifier</li>
3438-
<li>Add canonical order to "opacity" property definition</li>
3438+
<li>Add canonical order to "color", "color-adjust" and "opacity" property definitions</li>
34393439
<li>Switch definition of alpha compositing from SVG11 to CSS Compositing</li>
34403440
<li>Clarify sample conversion code is non-normative</li>
34413441
<li>Add Security and Privacy Considerations</li>

css-color-4/conversions.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,25 @@ function XYZ_to_lin_sRGB(XYZ) {
5050
return math.multiply(M, XYZ).valueOf();
5151
}
5252

53-
// DCI P3-related functions
53+
// image-3-related functions
5454

5555

5656
function lin_P3(RGB) {
57-
// convert an array of DCI P3 RGB values in the range 0.0 - 1.0
57+
// convert an array of image-p3 RGB values in the range 0.0 - 1.0
5858
// to linear light (un-companded) form.
5959

60-
return RGB.map(function (val) {
61-
return Math.pow(val, 2.6);
62-
});
60+
return lin_sRGB(RGB); // same as sRGB
6361
}
6462

6563
function gam_P3(RGB) {
66-
// convert an array of linear-light P3 RGB in the range 0.0-1.0
64+
// convert an array of linear-light image-p3 RGB in the range 0.0-1.0
6765
// to gamma corrected form
6866

69-
return RGB.map(function (val) {
70-
return Math.pow(val, 1/2.6);
71-
});
67+
return gam_sRGB(RGB); // same as sRGB
7268
}
7369

7470
function lin_P3_to_XYZ(rgb) {
75-
// convert an array of linear-light P3 values to CIE XYZ
71+
// convert an array of linear-light image-p3 values to CIE XYZ
7672
// using D65 (no chromatic adaptation)
7773
// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
7874
var M = math.matrix([

0 commit comments

Comments
 (0)