/* tslint:disable */ /* eslint-disable */ /** * Scan grayscale image data for barcodes and QR codes. * * `data` must be an array of 8-bit grayscale pixel values, * row-major, with dimensions `width` x `height`. * * Returns an array of `DecodeResult` objects. */ export function scanGrayscale(data: Uint8Array, width: number, height: number, options?: ScanOptions | null): DecodeResult[]; /** * Scan an encoded image (PNG, JPEG, BMP, WebP) for barcodes and QR codes. * * `bytes` should contain the raw bytes of an image file in one of the * supported formats: PNG, JPEG, BMP, or WebP. * * The image will be automatically decoded and converted to grayscale * before scanning. * * Returns an array of `DecodeResult` objects. */ export function scanImageBytes(bytes: Uint8Array, options?: ScanOptions | null): DecodeResult[]; /** * Axis-aligned bounding rectangle of a decoded symbol in image * coordinates. `width` and `height` are reported as `max - min` of the * recorded points (i.e. the horizontal and vertical extent between the * outermost points), not as a pixel count. */ export class Bounds { private constructor(); free(): void; [Symbol.dispose](): void; readonly x: number; readonly y: number; readonly width: number; readonly height: number; } /** * A decoded barcode/QR code result. */ export class DecodeResult { private constructor(); free(): void; [Symbol.dispose](): void; /** * The barcode format name (e.g. "QR-Code", "EAN-13"). */ readonly symbolType: string; /** * Raw decoded bytes. * * For 2D codes (QR, SQ), these are the original bytes as encoded * in the barcode, before any text encoding or base64 conversion. */ readonly data: Uint8Array; /** * Decoded data as text, or null if not decodable as text. * * For 2D codes, the text is produced by detecting the encoding (UTF-8, * Shift-JIS, Windows-1252, etc.) and converting to a UTF-8 string. * For linear barcodes, the data is always ASCII text. */ readonly text: string | undefined; /** * The axis-aligned bounding rectangle of this symbol's recorded * points, or `null` if no points were recorded. */ readonly bounds: Bounds | undefined; /** * The recorded position points of this symbol in image coordinates. * * For QR codes, this is the four corner points of the QR's bounding * rectangle (in implementation-defined order). For linear barcodes, * this is one or more touchpoints accumulated as the symbol was * scanned. Empty if no points were recorded. */ readonly points: Point[]; } /** * A 2D pixel coordinate in image space. */ export class Point { private constructor(); free(): void; [Symbol.dispose](): void; readonly x: number; readonly y: number; } /** * Options for barcode scanning. * * All fields are optional and default to sensible values when omitted. * * ```js * // Use defaults (every supported symbology, retry enabled): * const results = scanGrayscale(data, width, height); * * // Disable automatic retry of small QR codes: * const results = scanGrayscale(data, width, height, { retryUndecodedRegions: false }); * * // Restrict to QR codes only: * const results = scanGrayscale(data, width, height, { symbologies: ["QR-Code"] }); * ``` */ export class ScanOptions { free(): void; [Symbol.dispose](): void; /** * Create a new options object with defaults. */ constructor(); /** * Restrict scanning to the listed symbologies. When omitted, every * supported symbology is enabled. * * Names match the `symbolType` field on decode results: `"QR-Code"`, * `"SQ-Code"`, `"EAN-13"`, `"EAN-8"`, `"EAN-2"`, `"EAN-5"`, * `"UPC-A"`, `"UPC-E"`, `"ISBN-10"`, `"ISBN-13"`, `"I2/5"`, * `"DataBar"`, `"DataBar-Exp"`, `"Codabar"`, `"CODE-39"`, * `"CODE-93"`, `"CODE-128"`. */ set symbologies(value: string[]); /** * Whether to automatically retry undecoded QR finder regions by * cropping and upscaling them. Default: `true`. */ set retryUndecodedRegions(value: boolean); }