ph-color
Fixed-point no_std color math for embedded targets.
[!NOTE] Lifecycle: Active Distribution: Version
0.1.1on crates.io, with API documentation on docs.rs. Model conformance: N/A Physical evidence: N/A
This package applies baked coefficients and tables. It does not derive,
invert, adapt, or solve. Host derivation lives in ph-color-bake.
[]
= "0.1"
use ;
let black = new;
let white = new;
let midpoint = black.lerp;
assert!;
The crate currently exposes quantize / quantize_round / expand, Color
type-state, numeric Matrix3 / Gain apply, InterpLut, lerp, Gradient,
shipped sRGB EOTF/OETF InterpLut constants, feature oklab (linear-sRGB ↔
Oklab), and optional feature = "f32" (ColorF32 and *_f32). Oklab f32 is
out of scope. Host ph-color-bake derives tables. Frozen golden vectors in
tests/golden/ are replayed by host tests. Named-consumer host sketches are
in examples/. Numeric and type-state guarantees are in the
repository numeric policy.
Compatibility and limits
- MSRV: Rust 1.94.0, edition 2024.
- Default build:
no_std, no allocation, no unsafe code, nof64, and zero dependencies. - Optional features:
f32andoklab; Oklab has nof32entry points. - Fixed-point matrix and gain output uses one widening accumulation followed by round-half-away-from-zero and saturation. It never wraps.
- Matrices and gains accept linear colors; transfer LUTs cross linear/encoded state; encoded interpolation is limited to perceptual color spaces.
- Color processing stops at quantization. Zero-parameter round-to-nearest is provided; firmware owns custom thresholds, masks, positional or frame state, dithering, residual accumulation, output packing, and hardware I/O.
License
MIT