Skip to main content

Chromaticity

Struct Chromaticity 

Source
pub struct Chromaticity { /* private fields */ }
Expand description

Full re-export of zenpixels core types (zero module name collisions!). Validated CIE 1931 (x, y) chromaticity coordinate with bit-exact equality & hashing.

Implementations§

Source§

impl Chromaticity

Source

pub const D65: Chromaticity

CIE 1931 D65 standard illuminant (0.3127, 0.3290).

Source

pub const D60: Chromaticity

CIE 1931 D60 ACES illuminant (0.32168, 0.33767).

Source

pub const D50: Chromaticity

CIE 1931 D50 ICC PCS illuminant (0.3457, 0.3585).

Source

pub const DCI: Chromaticity

SMPTE RP 431-2 DCI theater white point (0.314, 0.351).

Source

pub const C: Chromaticity

CIE Standard Illuminant C (0.310, 0.316) — NTSC 1953 (BT.470M) & Generic Film.

Source

pub const E: Chromaticity

Equal-energy illuminant E (1/3, 1/3).

Source

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)).

Source

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.

Source

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.

Source

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.

Source

pub const fn to_s15fixed16(self) -> (i32, i32)

Encode this chromaticity as a pair of ICC s15Fixed16Number values (round(v * 65536)).

Source

pub const fn x(self) -> f32

Chromaticity x coordinate.

Source

pub const fn y(self) -> f32

Chromaticity y coordinate.

Source

pub const fn xy(self) -> (f32, f32)

Tuple (x, y).

Trait Implementations§

Source§

impl Clone for Chromaticity

Source§

fn clone(&self) -> Chromaticity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Chromaticity

Source§

impl Debug for Chromaticity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for Chromaticity

Source§

impl Hash for Chromaticity

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Chromaticity

Source§

fn eq(&self, other: &Chromaticity) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.