image_overlay/
blend_mode.rs1use std::fmt;
2
3
4#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)]
14#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15pub enum BlendMode {
16 #[default]
17 Normal,
18 Dissolve,
19
20 Darken,
21 Multiply,
22 ColorBurn,
23 LinearBurn,
24 DarkerColor,
25
26 Lighten,
27 Screen,
28 ColorDodge,
29 LinearDodge,
30 LighterColor,
31
32 Overlay,
33 SoftLight,
34 HardLight,
35 VividLight,
36 LinearLight,
37 PinLight,
38 HardMix,
39
40 Difference,
41 Exclusion,
42 Subtract,
43 Divide,
44
45 Hue,
46 Saturation,
47 Color,
48 Luminosity,
49}
50
51impl fmt::Display for BlendMode {
52
53 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54 let mode_str = match self {
55 BlendMode::Normal => "Normal",
56 BlendMode::Dissolve => "Dissolve",
57 BlendMode::Darken => "Darken",
58 BlendMode::Multiply => "Multiply",
59 BlendMode::ColorBurn => "ColorBurn",
60 BlendMode::LinearBurn => "LinearBurn",
61 BlendMode::DarkerColor => "DarkerColor",
62 BlendMode::Lighten => "Lighten",
63 BlendMode::Screen => "Screen",
64 BlendMode::ColorDodge => "ColorDodge",
65 BlendMode::LinearDodge => "LinearDodge",
66 BlendMode::LighterColor => "LighterColor",
67 BlendMode::Overlay => "Overlay",
68 BlendMode::SoftLight => "SoftLight",
69 BlendMode::HardLight => "HardLight",
70 BlendMode::VividLight => "VividLight",
71 BlendMode::LinearLight => "LinearLight",
72 BlendMode::PinLight => "PinLight",
73 BlendMode::HardMix => "HardMix",
74 BlendMode::Difference => "Difference",
75 BlendMode::Exclusion => "Exclusion",
76 BlendMode::Subtract => "Subtract",
77 BlendMode::Divide => "Divide",
78 BlendMode::Hue => "Hue",
79 BlendMode::Saturation => "Saturation",
80 BlendMode::Color => "Color",
81 BlendMode::Luminosity => "Luminosity",
82 };
83 write!(f, "{}", mode_str)
84 }
85}