import { LibSANE, SANEParameters, SANEStatus } from "."; declare abstract class EventBaseClass> { private _firing; private _listeners; /** * Add event listener. */ on(type: K, listener: (...args: T[K]) => void): void; /** * Fire event. */ protected fire(type: K, ...args: T[K]): Promise | null; } /** * @private Events types for {@link ScanDataReader}. */ export interface ScanDataReaderEventMap extends Record { /** * Scanning stop event. */ start: [parameters: SANEParameters]; /** * Scanning start event. */ stop: [parameters: SANEParameters, error: Error | null]; /** * Raw image data event. */ data: [parameters: SANEParameters, data: Uint8Array]; } /** * Raw data reader that automatically handles SANE's read code flow. * * Use {@link ScanDataReader.on} to listen to events, available event types * are declared on {@link ScanDataReaderEventMap}. * * A device should already be open with sane_open(), the reader will call * sane_start() do the scanning and call sane_stop(). * * Other SANE functions cannot be used while scanning. * * Scan readers are single use. * * {@link https://sane-project.gitlab.io/standard/1.06/api.html#code-flow} */ export declare class ScanDataReader extends EventBaseClass { private _lib; private _used; private _killed; constructor(lib: LibSANE); private _readPromise; /** * Start scanning operation. */ start(): Promise<{ status: SANEStatus.UNSUPPORTED | SANEStatus.CANCELLED | SANEStatus.DEVICE_BUSY | SANEStatus.INVAL | SANEStatus.EOF | SANEStatus.JAMMED | SANEStatus.NO_DOCS | SANEStatus.COVER_OPEN | SANEStatus.IO_ERROR | SANEStatus.NO_MEM | SANEStatus.ACCESS_DENIED; parameters: null; promise: Promise; } | { status: SANEStatus.GOOD; parameters: SANEParameters; promise: Promise; }>; /** * Cancel scanning operation. */ cancel(): void; } /** * @private Events types for {@link ScanImageReader}. */ export interface ScanImageReaderEventMap extends ScanDataReaderEventMap { /** * Image line event, one or more full lines of RGBA data. */ line: [parameters: SANEParameters, data: Uint8ClampedArray, line: number]; /** * Full image event (end of scan), RGBA data. */ image: [parameters: SANEParameters, data: Uint8ClampedArray]; } /** * Image reader that automatically generates RGBA data while reading from * SANE's API using {@link ScanDataReader}. It supports the most common scan * modes and image formats. More formats can be added in the future. * * Use {@link ScanImageReader.on} to listen to events, available event types * are declared on {@link ScanImageReaderEventMap}. * * A device should already be open with sane_open(), the reader will call * sane_start() do the scanning and call sane_stop(). * * Other SANE functions cannot be used while scanning. * * Scan readers are single use. * * {@link https://sane-project.gitlab.io/standard/1.06/api.html#code-flow} */ export declare class ScanImageReader extends ScanDataReader { private _line; private _allData; private _remainder; constructor(lib: LibSANE); private _onStart; private _onData; private _onStop; } export {};