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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
use crate::utils::IsDefault;
use enum_display::EnumDisplay;
/// Specifies how a node's pixels are blended with the backdrop (background).
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2
#[derive(Debug, Hash, Eq, PartialEq, Copy, Clone, Default, EnumDisplay)]
pub enum BlendMode {
/// The node is rendered without any blending.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingnormal
#[default]
#[display("normal")]
Normal,
/// Selects the darker of the backdrop and source colors. Areas lighter than
/// the backdrop remain unchanged.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingdarken
#[display("darken")]
Darken,
/// Multiplies the source and backdrop colors.
///
/// The result is always darker than or equal to either input. White
/// preserves the original color; black results in black.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingmultiply
#[display("multiply")]
Multiply,
/// Darkens the backdrop color to reflect the source color.
///
/// Painting with white produces no change.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingcolorburn
#[display("color-burn")]
ColorBurn,
/// Selects the lighter of the backdrop and source colors.
///
/// Areas darker than the backdrop remain unchanged.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendinglighten
#[display("lighten")]
Lighten,
/// Multiplies the complements of the source and backdrop colors.
///
/// The result is always lighter than or equal to either input. Black
/// preserves the original color; white results in white.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingscreen
#[display("screen")]
Screen,
/// Brightens the backdrop color based on the source color.
///
/// Painting with black produces no change.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingcolordodge
#[display("color-dodge")]
ColorDodge,
/// Multiplies or screens colors depending on the backdrop.
///
/// Preserves highlights and shadows of the backdrop while mixing in the
/// source color.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingoverlay
#[display("overlay")]
Overlay,
/// Darkens or lightens colors depending on the source color.
///
/// Produces a softer effect than [`HardLight`], similar to a diffused
/// spotlight.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingsoftlight
///
/// [`HardLight`]: Self::HardLight
#[display("soft-light")]
SoftLight,
/// Multiplies or screens colors depending on the source color.
///
/// Produces a high-contrast effect similar to a harsh spotlight.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendinghardlight
#[display("hard-light")]
HardLight,
/// Subtracts the darker color from the lighter one.
///
/// Painting with white inverts the backdrop; black produces no change.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingdifference
#[display("difference")]
Difference,
/// Similar to [`Difference`] but with lower contrast.
///
/// Produces softer inversion effects.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingexclusion
///
/// [`Difference`]: Self::Difference
#[display("exclusion")]
Exclusion,
/// Uses the hue of the source color and the saturation and luminosity of
/// the backdrop color.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendinghue
#[display("hue")]
Hue,
/// Uses the saturation of the source color and the hue and luminosity of
/// the backdrop color.
///
/// Painting over a fully desaturated backdrop produces no change.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingsaturation
#[display("saturation")]
Saturation,
/// Uses the hue and saturation of the source color and the luminosity of
/// the backdrop color.
///
/// Useful for coloring monochrome images while preserving shading.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingcolor
#[display("color")]
Color,
/// Uses the luminosity of the source color and the hue and saturation of
/// the backdrop color.
///
/// Inverse of the [`Color`] blend mode.
///
/// # Reference
///
/// https://drafts.csswg.org/compositing-2/#blendingluminosity
///
/// [`Color`]: Self::Color
#[display("luminosity")]
Luminosity,
}
impl IsDefault for BlendMode {}