import type { MaskDrawInstruction } from "#types/mask-style"; import type { Point } from "#types/detections"; import { StrokeAlignment } from "#types/paint-style"; /** * Palette slots an id raster can name, one of them the background. A GLSL * fragment stage is guaranteed only 224 uniform vectors, and a palette entry * costs 2.5 of them, so this stays a multiple of four and well inside that * budget; past it a frame draws from the RGBA composite instead. */ export declare const MAX_ID_MASK_PALETTE_ENTRIES = 80; export declare const MAX_ID_MASK_STROKE_WIDTH = 16; export interface IdMaskInstruction extends MaskDrawInstruction { readonly detectionIndex: number; readonly polygon?: never; } export interface IdPolygonInstruction extends Omit { readonly mask?: never; readonly polygon: { readonly height: number; readonly points: readonly Point[]; readonly width: number; }; } export interface IdMaskFrame { readonly data: Uint8Array; readonly fillPalette: Float32Array; readonly hasStroke: boolean; readonly height: number; /** Largest outside stroke extent in CSS pixels. */ readonly maxStrokeWidth: number; /** Original mask-plane width before optional raster reduction. */ readonly sourceWidth: number; readonly strokePalette: Float32Array; /** Inside fraction per palette ID: outside 0, center 0.5, inside 1. Missing values default to outside. */ readonly strokeAlignments?: Float32Array; /** Total stroke width in CSS pixels per palette ID. */ readonly strokeWidths: Float32Array; readonly width: number; } export interface IdMaskFrameOptions { /** * Widest raster to cook. A value at or above the instructions' own width * cooks at their width, and a smaller one keeps their aspect ratio. */ readonly maxWidth?: number; } export declare function createIdMaskFrame(instructions: readonly (IdMaskInstruction | IdPolygonInstruction)[], options?: IdMaskFrameOptions): IdMaskFrame | undefined; /** * Converts total CSS outline width into raster texels. Each side is bounded * independently so centered outlines can use the full supported radius. */ export declare function resolveIdMaskStrokeTexels(strokeWidth: number, displayWidth: number, rasterWidth: number, alignment?: StrokeAlignment): number; /** * The palette slot a detection index names, or undefined when the palette has * no slot for it. Slot zero is the background, so the ids start at one and the * last detection the palette can name sits one index below the last slot. */ export declare function resolveIdMaskPaletteId(detectionIndex: number): number | undefined; export declare function writeIdMaskPaletteEntry(palette: Float32Array, detectionMaskId: number, color: number, alpha: number): void; //# sourceMappingURL=id-mask-frame.d.ts.map