1use core::marker::PhantomData;
4
5use crate::{BackingStore, ChannelMap};
6use crate::illuminant::{D65, Illuminant};
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
18pub struct Lab<W: Illuminant = D65, const OFFSET: usize = 0>(PhantomData<W>);
19
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
28pub struct LCh<W: Illuminant = D65, const OFFSET: usize = 0>(PhantomData<W>);
29
30impl<W: Illuminant, const OFFSET: usize> BackingStore<[f32; 3]> for Lab<W, OFFSET> {}
31impl<W: Illuminant, const OFFSET: usize> BackingStore<[f32; 4]> for Lab<W, OFFSET> {}
32impl<W: Illuminant, const OFFSET: usize> BackingStore<[f32; 3]> for LCh<W, OFFSET> {}
33impl<W: Illuminant, const OFFSET: usize> BackingStore<[f32; 4]> for LCh<W, OFFSET> {}
34
35impl<W: Illuminant, const OFFSET: usize> ChannelMap<4> for Lab<W, OFFSET> {
36 const INDICES: [usize; 4] = [OFFSET, OFFSET + 1, OFFSET + 2, 3 - OFFSET * 3];
37}
38
39impl<W: Illuminant, const OFFSET: usize> ChannelMap<4> for LCh<W, OFFSET> {
40 const INDICES: [usize; 4] = [OFFSET, OFFSET + 1, OFFSET + 2, 3 - OFFSET * 3];
41}
42
43#[cfg(feature = "glam")]
44mod glam_impls {
45 use super::*;
46 impl<W: Illuminant, const OFFSET: usize> BackingStore<glam::Vec3> for Lab<W, OFFSET> {}
47 impl<W: Illuminant, const OFFSET: usize> BackingStore<glam::Vec3A> for Lab<W, OFFSET> {}
48 impl<W: Illuminant, const OFFSET: usize> BackingStore<glam::Vec4> for Lab<W, OFFSET> {}
49 impl<W: Illuminant, const OFFSET: usize> BackingStore<glam::Vec3> for LCh<W, OFFSET> {}
50 impl<W: Illuminant, const OFFSET: usize> BackingStore<glam::Vec3A> for LCh<W, OFFSET> {}
51 impl<W: Illuminant, const OFFSET: usize> BackingStore<glam::Vec4> for LCh<W, OFFSET> {}
52}