diff --git a/ts/src/index.ts b/ts/src/index.ts index e9327d5..37ae207 100644 --- a/ts/src/index.ts +++ b/ts/src/index.ts @@ -10,6 +10,50 @@ // this file will aggregate them here so callers never need to update imports. // ============================================================================= + +// ============================================================================= +// 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 { // Driver (primary browser-facing API) MonoDisplayDriver, diff --git a/ts/src/library.ts b/ts/src/library.ts deleted file mode 100644 index bef6dc6..0000000 --- a/ts/src/library.ts +++ /dev/null @@ -1,47 +0,0 @@ -// ============================================================================= -// 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 * from "./driver"; -export * from "./parser"; -export * from "./file"; -export * from "./helper";