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
|
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum BlendMode {
Normal,
Darken,
Multiply,
ColorBurn,
Lighten,
Screen,
PlusLighter,
ColorDodge,
Overlay,
SoftLight,
HardLight,
Difference,
Exclusion,
Hue,
Saturation,
Color,
Luminosity,
}
impl BlendMode {
pub fn shader_code(self) -> u32 {
match self {
Self::Normal => 0,
Self::Darken => 1,
Self::Multiply => 2,
Self::ColorBurn => 3,
Self::Lighten => 4,
Self::Screen => 5,
Self::PlusLighter => 6,
Self::ColorDodge => 7,
Self::Overlay => 8,
Self::SoftLight => 9,
Self::HardLight => 10,
Self::Difference => 11,
Self::Exclusion => 12,
Self::Hue => 13,
Self::Saturation => 14,
Self::Color => 15,
Self::Luminosity => 16,
}
}
}
|