a modern tui library written in zig

update zigimg dependency and adapt to new API

Update the zigimg dependency to a newer version that changes the
fromFilePath API to require a read buffer parameter. Add 1MB read
buffers to both the image example and the Vaxis.loadImage function
to accommodate this new requirement.

This ensures the image example compiles successfully and the library
can continue to load images from file paths using the updated zigimg
interface.

Amp-Thread-ID: https://ampcode.com/threads/T-04d58023-ce84-479f-8974-6c8fad9ce9e5
Co-authored-by: Amp <amp@ampcode.com>

rockorager.dev ead63d10 6ab4aaff

verified
Changed files
+6 -4
examples
src
+2 -2
build.zig.zon
··· 6 6 .dependencies = .{ 7 7 .zigimg = .{ 8 8 // TODO .url = "git+https://github.com/zigimg/zigimg", 9 - .url = "https://github.com/ivanstepanovftw/zigimg/archive/aa4c31db872612c39edbb79f753b3cd9a79fe726.tar.gz", 10 - .hash = "zigimg-0.1.0-8_eo2mWmEgBoqdr0sH9O5GTqDHthkoEPM5_tipcBRreL", 9 + .url = "https://github.com/ivanstepanovftw/zigimg/archive/d7b7ab0ba0899643831ef042bd73289510b39906.tar.gz", 10 + .hash = "zigimg-0.1.0-8_eo2vHnEwCIVW34Q14Ec-xUlzIoVg86-7FU2ypPtxms", 11 11 }, 12 12 .zg = .{ 13 13 // Upstream PR: https://codeberg.org/atman/zg/pulls/90/
+2 -1
examples/image.zig
··· 34 34 try vx.enterAltScreen(tty.anyWriter()); 35 35 try vx.queryTerminal(tty.anyWriter(), 1 * std.time.ns_per_s); 36 36 37 - var img1 = try vaxis.zigimg.Image.fromFilePath(alloc, "examples/zig.png"); 37 + var read_buffer: [1024 * 1024]u8 = undefined; // 1MB buffer 38 + var img1 = try vaxis.zigimg.Image.fromFilePath(alloc, "examples/zig.png", &read_buffer); 38 39 defer img1.deinit(); 39 40 40 41 const imgs = [_]vaxis.Image{
+2 -1
src/Vaxis.zig
··· 1018 1018 ) !Image { 1019 1019 if (!self.caps.kitty_graphics) return error.NoGraphicsCapability; 1020 1020 1021 + var read_buffer: [1024 * 1024]u8 = undefined; // 1MB buffer 1021 1022 var img = switch (src) { 1022 - .path => |path| try zigimg.Image.fromFilePath(alloc, path), 1023 + .path => |path| try zigimg.Image.fromFilePath(alloc, path, &read_buffer), 1023 1024 .mem => |bytes| try zigimg.Image.fromMemory(alloc, bytes), 1024 1025 }; 1025 1026 defer img.deinit();