/** * A QR code as PNG bytes, for the creator who cannot scan the terminal. * * `qr-terminal.ts` covers the case where a person is looking at the output. That is not the common * case for this CLI: the pro lane is driven by an agent, so stdout is a pipe, and the human who * would do the scanning is on the far side of it. A file crosses that boundary where escape * sequences cannot — an agent can hand an image to its creator, and cannot hand them a repainted * terminal. * * Greyscale, one byte per pixel. A QR carries one bit per module, so colour would be three bytes of * nothing; and at this size the whole image deflates to a few hundred bytes either way. The * encoder is hand-rolled for the same reason `qr.ts` is — `@bitmagic/cli` ships four runtime * dependencies on purpose, and node's own `zlib` (already used in `publish/` and `assets/`) does * the only part that is genuinely hard. * * Two other hand-rolled PNG encoders exist in this repo — `world-forger-internal`'s vehicle atlas * and `game-play-agent`'s solid-colour tile — and neither is reachable from here: the first is in a * `private: true` package the CLI does not depend on, the second is server code. Within the CLI the * chunk/CRC/signature primitives are exported from here and shared with the trailer's transparent * frame filler (trailer/video-chain.ts); `ios/icon.ts` predates that and keeps its own. */ import { Buffer } from 'buffer'; export declare const PNG_SIGNATURE: Buffer; /** One PNG chunk: length, type, data, and the CRC over type+data (never over the length). */ export declare function pngChunk(type: string, data: Buffer): Buffer; export interface QrPngOptions { /** Pixels per module. Defaults to `MODULE_PIXELS`. */ scale?: number; /** Quiet zone in modules. Defaults to `QUIET_MODULES`. */ quietZone?: number; } /** The pixel width (and height) `encodeQrPng` produces for a matrix of this size. */ export declare function qrPngDimension(matrix: boolean[][], options?: QrPngOptions): number; /** * Encode a module matrix as a greyscale PNG: dark modules black, everything else white. * * White is 0xff and dark is 0x00, never inverted — a scanner wants dark on light, and unlike the * terminal there is no theme here to fight about it. */ export declare function encodeQrPng(matrix: boolean[][], options?: QrPngOptions): Buffer;