summaryrefslogtreecommitdiff
path: root/src/web/zstbi.zig
blob: 76b144f7ad170975f06dd890c3190ccf3a8ad942 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 {}
};