Expand description
Small colour-science helpers: 3×3 matrices, CIE XYZ ↔ Lab*, chromatic adaptation.
All formulas are from public standards: CIE 15 (Lab*), ICC.1:2010 Annex A (PCS, D50), and the Bradford cone response matrix published by Lam (1985).
Constants§
- D50
- The ICC profile connection space illuminant (D50), as encoded in s15Fixed16 in every ICC header: X = 0.9642, Y = 1.0, Z = 0.8249.
- D65_XY
- CIE D65 white point as XYZ (Y = 1), from the chromaticity (0.3127, 0.3290) used by sRGB, Display P3 and Adobe RGB-compatible spaces.
- IDENTITY
Functions§
- apply
- bradford
- Bradford chromatic adaptation matrix from white
srcto whitedst(both XYZ). - d50_
quantized - The D50 illuminant exactly as an ICC header stores it (s15Fixed16).
- delta_
e76 - CIE 1976 colour difference.
- det
- invert
- Inverse, or
Nonewhen (nearly) singular. - lab_
to_ xyz - CIE Lab* → XYZ relative to
white. - lab_
to_ xyz_ f32 - mul
- rgb_
to_ xyz_ matrix - RGB → XYZ matrix (relative to
white, Y = 1) for primaries given as chromaticities, orNonewhen the primaries are not independent. - s15f16_
round - Quantizes to ICC s15Fixed16Number and back (what a profile can actually store).
- xy_
to_ xyz - XYZ (Y = 1) of a chromaticity
(x, y). - xyz_
to_ lab - CIE XYZ → Lab* relative to
white(CIE 15). - xyz_
to_ lab_ f32 - f32 versions for the hot paths (D50 PCS only).
Type Aliases§
- Mat3
- Row-major 3×3 matrix.