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
|
//! Blending modes for drawing (for render states)
// Enums
pub const Factor = enum(c_int) {
zero,
one,
srcColor,
oneMinusSrcColor,
dstColor,
oneMinusDstColor,
srcAlpha,
oneMinusSrcAlpha,
dstAlpha,
oneMinusDstAlpha
};
pub const Equation = enum(c_int) {
add,
subtract,
reverseSubtract
};
const BlendMode = @This();
// Preset blend modes
pub const BlendAlpha = BlendMode{
.color_src_factor = .srcAlpha,
.color_dst_factor = .oneMinusSrcAlpha,
.color_equation = .add,
.alpha_src_factor = .one,
.alpha_dst_factor = .oneMinusSrcAlpha,
.alpha_equation = .add
};
pub const BlendAdd = BlendMode{
.color_src_factor = .srcAlpha,
.color_dst_factor = .one,
.color_equation = .add,
.alpha_src_factor = .one,
.alpha_dst_factor = .one,
.alpha_equation = .add
};
pub const BlendMultiply = BlendMode{
.color_src_factor = .dstColor,
.color_dst_factor = .zero,
.color_equation = .add,
.alpha_src_factor = .dstColor,
.alpha_dst_factor = .zero,
.alpha_equation = .add
};
pub const BlendMin = BlendMode{
.color_src_factor = .one,
.color_dst_factor = .one,
.color_equation = .min,
.alpha_src_factor = .one,
.alpha_dst_factor = .one,
.alpha_equation = .min
};
pub const BlendMax = BlendMode{
.color_src_factor = .one,
.color_dst_factor = .one,
.color_equation = .max,
.alpha_src_factor = .one,
.alpha_dst_factor = .one,
.alpha_equation = .max
};
pub const BlendNone = BlendMode{
.color_src_factor = .one,
.color_dst_factor = .zero,
.color_equation = .add,
.alpha_src_factor = .one,
.alpha_dst_factor = .zero,
.alpha_equation = .add
};
const sfBlendMode = @import("../sfml_import.zig").c.sfBlendMode;
/// Bitcasts this blendmode to the csfml struct
/// For inner workings
pub fn _toCSFML(self: BlendMode) sfBlendMode {
return @bitCast(sfBlendMode, self);
}
color_src_factor: Factor,
color_dst_factor: Factor,
color_equation: Equation,
alpha_src_factor: Factor,
alpha_dst_factor: Factor,
alpha_equation: Equation
|