1pub mod emit;
7pub mod golden;
8pub mod lut;
9pub mod matrix;
10pub mod oklab;
11pub mod srgb;
12
13#[derive(Clone, Copy, Debug, PartialEq, Eq)]
15pub enum BakeError {
16 SingularMatrix,
18}
19
20#[derive(Clone, Copy, Debug, PartialEq)]
22pub struct Xy {
23 pub x: f64,
25 pub y: f64,
27}
28
29impl Xy {
30 #[must_use]
32 pub const fn new(x: f64, y: f64) -> Self {
33 Self { x, y }
34 }
35
36 #[must_use]
38 pub fn from_millionths(x_millionths: u32, y_millionths: u32) -> Self {
39 Self {
40 x: f64::from(x_millionths) / 1_000_000.0,
41 y: f64::from(y_millionths) / 1_000_000.0,
42 }
43 }
44}
45
46#[derive(Clone, Copy, Debug, PartialEq)]
48pub struct Primaries {
49 pub r: Xy,
51 pub g: Xy,
53 pub b: Xy,
55 pub white: Xy,
57}
58
59impl Primaries {
60 #[must_use]
62 pub fn srgb() -> Self {
63 Self {
64 r: Xy::new(0.64, 0.33),
65 g: Xy::new(0.30, 0.60),
66 b: Xy::new(0.15, 0.06),
67 white: Xy::new(0.3127, 0.3290),
68 }
69 }
70}