1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use super::*;
use std::fmt;
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct CmyColor {
pub cyan: f64,
pub magenta: f64,
pub yellow: f64,
}
impl fmt::Display for CmyColor {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"cmy({}%, {}%, {}%)",
self.cyan, self.magenta, self.yellow
)
}
}
impl CmyColor {
pub fn new(cyan: f64, magenta: f64, yellow: f64) -> Self {
Self {
cyan,
magenta,
yellow,
}
}
}
impl From<CmyColor> for Color {
fn from(_: CmyColor) -> Self {
unimplemented!("{}: CMY -> RGB", ColorError::Unimplemented);
}
}
impl From<Color> for CmyColor {
fn from(_: Color) -> Self {
unimplemented!("{}: RGB -> CMY", ColorError::Unimplemented);
}
}