import type { View } from '../renderer/buildView.js';
import type { Die } from '../core/dies.js';
export interface ToCanvasOptions {
    /** Padding in CSS pixels inside the canvas edge. Default 16. */
    padding?: number;
    /** Draw a continuous colorbar (value modes) or bin legend (bin modes). Default true. */
    showColorbar?: boolean;
    /** Width in CSS pixels of the colorbar strip. Default 16. */
    colorbarWidth?: number;
    /** Canvas background colour. Default '#f5f5f5'. */
    background?: string;
    /** Legend position for bin modes. Default 'default'. */
    legendPosition?: 'default' | 'compact' | 'bottom' | 'top' | 'left' | 'floating';
    /** Floating legend offset in CSS pixels. Used when `legendPosition === 'floating'`. */
    legendOffset?: {
        x: number;
        y: number;
    };
    /**
     * Draw axis tick marks and labels. Default false.
     * When true, labels show die grid indices if `diePitchMm` is provided,
     * otherwise mm values.
     */
    showAxes?: boolean;
    /** Die pitch in mm — used to convert mm axis values to die-index labels. */
    diePitchMm?: {
        x: number;
        y: number;
    };
    /**
     * Override the viewport transform. When provided, `originX`, `originY`,
     * and `ppm` replace the auto-fitted values — used by renderWaferMap for
     * zoom/pan. Also accepts a zoom-adjusted `snapDist` for hit testing.
     */
    viewport?: ViewportTransform;
    /** Currently highlighted bin (or metadata value) — drawn with an active indicator in the bin legend. */
    activeBin?: number | string;
    /**
     * Format to use for unitless values outside the normal display range [0.1, 9999].
     * `'engineering'` (default): multiples-of-3 exponent notation (e.g. `12E-6`).
     * `'si'`: SI prefix with no unit suffix (e.g. `12 µ`).
     * Values with a unit always use SI prefix regardless of this setting.
     */
    fallbackFormat?: 'si' | 'engineering';
    /** Extra space reserved at the top of the canvas in CSS pixels. Default 0. Used by renderWaferMap to prevent the floating toolbar from obscuring the wafer. */
    topClearance?: number;
    /** Minimum right-side reserve in CSS pixels. Ensures the wafer draw width stays stable across plot mode switches. */
    minRightReserve?: number;
    /** Named hard bin definitions — used to label the bin legend. */
    hbinDefs?: import('../renderer/buildWaferMap.js').BinDef[];
    /** Named soft bin definitions — used to label the bin legend. */
    sbinDefs?: import('../renderer/buildWaferMap.js').BinDef[];
    /** Named metadata-field definitions — used to label/color the metadata legend. */
    metadataFields?: import('../renderer/buildWaferMap.js').MetadataFieldDef[];
    /**
     * Draw the map title (test name / mode + stack context) above the colorbar or bin legend.
     * Default true. The title is placed in empty space adjacent to the legend/colorbar and does NOT
     * shrink the map. Set false to suppress (e.g. when a host renders its own heading).
     */
    showTitle?: boolean;
}
/** Internal viewport state shared between toCanvas and renderWaferMap. */
export interface ViewportTransform {
    originX: number;
    originY: number;
    ppm: number;
    snapDist: number;
}
export interface HitTarget {
    /** Given a CSS-pixel position on the canvas, return the die at that point or null. */
    getDieAtPoint(x: number, y: number): Die | null;
}
/** A hit-testable row in the bin legend — one entry per unique bin (or metadata value). */
export interface BinLegendRow {
    bin: number | string;
    x: number;
    /** Top CSS-pixel of the row (relative to canvas). */
    y: number;
    /** Width in CSS pixels of the row. */
    w: number;
    /** Height in CSS pixels of the row. */
    h: number;
    /** Optional full label text for tooltips. */
    label?: string;
}
export interface ToCanvasResult {
    hitTarget: HitTarget;
    /** The fitted viewport — useful as initial state for renderWaferMap. */
    viewport: ViewportTransform;
    /** Non-empty only when a bin legend was drawn (hardbin / softbin modes). */
    binLegendRows: BinLegendRow[];
    /** Floating legend box bounds, when rendered. */
    legendBox?: {
        x: number;
        y: number;
        w: number;
        h: number;
    };
}
export declare const BIN_LEGEND_W = 110;
export declare const BIN_LEGEND_W_COMPACT = 64;
export declare const BIN_LEGEND_ADAPT_COMPACT = 280;
export declare const BIN_LEGEND_ADAPT_FLOATING = 180;
export declare function toCanvas(canvas: HTMLCanvasElement, view: View, options?: ToCanvasOptions): ToCanvasResult;
export { fmt, fmtColorbarAxis } from '../renderer/fmt.js';
//# sourceMappingURL=toCanvas.d.ts.map