// ============================================================================= // index.ts — public entry point // // Re-exports everything from library.ts so browser bundlers and module users // get a single clean import path: // // import { MonoDisplayDriver, loadBinFile } from "./index.ts"; // // ============================================================================= // ============================================================================= // MonoDisplay Library - binary format parser + canvas renderer // // Spec: Mono Display File Format Specification (see adjacent .rst) // // File layout (little-endian throughout): // // [FILE HEADER - 12 bytes] // 4 bytes magic 0xAF 0x7E 0x2B 0x63 // 4 bytes version uint32 LE; 0=illegal, 1=current // 2 bytes numSections uint16 LE // 2 bytes reserved must be 0 // // [SECTION - repeated numSections times] // 1 byte sectionType uint8 // 3 bytes sectionSize uint24 LE, INCLUDES these 4 header bytes // sectionSize-4 bytes of section-specific data // to 32-bit boundary (included in sectionSize) // // SECTION TYPES: // 1 ElementsAlways - flags(u16) numElements(u16) elements... // 2 ElementsTimespan - flags(u16) numElements(u16) start(u64) end(u64) elements... // 32 CustomFont - actualSize(u24) reserved(u8) fontData... // // ELEMENT TYPES (uint16, all fields uint16 unless noted, 32-bit aligned): // 1 Image2D - type xOff yOff w h reserved [packed 1bpp pixels] // 2 Animation - type xOff yOff w h nFrames updateInterval reserved [N×frame] // 3 HorizontalScroll - type xOff yOff w h contentW flags(u8) speed(u8) reserved [pixels] // 4 VerticalScroll - type xOff yOff w h contentH flags(u8) speed(u8) reserved [pixels] // 5 Line - type xO yO xT yT lineStyle(u8) flags(u8) // 16 ClippedText - type xOff yOff w h fontIdx textLen [utf8 text + pad] // 17 HScrollText - type xOff yOff w h flags(u8) speed(u8) fontIdx textLen [utf8 + pad] // // PIXEL DATA: packed 1bpp, size = ceil(w*h/8). // px_i = y*w + x; byte = data[px_i>>3]; bit = (byte >> (px_i&7)) & 1 // Frames aligned to octet boundary. Excess bits SHOULD be 0, MUST be ignored. // // ALIGNMENT: all sections and elements aligned to 32-bit (4-byte) boundaries. // // FONT INDEX: 0..32767 = built-in; 0x8000+ = custom font in file (0x8000=first). // ============================================================================= export * from "./types"; export { BinaryReader, packPixels, unpackPixels, packedSize, pad32 } from "./helper"; export { MonoDisplayParser, MONOFORMAT_MAGIC_HEADER } from "./parser"; export { MonoDisplayRenderer } from "./renderer"; export { type MonoDisplayDriverOptions, MonoDisplayDriver } from "./driver"; export { MonoDisplayFile, loadBinFile, buildBinBuffer } from "./file";