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
|
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Config
{
pub source_factor: Factor,
pub destination_factor: Factor,
pub equation: Equation,
}
impl Default for Config
{
fn default() -> Self
{
Self {
source_factor: Factor::One,
destination_factor: Factor::Zero,
equation: Equation::default(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum Factor
{
/// Factor will be the RGBA color `(0,0,0,0)`
Zero,
/// Factor will be the RGBA color `(1,1,1,1)`
One,
/// Factor will be the source color
SrcColor,
/// Factor will be the RGBA color `(1,1,1,1) - source color`
OneMinusSrcColor,
/// Factor will be the destination color
DstColor,
/// Factor will be the RGBA color `(1,1,1,1) - destination color`
OneMinusDstColor,
/// Factor will be the alpha component of the source color.
SrcAlpha,
/// Factor will be the RGBA color `(1,1,1,1) - source color alpha`
OneMinusSrcAlpha,
/// Factor will be the alpha component of the destination color.
DstAlpha,
/// Factor will be the RGBA color `(1,1,1,1) - destination color alpha`
OneMinusDstAlpha,
/// Factor will be the constant color
ConstantColor,
/// Factor will be the RGBA color `(1,1,1,1) - constant color`
OneMinusConstantColor,
/// Factor will be the alpha component of the constant color.
ConstantAlpha,
/// Factor will be the RGBA color `(1,1,1,1) - constant color alpha`
OneMinusConstantAlpha,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum Equation
{
/// The destination color and source color is added to each other in the blend
/// function
#[default]
Add,
/// The destination color is subtracted from the source color in the blend function
Subtract,
/// The source color is subtracted from the destination color in the blend function
ReverseSubtract,
/// The blend function will take the component-wise minimum of the destination color
/// and the source color
Min,
/// The blend function will take the component-wise maximum of the destination color
/// and the source color
Max,
}
|