From d59397d4146ffa23adbbe6dc99c64ebb22a93b2d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 1 Aug 2026 22:44:19 -0300 Subject: add vanilla DOM web backend --- src/web/zstbi.zig | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/web/zstbi.zig (limited to 'src/web/zstbi.zig') diff --git a/src/web/zstbi.zig b/src/web/zstbi.zig new file mode 100644 index 00000000..76b144f7 --- /dev/null +++ b/src/web/zstbi.zig @@ -0,0 +1,30 @@ +//! Freestanding image-decoder shim. +//! +//! The browser core has no libc or C allocator ABI. Image bytes still survive +//! dumps, but decoding belongs in the JavaScript IO layer rather than pulling +//! stb_image and an Emscripten runtime into the state machine. + +const std = @import("std"); + +pub fn init(_: std.Io, _: std.mem.Allocator) void {} +pub fn deinit() void {} + +pub const Image = struct { + data: []u8 = &.{}, + width: u32 = 0, + height: u32 = 0, + num_components: u32 = 4, + bytes_per_component: u32 = 1, + bytes_per_row: u32 = 0, + is_hdr: bool = false, + + pub fn loadFromMemory(_: []const u8, _: u32) !Image { + return error.ImageDecodeUnavailable; + } + + pub fn resize(_: *const Image, _: u32, _: u32) Image { + return .{}; + } + + pub fn deinit(_: *Image) void {} +}; -- cgit v1.3