import type { PixiBoxLayerState } from "./pixi-box-layer"; import type { PixiRegionLayerState } from "./pixi-region-layer"; import type { PresentedFrameId, PresentedVideoFrame } from "./presented-frame-channel"; type PresentedFrameStamp = Pick; /** * Every drawing step of a present, each taking the media time in seconds. A * step that reads a time from anywhere but its argument breaks the guarantee * this module exists to hold. * * The mask step also takes the producer's name for the frame these pixels are, * because it is the one step that keeps a raster between presents and so is the * one step that can put a raster from one frame over the pixels of another. A * walk with no presented frame hands it null: a pull-path sample and a redraw * at a resting playhead both have a media time and no frame identity. */ export interface FramePresentLayers { readonly drawDepth?: (mediaTime: number) => void; readonly drawHeatmap?: (mediaTime: number) => void; readonly drawMask: ((mediaTime: number, presentedFrameId: PresentedFrameId | null) => void) | undefined; readonly drawBox: (mediaTime: number) => PixiBoxLayerState; readonly drawPolygon: ((mediaTime: number) => void) | undefined; readonly drawVector: (mediaTime: number) => void; readonly drawRegion: (mediaTime: number) => PixiRegionLayerState; readonly drawInteraction: ((mediaTime: number) => void) | undefined; readonly drawFocus: (mediaTime: number) => void; /** Moves the focus layer's fade to where the presented media time puts it. */ readonly advanceFocus: (mediaTime: number) => void; readonly drawInteractionPresentation: (mediaTime: number) => void; readonly drawLabel: ((mediaTime: number) => void) | undefined; readonly drawAnnotationOverlay: (mediaTime: number) => void; } export interface FramePresentLayerStates { readonly boxState: PixiBoxLayerState; readonly regionState: PixiRegionLayerState; } export interface FramePresentTargets { /** Adopts the presented time as the scene's media time, before anything draws. */ readonly adoptMediaTime: (mediaTime: number) => void; readonly fitMediaScene: () => void; /** Receives the pixels and their remaining display transform as one delivery. */ readonly uploadFrame: (presented: PresentedVideoFrame) => void; readonly layers: FramePresentLayers; readonly render: () => void; readonly completePresentation: (mediaTime: number, boxState: PixiBoxLayerState, regionState: PixiRegionLayerState) => void; } /** * The atomic present: one frame handed to the host becomes one composited screen. * * The media time is the one the producer published for the frame these pixels * are, and it is the only time any step below sees. Nothing here awaits, so no * other frame can be presented between the pixel upload and the annotations * drawn over it, and nothing here consults a wall clock, a playhead getter or * a store, so no step can disagree with the pixels about which moment is on * screen. One render closes the block, after every layer has drawn; the frame * is closed on the way out, once, by its only owner. */ export declare function presentVideoFrame(presented: PresentedVideoFrame, targets: FramePresentTargets): void; /** * The one declaration of the draw order: a present walks it, and so does a * redraw at a resting playhead, so a layer cannot be in one sequence and be * missing or out of place in the other. * * A walk with no presented frame is not a present, and has no frame timestamp * to check its steps against. */ export declare function drawFramePresentLayers(layers: FramePresentLayers, mediaTime: number, presented?: PresentedFrameStamp): FramePresentLayerStates; export type FramePresentStep = keyof FramePresentLayers; /** * The steps a walk would take, each reporting its cost, so a present that * wants a timing breakdown still reads the one declared order. */ export declare function measureFramePresentLayers(layers: FramePresentLayers, measureStep: (step: FramePresentStep, draw: () => T) => T): FramePresentLayers; /** * Fails when a step is handed anything but the presented media time. It reads * as a tautology against the line above it, and that is the point: it is the * line that breaks when someone later gives one step a time of its own. */ export declare function assertPresentedTimestamp(mediaTime: number, presented: PresentedFrameStamp): void; export {}; //# sourceMappingURL=pixi-frame-present.d.ts.map