/**
 * fixes.ts — Bug fixes and performance patches for editors.
 *
 * - PhotoEditor: Retina/HiDPI canvas devicePixelRatio handling
 * - VectorEditor: Shape virtualization for >100 shapes
 * - AnimationEditor: Memory leak prevention (raf/timer cleanup)
 */
export interface RetinaCanvasOptions {
    /** CSS width of the canvas. */
    width: number;
    /** CSS height of the canvas. */
    height: number;
    /** Override devicePixelRatio (default: window.devicePixelRatio). */
    dpr?: number;
}
/**
 * Configure a canvas for Retina/HiDPI displays.
 * Scales the backing store while keeping CSS dimensions intact.
 */
export declare function setupRetinaCanvas(canvas: HTMLCanvasElement, options: RetinaCanvasOptions): CanvasRenderingContext2D;
/**
 * Get the correct mouse position on a Retina canvas.
 */
export declare function retinaMousePosition(e: MouseEvent | {
    clientX: number;
    clientY: number;
}, canvas: HTMLCanvasElement): {
    x: number;
    y: number;
};
export interface VirtualBounds {
    x: number;
    y: number;
    width: number;
    height: number;
}
export interface VirtualizedShape<T> {
    shape: T;
    bounds: VirtualBounds;
}
/**
 * Given a list of shapes with bounding boxes and a visible viewport,
 * returns only the shapes intersecting the viewport.
 */
export declare function virtualizeShapes<T>(shapes: VirtualizedShape<T>[], viewport: VirtualBounds, margin?: number): T[];
/**
 * Spatial hash grid for fast shape lookup.
 * Greatly speeds up rendering and hit-testing with many shapes.
 */
export declare class SpatialHashGrid<T> {
    private cellSize;
    private cells;
    constructor(cellSize?: number);
    private cellKey;
    /** Insert a shape into the grid. */
    insert(shape: T, bounds: VirtualBounds): void;
    /** Query shapes overlapping the given viewport. */
    query(viewport: VirtualBounds): T[];
    /** Remove all shapes from the grid. */
    clear(): void;
    /** Rebuild the grid from a list of shapes. */
    rebuild(shapes: VirtualizedShape<T>[]): void;
}
/**
 * Track requestAnimationFrame IDs and timers for proper cleanup.
 */
export declare class AnimationCleanup {
    private rafIds;
    private timerIds;
    private intervalIds;
    private disposed;
    /** Wraps requestAnimationFrame with tracking. */
    requestAnimationFrame(cb: FrameRequestCallback): number;
    /** Wraps setTimeout with tracking. */
    setTimeout(cb: () => void, ms: number): ReturnType<typeof setTimeout>;
    /** Wraps setInterval with tracking. */
    setInterval(cb: () => void, ms: number): ReturnType<typeof setInterval>;
    /** Cancel all tracked timers and animation frames. */
    dispose(): void;
}
