import type { InjectedMeshConstructor, InjectedMeshGeometryConstructor, InjectedShaderFactory } from "#renderers/injected-pixi"; import type { Detection, MaskHaloDrawInstruction, MaskHaloStyle, MaskHaloStyleContext, MaskStyle } from "supervision-js-core"; import type { Container as PixiContainer, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Shader as PixiShader, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js"; type PixiMaskHaloMesh = PixiMesh; type ContainerConstructor = new () => PixiContainer; type ImageSourceConstructor = new (options: { autoGenerateMipmaps?: boolean; dynamic: boolean; height: number; resource: HTMLCanvasElement; scaleMode?: "linear" | "nearest"; width: number; }) => PixiImageSource; type UniformGroupConstructor = new (uniforms: Record"; value: Float32Array; }>) => PixiUniformGroup; /** * The halo a detection actually paints, or `undefined`. A style may answer an * instruction that draws nothing, and both the coverage the halo prepares and * the passes it renders have to read that the same way: the raster carries one * detection id per pixel, so a detection admitted into the coverage but never * painted still claims its pixels and buries the ids the glow is drawn from. */ export declare function resolvePaintedMaskHalo(haloStyle: MaskHaloStyle, detection: Detection, context: MaskHaloStyleContext): MaskHaloDrawInstruction | undefined; /** * The mask coverage a halo-only presentation prepares. Nothing here reaches the * screen, so the fill colour and alpha are arbitrary. */ export declare function createMaskHaloPreparationStyle(haloStyle: MaskHaloStyle, artifactKey: string): MaskStyle; export interface PixiBlurFilterLike { strength: number; } type BlurFilterConstructor = new (options: { strength: number; quality?: number; }) => PixiBlurFilterLike; type RectangleConstructor = new (x: number, y: number, width: number, height: number) => unknown; /** * One blur pass: every mask id whose halo requested the same spread renders * together, so each detection's public spread contract is honored exactly. */ export interface MaskHaloPassGroup { readonly palette: Float32Array; readonly spread: number; } export interface PixiMaskHaloRenderer { readonly display: PixiContainer; hide(): void; releaseTexture(source: PixiImageSource): void; render(frame: { readonly height: number; readonly width: number; }, texture: PixiTexture, groups: readonly MaskHaloPassGroup[]): void; setOpacity(opacity: number): void; destroy(): void; } /** * Renders blurred, per-detection-colored copies of the prepared id mask * beneath the mask layer. Each pass maps mask ids through a halo palette and * a GPU blur filter turns that coverage into a smooth glow following the * exact mask silhouette, reusing the already-prepared mask texture. Passes * are pooled and one runs per distinct spread. */ export declare function createPixiMaskHaloRenderer(options: { readonly BlurFilter: BlurFilterConstructor; readonly Container: ContainerConstructor; readonly Rectangle: RectangleConstructor; readonly ImageSource: ImageSourceConstructor; readonly Mesh: InjectedMeshConstructor; readonly MeshGeometry: InjectedMeshGeometryConstructor; readonly Shader: InjectedShaderFactory; readonly UniformGroup: UniformGroupConstructor; readonly mediaHeight: number; readonly mediaWidth: number; }): PixiMaskHaloRenderer; /** * Builds one halo palette uniform: premultiplied halo color and alpha per * mask id, transparent for ids outside the group. */ export declare function buildMaskHaloPalette(halos: ReadonlyMap): Float32Array; export {}; //# sourceMappingURL=pixi-mask-halo.d.ts.map