aboutsummaryrefslogtreecommitdiff
path: root/src/wl/shm/format.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-08-27 20:21:34 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2025-08-27 20:21:34 +0200
commitf0f2124949056e3008416dcd089766a2ef69a08b (patch)
tree7e8f674fda0c5af7f30671e9dd088f7ec7d35e5e /src/wl/shm/format.zig
parent8a7392dea729d3ed49a8bf8eee25906c4fd616ac (diff)
add wl.buffer and wl.surface
Diffstat (limited to 'src/wl/shm/format.zig')
-rw-r--r--src/wl/shm/format.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/wl/shm/format.zig b/src/wl/shm/format.zig
index e2766ab..6c2a30f 100644
--- a/src/wl/shm/format.zig
+++ b/src/wl/shm/format.zig
@@ -122,4 +122,23 @@ pub const Format = enum(u32) {
xvuy8888 = 0x59555658,
vyuy = 0x59555956,
uyvy = 0x59565955,
+
+ pub fn bytes_per_pixel(self: @This()) usize {
+ return switch (self) {
+ .argb8888 => 4,
+ else => @panic("unimplemented"),
+ };
+ }
+
+ pub fn Pixel(self: @This()) type {
+ return switch (self) {
+ .argb8888 => packed struct {
+ alpha: u8,
+ red: u8,
+ green: u8,
+ blue: u8
+ },
+ else => @panic("unimplemented"),
+ };
+ }
};