1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
fn pixel_format_code(comptime a: u8, comptime b: u8, comptime c: u8, comptime d: u8) u32 {
return @as(u32, @intCast(a)) |
(@as(u32, @intCast(b)) << 8) |
(@as(u32, @intCast(c)) << 16) |
(@as(u32, @intCast(d)) << 24);
}
pub const Pixel = packed struct(u32) {
blue: u8,
green: u8,
red: u8,
_padding: u8 = 0x0,
pub const Format = enum(u32) {
xrgb8888 = pixel_format_code('X', 'R', '2', '4'),
};
};
|