Debian Codegraph @

node/colorjs.io/src/spaces/a98rgb-linear.js

raw
1 import RGBColorSpace from "../RGBColorSpace.js";
2
3 /** @import { Matrix3x3 } from "../types.js" */
4
5 // convert an array of linear-light a98-rgb values to CIE XYZ
6 // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
7 // has greater numerical precision than section 4.3.5.3 of
8 // https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
9 // but the values below were calculated from first principles
10 // from the chromaticity coordinates of R G B W
11
12 /**
13 * Matrices used by this color space, also available as `A98RGB_Linear.M`
14 * @type {Record<string, Matrix3x3>}
15 */
16 // prettier-ignore
17 export const M = {
18 toXYZ: [
19 [ 0.5766690429101305, 0.1855582379065463, 0.1882286462349947 ],
20 [ 0.29734497525053605, 0.6273635662554661, 0.07529145849399788 ],
21 [ 0.02703136138641234, 0.07068885253582723, 0.9913375368376388 ],
22 ],
23 fromXYZ: [
24 [ 2.0415879038107465, -0.5650069742788596, -0.34473135077832956 ],
25 [ -0.9692436362808795, 1.8759675015077202, 0.04155505740717557 ],
26 [ 0.013444280632031142, -0.11836239223101838, 1.0151749943912054 ],
27 ],
28 };
29
30 export default new RGBColorSpace({
31 id: "a98rgb-linear",
32 cssId: "--a98-rgb-linear",
33 name: "Linear Adobe® 98 RGB compatible",
34 white: "D65",
35 M,
36 });