summaryrefslogtreecommitdiff
path: root/src/web/zstbi.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-01 22:44:19 -0300
committerGabriel Schneider <[email protected]>2026-08-10 09:17:07 -0300
commitd59397d4146ffa23adbbe6dc99c64ebb22a93b2d (patch)
treea06984bf172a6c894c1586d58aad02ec302b6c2d /src/web/zstbi.zig
parentcbcdf01764e2e144a821643c3a8e9a5ad39eda2e (diff)
downloadpardes-d59397d4146ffa23adbbe6dc99c64ebb22a93b2d.tar.gz
pardes-d59397d4146ffa23adbbe6dc99c64ebb22a93b2d.zip
add vanilla DOM web backend
Diffstat (limited to 'src/web/zstbi.zig')
-rw-r--r--src/web/zstbi.zig30
1 files changed, 30 insertions, 0 deletions
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 {}
+};