export type TextBaseline = 'top' | 'middle' | 'bottom' | 'alphabetic' | 'hanging' | 'ideographic'; export type TextAlign = 'left' | 'right' | 'center' | 'start' | 'end'; interface BaseCommand { zIndex: number; order: number; } interface FillRectCommand extends BaseCommand { type: 'fillRect'; x: number; y: number; width: number; height: number; fillStyle: string; } interface StrokeRectCommand extends BaseCommand { type: 'strokeRect'; x: number; y: number; width: number; height: number; strokeStyle: string; lineWidth: number; } interface FillTextCommand extends BaseCommand { type: 'fillText'; text: string; x: number; y: number; font: string; fillStyle: string; textBaseline: TextBaseline; textAlign?: TextAlign; } interface FillTextClippedCommand extends BaseCommand { type: 'fillTextClipped'; text: string; x: number; y: number; font: string; fillStyle: string; textBaseline: TextBaseline; textAlign?: TextAlign; clipX: number; clipY: number; clipWidth: number; clipHeight: number; } interface DrawImageCommand extends BaseCommand { type: 'drawImage'; image: CanvasImageSource; x: number; y: number; width: number; height: number; } interface RoundedRectCommand extends BaseCommand { type: 'roundedRect'; x: number; y: number; width: number; height: number; radius: number; fillStyle?: string; strokeStyle?: string; lineWidth?: number; } export interface GradientStop { offset: number; color: string; } interface LinearGradientRectCommand extends BaseCommand { type: 'linearGradientRect'; x: number; y: number; width: number; height: number; radius: number; gradientStops: GradientStop[]; angle: number; } export interface AnimationContext { frameTime?: number; requestAnimationFrame?: () => void; } interface CustomCommand extends BaseCommand { type: 'custom'; fn: (ctx: CanvasRenderingContext2D) => void; } export type DrawCommand = FillRectCommand | StrokeRectCommand | FillTextCommand | FillTextClippedCommand | DrawImageCommand | RoundedRectCommand | CustomCommand | LinearGradientRectCommand; export declare class DrawBatcher { private commands; private orderCounter; private currentZIndex; private animationContext?; setAnimationContext(context?: AnimationContext): this; getAnimationContext(): AnimationContext | undefined; setZIndex(zIndex: number): this; getZIndex(): number; pushZIndex(delta?: number): this; popZIndex(delta?: number): this; fillRect(x: number, y: number, width: number, height: number, fillStyle: string): this; strokeRect(x: number, y: number, width: number, height: number, strokeStyle: string, lineWidth?: number): this; fillText(text: string, x: number, y: number, font: string, fillStyle: string, textBaseline?: TextBaseline, textAlign?: TextAlign): this; fillTextClipped(text: string, x: number, y: number, font: string, fillStyle: string, clipRect: { x: number; y: number; width: number; height: number; }, textBaseline?: TextBaseline, textAlign?: TextAlign): this; drawImage(image: CanvasImageSource, x: number, y: number, width: number, height: number): this; roundedRect(x: number, y: number, width: number, height: number, radius: number, options?: { fillStyle?: string; strokeStyle?: string; lineWidth?: number; }): this; linearGradientRect(x: number, y: number, width: number, height: number, radius: number, gradientStops: GradientStop[], angle?: number): this; custom(fn: (ctx: CanvasRenderingContext2D) => void): this; clear(): this; get commandCount(): number; flush(ctx: CanvasRenderingContext2D): void; private executeLinearGradientRect; private executeFillTextClipped; private executeRoundedRect; } export declare const defaultBatcher: DrawBatcher; export {};