Files
sx/examples/1603-platform-stb-image.sx
agra 58af806b7a library: vendors/stb_image + vendors/stb_truetype — stb ships with sx
The stb headers move from the repo-root vendors/ (resolvable only
with CWD = sx repo) into library/vendors/ following the sqlite
convention — bindings module + c/ sources + provenance README — so
'#import "vendors/stb_image/stb_image.sx"' (image v2.30 + image_write
v1.16) and '#import "vendors/stb_truetype/stb_truetype.sx"' (v1.26)
work from any consumer via the stdlib search paths. modules/ffi/stb.sx
dissolves into the stb_image vendor; modules/ffi/stb_truetype.sx keeps
its non-stb text-shaping companions and re-imports the vendored unit.
examples/1625 pins a deterministic in-memory BMP decode; examples/1626
pins font init + metric invariants against the system Helvetica.
2026-06-12 17:50:21 +03:00

17 lines
389 B
Plaintext

#import "modules/std.sx";
stb :: #import "vendors/stb_image/stb_image.sx";
main :: () -> i32 {
w: i32 = 0;
h: i32 = 0;
ch: i32 = 0;
img := stb.stbi_load("test.png", @w, @h, @ch, 4);
if xx img != 0 {
print("loaded {}x{} ({} channels)\n", w, h, ch);
stb.stbi_image_free(xx img);
} else {
print("no image (expected in test)\n");
}
0
}