On-disk discriminants are byte-stable once shipped. Naming and byte-order
match mirui::ColorFormat so reader output is zero-copy on the mirui side.
Discriminants are partitioned by family: byte >> 4 identifies the family
(1 = indexed, 2 = alpha-only, 3 = luma, 4 = RGB565, 5 = RGB888, 6 = 32-bit),
leaving the rest of each 16-byte run open for same-family extensions.
Single-chunk file with an arbitrary chunk_type and a raw payload.
FONT / VECTOR / custom critical chunks all wrap their format-specific
header inside payload. The primary header fields (color_format,
width, height, stride) are zeroed because they don’t apply.
Multi-chunk file: writes chunks (each (chunk_type, flags, payload)) into one CHUNK-layout buffer, table then payloads. The
reader resolves them via ChunkFile::chunk_payload /
ChunkFile::chunk_payloads. Primary header fields stay zeroed —
a multi-chunk file (e.g. several FONT representations) has no single
primary. encode_chunk_generic is the one-chunk special case.