diff options
Diffstat (limited to 'src/wl/shm/format.zig')
| -rw-r--r-- | src/wl/shm/format.zig | 19 |
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"), + }; + } }; |