/** * Device - PDF rendering device abstraction * * This module provides 100% API compatibility with MicroPDF's device operations. * Devices receive drawing commands and render them to various outputs. */ import { Colorspace } from './colorspace.js'; import { Rect, Matrix, type RectLike, type MatrixLike } from './geometry.js'; import { Path, StrokeState } from './path.js'; import { Pixmap } from './pixmap.js'; /** * Device types */ export declare enum DeviceType { Unknown = 0, Draw = 1, BBox = 2, Trace = 3, List = 4, Custom = 5 } /** * Device hints for optimization */ export declare enum DeviceHint { NoCache = 1, NoPureColor = 2 } /** * Blend modes for transparency */ export declare enum BlendMode { Normal = 0, Multiply = 1, Screen = 2, Overlay = 3, Darken = 4, Lighten = 5, ColorDodge = 6, ColorBurn = 7, HardLight = 8, SoftLight = 9, Difference = 10, Exclusion = 11 } /** * Base class for rendering devices */ export declare class Device { private _refCount; private _closed; private _type; private _hints; constructor(type?: DeviceType | null); keep(): this; drop(): void; /** * Close the device (finalize rendering) */ close(): void; protected onClose(): void; get isClosed(): boolean; getType(): DeviceType; isValid(): boolean; enableHints(hints: DeviceHint): void; disableHints(hints: DeviceHint): void; hasHint(hint: DeviceHint): boolean; beginTile(area: RectLike, view: RectLike, xStep: number, yStep: number, ctm: MatrixLike, _id?: number): void; protected onBeginTile(_area: Rect, _view: Rect, _xStep: number, _yStep: number, _ctm: Matrix): void; endTile(): void; protected onEndTile(): void; fillPath(path: Path, evenOdd: boolean, ctm: MatrixLike, colorspace: Colorspace, alpha: number, _colorParams?: unknown, _cookie?: unknown): void; protected onFillPath(_path: Path, _evenOdd: boolean, _ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; strokePath(path: Path, stroke: StrokeState, ctm: MatrixLike, colorspace: Colorspace, alpha: number, _colorParams?: unknown, _cookie?: unknown): void; protected onStrokePath(_path: Path, _stroke: StrokeState, _ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; clipPath(path: Path, evenOdd: boolean, ctm: MatrixLike, _scissor?: unknown): void; protected onClipPath(_path: Path, _evenOdd: boolean, _ctm: Matrix): void; clipStrokePath(path: Path, stroke: StrokeState, ctm: MatrixLike, _scissor?: unknown): void; protected onClipStrokePath(_path: Path, _stroke: StrokeState, _ctm: Matrix): void; fillText(text: string, ctm: MatrixLike, colorspace: Colorspace, alpha: number, _colorParams?: unknown, _cookie?: unknown): void; protected onFillText(_text: string, _ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; strokeText(text: string, stroke: StrokeState, ctm: MatrixLike, colorspace: Colorspace, alpha: number, _colorParams?: unknown, _cookie?: unknown): void; protected onStrokeText(_text: string, _stroke: StrokeState, _ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; clipText(text: string, ctm: MatrixLike, _scissor?: unknown): void; protected onClipText(_text: string, _ctm: Matrix): void; clipStrokeText(text: string, stroke: StrokeState, ctm: MatrixLike, _scissor?: unknown): void; protected onClipStrokeText(_text: string, _stroke: StrokeState, _ctm: Matrix): void; ignoreText(text: string, ctm: MatrixLike): void; protected onIgnoreText(_text: string, _ctm: Matrix): void; fillImage(image: Pixmap, ctm: MatrixLike, alpha: number, _colorParams?: unknown): void; protected onFillImage(_image: Pixmap, _ctm: Matrix, _alpha: number): void; fillImageMask(image: Pixmap, ctm: MatrixLike, colorspace: Colorspace, alpha: number, _colorParams?: unknown, _cookie?: unknown): void; protected onFillImageMask(_image: Pixmap, _ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; clipImageMask(image: Pixmap, ctm: MatrixLike, _scissor?: unknown): void; protected onClipImageMask(_image: Pixmap, _ctm: Matrix): void; popClip(): void; protected onPopClip(): void; beginMask(area: RectLike, luminosity: boolean, colorspace: Colorspace, color: number[], _colorParams?: unknown): void; protected onBeginMask(_area: Rect, _luminosity: boolean, _colorspace: Colorspace, _color: number[]): void; endMask(): void; protected onEndMask(): void; beginGroup(area: RectLike, colorspace: Colorspace, isolated: boolean, knockout: boolean, blendMode: BlendMode, alpha: number): void; protected onBeginGroup(_area: Rect, _colorspace: Colorspace, _isolated: boolean, _knockout: boolean, _blendMode: BlendMode, _alpha: number): void; endGroup(): void; protected onEndGroup(): void; } /** * Draw device - renders to a pixmap */ export declare class DrawDevice extends Device { private _pixmap; constructor(pixmap: Pixmap); static create(pixmap: Pixmap): DrawDevice; get pixmap(): Pixmap; protected onFillPath(_path: Path, _evenOdd: boolean, _ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; protected onStrokePath(_path: Path, _stroke: StrokeState, _ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; } /** * BBox device - calculates bounding boxes */ export declare class BBoxDevice extends Device { private _bbox; constructor(); static create(): BBoxDevice; get bbox(): Rect; protected onFillPath(path: Path, _evenOdd: boolean, ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; protected onStrokePath(path: Path, _stroke: StrokeState, ctm: Matrix, _colorspace: Colorspace, _alpha: number): void; } /** * Trace device - logs drawing operations */ export declare class TraceDevice extends Device { private _log; constructor(); static create(): TraceDevice; get log(): string[]; protected onFillPath(_path: Path, evenOdd: boolean, _ctm: Matrix, colorspace: Colorspace, alpha: number): void; protected onStrokePath(_path: Path, stroke: StrokeState, _ctm: Matrix, colorspace: Colorspace, alpha: number): void; protected onFillText(text: string, _ctm: Matrix, colorspace: Colorspace, alpha: number): void; protected onFillImage(image: Pixmap, _ctm: Matrix, alpha: number): void; protected onBeginGroup(area: Rect, _colorspace: Colorspace, isolated: boolean, knockout: boolean, blendMode: BlendMode, alpha: number): void; protected onEndGroup(): void; } /** * Recorded device command */ interface DeviceCommand { type: string; path?: Path; stroke?: StrokeState; evenOdd?: boolean; ctm?: Matrix; colorspace?: Colorspace; color?: number[]; alpha?: number; } /** * List device - records display list */ export declare class ListDevice extends Device { private _commands; constructor(); static create(): ListDevice; get commands(): DeviceCommand[]; protected onFillPath(path: Path, evenOdd: boolean, ctm: Matrix, colorspace: Colorspace, alpha: number): void; protected onStrokePath(path: Path, stroke: StrokeState, ctm: Matrix, colorspace: Colorspace, alpha: number): void; } export {}; //# sourceMappingURL=device.d.ts.map