From f0f2124949056e3008416dcd089766a2ef69a08b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 27 Aug 2025 20:21:34 +0200 Subject: add wl.buffer and wl.surface --- src/wl/shm/format.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/wl/shm/format.zig') 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"), + }; + } }; -- cgit v1.2.3-70-g09d2