import { Expr as ExprT, GpuFragmentParams } from '../../gpu/contract'; import { PropRef } from '../values'; /** * std/effects/overlay — HUD overlays: whole fragments that draw detection boxes or motion trackers over the layer inside. * * Both words return a fragment for a `gpu:` definition. They read the child as a texture, * look for content in it (bright, dark, colored or opaque areas) and draw chrome over it: * bounding boxes and labels for `detectionOverlay`, pursuing tracker gizmos with keyframe * trails for `motionTrackerHud`. Sizes are in pixels on a 1080-pixel-tall canvas and scale * with the canvas height. Colors are color props (`transform: transformColor`). */ export { overPremul, roundRectSD, cornerBracketMask, straightFromPremul } from '../../gpu/kit/overlayParts'; /** The props `detectionOverlay` reads. Every field is a prop ref (`p('name')`). Props marked "select" are declared `compileTime: true`. */ export interface DetectionOverlaySlots { /** Select: what counts as an object, `'alpha' | 'bright' | 'dark' | 'red' | 'green' | 'blue'`. */ detectionMode: PropRef; /** 0–1, how strong the content must be to count. */ threshold: PropRef; /** Select: how the canvas is cut into cells, `'grid' | 'quadtree' | 'mosaic'`. */ layout: PropRef; /** Base cell size in pixels (24–800). */ cellSize: PropRef; /** Select (integer 1–5): how many times a quadtree or mosaic cell may split in four. Ignored by `'grid'`. */ maxDepth: PropRef; /** Select: `'full'` box outline or `'corners'` brackets. */ boxStyle: PropRef; /** Outline thickness in pixels. */ lineWidth: PropRef; /** Outline corner radius in pixels (full boxes only). */ cornerRadius: PropRef; /** Box outline color. */ strokeColor: PropRef; /** Box fill color; use a translucent one. */ fillColor: PropRef; /** Label text color. */ labelColor: PropRef; /** Label pill color. */ labelBackgroundColor: PropRef; /** Select: what the label says, `'none' | 'dimensions' | 'percentage'`. */ labelMode: PropRef; /** Select: the box corner the label sits at, `'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'`. */ labelPosition: PropRef; /** Boolean prop (`transform: transformBoolean`): label inside the box (on) or outside (off). */ labelInset: PropRef; /** Label pill corner radius in pixels. */ labelRadius: PropRef; /** Google Fonts family for the label (a `font-family` prop). */ fontFamily: PropRef; /** Font weight for the label (a `font-weight` prop). */ fontWeight: PropRef; /** Label text size as a fraction of canvas height (0.01–0.5). */ fontSize: PropRef; /** Label letter spacing in em. */ letterSpacing: PropRef; } /** * Draw computer-vision style detection boxes over whatever the child contains. * * A whole fragment for a `gpu:` definition. The canvas is cut into cells (`layout`, * `cellSize`, `maxDepth`); each cell that holds content of the chosen kind (`detectionMode` * above `threshold`) gets a box drawn tight around that content, with an optional label * showing its size or coverage. The child shows through underneath. Every slot is a prop * ref; the field list on `DetectionOverlaySlots` gives units and options. * * @example * ```ts * gpu: {fragment: detectionOverlay({detectionMode: p('detectionMode'), threshold: p('threshold'), layout: p('layout'), cellSize: p('cellSize'), maxDepth: p('maxDepth'), boxStyle: p('boxStyle'), lineWidth: p('lineWidth'), cornerRadius: p('cornerRadius'), strokeColor: p('strokeColor'), fillColor: p('fillColor'), labelColor: p('labelColor'), labelBackgroundColor: p('labelBackgroundColor'), labelMode: p('labelMode'), labelPosition: p('labelPosition'), labelInset: p('labelInset'), labelRadius: p('labelRadius'), fontFamily: p('fontFamily'), fontWeight: p('fontWeight'), fontSize: p('fontSize'), letterSpacing: p('letterSpacing')})} * ``` * @tip Cost grows with `maxDepth`; 2 is plenty for most layouts. Set `labelMode` to `'none'` to skip the text pass entirely. * @see motionTrackerHud */ export declare function detectionOverlay(slots: DetectionOverlaySlots): (params: GpuFragmentParams) => ExprT; /** The props `motionTrackerHud` reads. Every field is a prop ref (`p('name')`). */ export interface MotionTrackerHudSlots { /** How many trackers to draw, 1–64. Must be the same prop the tracker simulation reads. */ trackers: PropRef; /** 0–1, how visible the keyframe trail behind each tracker is. */ trail: PropRef; /** Gizmo size in pixels (8–80). */ markerSize: PropRef; /** Stroke width in pixels. */ lineWidth: PropRef; /** Color of the tracker gizmo (brackets, crosshair, dot). */ markerColor: PropRef; /** Color of the keyframe diamonds along the trail. */ keyframeColor: PropRef; /** Color of the motion path between keyframes. */ pathColor: PropRef; } /** * Draw motion-tracker gizmos that chase content across the child, leaving keyframe trails. * * A whole fragment for a `gpu:` definition. It only draws; the trackers themselves come from * the tracker pursuit simulation, which the same definition must run as its `compute:` pass * (`trackerSim.createTrackerPursuitSim` from the kit, as the KeyFrames shader does). Without * that pass the child passes through untouched. Every slot is a prop ref; the field list on * `MotionTrackerHudSlots` gives units. * * @example * ```ts * gpu: {fragment: motionTrackerHud({trackers: p('trackers'), trail: p('trail'), markerSize: p('markerSize'), lineWidth: p('lineWidth'), markerColor: p('markerColor'), keyframeColor: p('keyframeColor'), pathColor: p('pathColor')})} * ``` * @tip Copy the KeyFrames shader as a whole; the compute pass and this fragment share the `trackers` prop and the detection props. * @see detectionOverlay */ export declare function motionTrackerHud(slots: MotionTrackerHudSlots): (params: GpuFragmentParams) => ExprT; //# sourceMappingURL=overlay.d.ts.map