This repository is a freestanding-friendly C++ rewrite/fork of selected stb single-header libraries.
Main goals:
- Freestanding-first builds (optional CRT-free integration).
- Cleaner C++ structure instead of macro-heavy C internals.
- Header-first workflow with deterministic, testable behavior.
- Byte-diff tests against original stb where practical.
stb_truetype/- Implemented based onstb_truetype.h.stb_truetype_stream/- Stream-oriented atlas pipeline (SDF, MSDF, MTSDF), no allocations inside the library path.stb_image_write/- Partially implemented (bmp, tga only).stb_image/- Implemented.stb_image_resize2/- NOT implemented.3rd_party/stb/- upstream stb git submodule used for reference/byte-diff tests.test/- Catch2 tests and small Windows examples.
- Supported through the C++ API: PNG, BMP, GIF, PSD, PIC, JPEG, PNM, HDR, TGA.
- Two-pass usage is available:
- Pass 1:
Plan*computes dimensions/channels/output byte size. - Pass 2:
Decode*writes into caller-provided memory.
- Pass 1:
- Batch planning helpers are available to compute max/sum memory across many images.
- Byte-diff tests are present against original
stb_image.h.
Example configure:
cmake -S . -B build -G "Visual Studio 17 2022" -A Win32Example build:
cmake --build build --config ReleaseMiniNoConsoleCommon MSVC configs:
DebugReleaseReleaseMiniReleaseNoConsoleReleaseMiniNoConsole
As with original stb-family libraries, do not treat these parsers as hardened against hostile input without additional sandboxing and validation.
MIT (see LICENSE).
Original stb code is by Sean Barrett and contributors.