Skip to main content

colr_types/model/
xyz.rs

1//! CIE 1931 XYZ tristimulus model.
2
3use core::marker::PhantomData;
4
5use crate::BackingStore;
6use crate::illuminant::{D65, Illuminant};
7
8/// CIE XYZ tristimulus space normalized to Y = 1 under illuminant W.
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
10pub struct Xyz<W: Illuminant = D65>(PhantomData<W>);
11
12impl<W: Illuminant> BackingStore<[f32; 3]> for Xyz<W> {}
13impl<W: Illuminant> BackingStore<[f32; 4]> for Xyz<W> {}
14
15#[cfg(feature = "glam")]
16mod glam_impls {
17    use super::*;
18    impl<W: Illuminant> BackingStore<glam::Vec3A> for Xyz<W> {}
19    impl<W: Illuminant> BackingStore<glam::Vec4> for Xyz<W> {}
20}