Debian Codegraph @

src/luma.rs

raw symbols SCIP
1 //! Types for luma and luminance (grayscale) values.
2
3 pub mod channels;
4 #[allow(clippy::module_inception)]
5 mod luma;
6
7 use crate::encoding::{Gamma, Linear, Srgb};
8 use crate::white_point::D65;
9
10 pub use self::luma::{Iter, Luma, Lumaa};
11
12 /// sRGB encoded luminance.
13 pub type SrgbLuma<T = f32> = Luma<Srgb, T>;
14 /// sRGB encoded luminance with an alpha component.
15 pub type SrgbLumaa<T = f32> = Lumaa<Srgb, T>;
16
17 /// Linear luminance.
18 #[doc(alias = "linear")]
19 pub type LinLuma<Wp = D65, T = f32> = Luma<Linear<Wp>, T>;
20 /// Linear luminance with an alpha component.
21 #[doc(alias = "linear")]
22 pub type LinLumaa<Wp = D65, T = f32> = Lumaa<Linear<Wp>, T>;
23
24 /// Gamma 2.2 encoded luminance.
25 pub type GammaLuma<T = f32> = Luma<Gamma<D65>, T>;
26 /// Gamma 2.2 encoded luminance with an alpha component.
27 pub type GammaLumaa<T = f32> = Lumaa<Gamma<D65>, T>;
28
29 /// A white point and a transfer function.
30 pub trait LumaStandard {
31 /// The white point of the color space.
32 type WhitePoint;
33
34 /// The transfer function for the luminance component.
35 type TransferFn;
36 }
37
38 impl<Wp, Tf> LumaStandard for (Wp, Tf) {
39 type WhitePoint = Wp;
40 type TransferFn = Tf;
41 }
42
43 /// A packed representation of Luma+Alpha in LA order.
44 pub type PackedLumaa<P = u16> = crate::cast::Packed<channels::La, P>;
45
46 /// A packed representation of Luma+Alpha in AL order.
47 pub type PackedAluma<P = u16> = crate::cast::Packed<channels::Al, P>;