/** * DisplayList - Cached rendering commands * * This module provides 100% API compatibility with MicroPDF's display list operations. * Display lists cache drawing commands for efficient re-rendering. */ import { Colorspace } from './colorspace.js'; import { Device } from './device.js'; import { Rect, Matrix, type RectLike, type MatrixLike } from './geometry.js'; import { Image } from './image.js'; import { Path, StrokeState } from './path.js'; import { Text } from './text.js'; /** * Display list command types */ declare enum CommandType { FillPath = 0, StrokePath = 1, ClipPath = 2, ClipStrokePath = 3, FillText = 4, StrokeText = 5, ClipText = 6, ClipStrokeText = 7, IgnoreText = 8, FillShade = 9, FillImage = 10, FillImageMask = 11, ClipImageMask = 12, PopClip = 13, BeginMask = 14, EndMask = 15, BeginGroup = 16, EndGroup = 17, BeginTile = 18, EndTile = 19 } /** * Command data for display list operations * Using a flexible interface since commands can have various properties */ interface CommandData { path?: Path; evenOdd?: boolean; stroke?: StrokeState; text?: Text; image?: Image; ctm?: Matrix; colorspace?: Colorspace | null; color?: number[]; alpha?: number; area?: Rect; luminosity?: boolean; isolated?: boolean; knockout?: boolean; blendMode?: number; view?: Rect; scale?: number; id?: number; xStep?: number; yStep?: number; } /** * A single display list command */ interface DisplayCommand { type: CommandType; data: CommandData; } /** * A display list - a cached list of rendering commands */ export declare class DisplayList { private _commands; private _bounds; private _refCount; private _hasRun; constructor(bounds?: RectLike); /** * Create a new display list */ static create(bounds?: RectLike): DisplayList; keep(): this; drop(): void; /** * Clone this display list */ clone(): DisplayList; /** * Get the bounding box of all commands */ getBounds(ctm?: MatrixLike): Rect; /** * Get bounding box (alias for getBounds) */ bbox(ctm?: MatrixLike): Rect; /** * Update bounds to include a rect */ private updateBounds; /** * Add a command to the display list */ private addCommand; /** * Count number of commands */ countCommands(): number; /** * Check if display list is empty */ isEmpty(): boolean; /** * Clear all commands */ clear(): void; /** * Check if display list is valid */ isValid(): boolean; /** * Record a fill path command */ recordFillPath(path: Path, evenOdd: boolean, ctm: MatrixLike, colorspace: Colorspace, color: number[], alpha: number): void; /** * Record a stroke path command */ recordStrokePath(path: Path, stroke: StrokeState, ctm: MatrixLike, colorspace: Colorspace, color: number[], alpha: number): void; /** * Record a clip path command */ recordClipPath(path: Path, evenOdd: boolean, ctm: MatrixLike): void; /** * Record a clip stroke path command */ recordClipStrokePath(path: Path, stroke: StrokeState, ctm: MatrixLike): void; /** * Record a fill text command */ recordFillText(text: Text, ctm: MatrixLike, colorspace: Colorspace, color: number[], alpha: number): void; /** * Record a stroke text command */ recordStrokeText(text: Text, stroke: StrokeState, ctm: MatrixLike, colorspace: Colorspace, color: number[], alpha: number): void; /** * Record a clip text command */ recordClipText(text: Text, ctm: MatrixLike): void; /** * Record a clip stroke text command */ recordClipStrokeText(text: Text, stroke: StrokeState, ctm: MatrixLike): void; /** * Record an ignore text command */ recordIgnoreText(text: Text, ctm: MatrixLike): void; /** * Record a fill image command */ recordFillImage(image: Image, ctm: MatrixLike, alpha: number): void; /** * Record a fill image mask command */ recordFillImageMask(image: Image, ctm: MatrixLike, colorspace: Colorspace, color: number[], _alpha: number): void; /** * Record a clip image mask command */ recordClipImageMask(image: Image, ctm: MatrixLike): void; /** * Record a pop clip command */ recordPopClip(): void; /** * Record a begin mask command */ recordBeginMask(area: RectLike, luminosity: boolean, colorspace: Colorspace | null, color: number[]): void; /** * Record an end mask command */ recordEndMask(): void; /** * Record a begin group command */ recordBeginGroup(area: RectLike, colorspace: Colorspace | null, isolated: boolean, knockout: boolean, blendMode: number, alpha: number): void; /** * Record an end group command */ recordEndGroup(): void; /** * Record a begin tile command */ recordBeginTile(area: RectLike, view: RectLike, xStep: number, yStep: number, ctm: MatrixLike): void; /** * Record an end tile command */ recordEndTile(): void; /** * Run (replay) the display list to a device */ run(device: Device, ctm?: MatrixLike, _clip?: RectLike, _cookie?: unknown): void; /** * Get all commands */ getCommands(): DisplayCommand[]; } export {}; //# sourceMappingURL=display-list.d.ts.map