pub struct Chromaticity { /* private fields */ }Expand description
Validated CIE 1931 (x, y) chromaticity coordinate with bit-exact equality & hashing.
Implementations§
Source§impl Chromaticity
impl Chromaticity
Sourcepub const D65: Chromaticity
pub const D65: Chromaticity
CIE 1931 D65 standard illuminant (0.3127, 0.3290).
Sourcepub const D60: Chromaticity
pub const D60: Chromaticity
CIE 1931 D60 ACES illuminant (0.32168, 0.33767).
Sourcepub const D50: Chromaticity
pub const D50: Chromaticity
CIE 1931 D50 ICC PCS illuminant (0.3457, 0.3585).
Sourcepub const DCI: Chromaticity
pub const DCI: Chromaticity
SMPTE RP 431-2 DCI theater white point (0.314, 0.351).
Sourcepub const C: Chromaticity
pub const C: Chromaticity
CIE Standard Illuminant C (0.310, 0.316) — NTSC 1953 (BT.470M) & Generic Film.
Sourcepub const E: Chromaticity
pub const E: Chromaticity
Equal-energy illuminant E (1/3, 1/3).
Sourcepub const fn new(x: f32, y: f32) -> Option<Chromaticity>
pub const fn new(x: f32, y: f32) -> Option<Chromaticity>
Validate and construct a physical CIE 1931 (x, y) chromaticity coordinate
(x > 0, y > 0, x + y < 1, finite — guarantees strictly positive X, Y, Z).
Use new_unbounded_primary for boundary or
virtual/imaginary RGB primaries such as CIE XYZ (R = (1, 0), B = (0, 0)) and
ACES2065-1 AP0 (G = (0, 1), B = (0.0001, -0.0770)).
Sourcepub const fn new_unbounded_primary(x: f32, y: f32) -> Option<Chromaticity>
pub const fn new_unbounded_primary(x: f32, y: f32) -> Option<Chromaticity>
Validate and construct an unbounded RGB primary coordinate, permitting boundary
(y == 0, such as CIE XYZ R = (1, 0), B = (0, 0)) and virtual/imaginary primaries
outside the physical chromaticity triangle such as ACES2065-1 AP0
(G = (0.0, 1.0), B = (0.0001, -0.0770)) and ProPhoto RGB (x + y = 1.0).
Requires finite coordinates with |x|, |y| <= 4.0. Non-singularity of the resulting
projective RGB → XYZ matrix is verified by CustomPrimaries::new.
Sourcepub const fn from_s15fixed16(x: i32, y: i32) -> Option<Chromaticity>
pub const fn from_s15fixed16(x: i32, y: i32) -> Option<Chromaticity>
Validate and construct a physical CIE 1931 (x, y) chromaticity coordinate from
ICC s15Fixed16Number fixed-point values (value = raw / 65536.0, ICC.1:2022 §4.6).
Every representable coordinate in [-4.0, 4.0] converts to f32 without rounding
error (|raw| <= 262_144 < 2^24), so valid s15Fixed16Number values round-trip
bit-exact through to_s15fixed16.
Sourcepub const fn from_s15fixed16_unbounded_primary(
x: i32,
y: i32,
) -> Option<Chromaticity>
pub const fn from_s15fixed16_unbounded_primary( x: i32, y: i32, ) -> Option<Chromaticity>
Validate and construct an unbounded RGB primary coordinate from ICC s15Fixed16Number
values, permitting negative or boundary chromaticities such as ACES AP0 y_B = -0.0770.
Sourcepub const fn to_s15fixed16(self) -> (i32, i32)
pub const fn to_s15fixed16(self) -> (i32, i32)
Encode this chromaticity as a pair of ICC s15Fixed16Number values (round(v * 65536)).
Trait Implementations§
Source§impl Clone for Chromaticity
impl Clone for Chromaticity
Source§fn clone(&self) -> Chromaticity
fn clone(&self) -> Chromaticity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more