supervision 0.1.7 → 0.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/dist/detections/chunked-detection-frame-source.d.ts.map +1 -1
  2. package/dist/index.d.ts +11 -4
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +8856 -4559
  5. package/dist/index.js.map +1 -1
  6. package/dist/mask-preparation.worker.js +310 -164
  7. package/dist/mask-preparation.worker.js.map +1 -1
  8. package/dist/media/display-pixel-ratio.d.ts +15 -0
  9. package/dist/media/display-pixel-ratio.d.ts.map +1 -0
  10. package/dist/media/engine-import-failure.d.ts +16 -0
  11. package/dist/media/engine-import-failure.d.ts.map +1 -0
  12. package/dist/media/media-condition-probe.d.ts +51 -0
  13. package/dist/media/media-condition-probe.d.ts.map +1 -0
  14. package/dist/media/media-conditions.d.ts +28 -0
  15. package/dist/media/media-conditions.d.ts.map +1 -0
  16. package/dist/media/media-errors.d.ts +6 -0
  17. package/dist/media/media-errors.d.ts.map +1 -1
  18. package/dist/media/media-normalization.d.ts.map +1 -1
  19. package/dist/media/media-probe.d.ts.map +1 -1
  20. package/dist/media/media-source.d.ts +17 -0
  21. package/dist/media/media-source.d.ts.map +1 -1
  22. package/dist/media/mediabunny-media-source.d.ts.map +1 -1
  23. package/dist/media/video-engine-media-source.d.ts +44 -0
  24. package/dist/media/video-engine-media-source.d.ts.map +1 -0
  25. package/dist/render-preparation/mask-frame-artifact.d.ts +46 -12
  26. package/dist/render-preparation/mask-frame-artifact.d.ts.map +1 -1
  27. package/dist/render-preparation/mask-frame-compositor.d.ts +5 -5
  28. package/dist/render-preparation/mask-frame-compositor.d.ts.map +1 -1
  29. package/dist/render-preparation/mask-frame-preparer.d.ts.map +1 -1
  30. package/dist/render-preparation/mask-preparation-worker-count.d.ts +4 -4
  31. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts +12 -3
  32. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts.map +1 -1
  33. package/dist/render-preparation/prepared-render-window.d.ts +23 -0
  34. package/dist/render-preparation/prepared-render-window.d.ts.map +1 -1
  35. package/dist/render-preparation/prepared-window-timeline.d.ts +2 -6
  36. package/dist/render-preparation/prepared-window-timeline.d.ts.map +1 -1
  37. package/dist/renderers/mask-palette.d.ts +14 -0
  38. package/dist/renderers/mask-palette.d.ts.map +1 -0
  39. package/dist/renderers/mask-vertex.d.ts +14 -0
  40. package/dist/renderers/mask-vertex.d.ts.map +1 -0
  41. package/dist/renderers/media-renderer-core.d.ts.map +1 -1
  42. package/dist/renderers/media-renderer-scene.d.ts +37 -0
  43. package/dist/renderers/media-renderer-scene.d.ts.map +1 -1
  44. package/dist/renderers/media-renderer-state.d.ts +11 -1
  45. package/dist/renderers/media-renderer-state.d.ts.map +1 -1
  46. package/dist/renderers/media-renderer-transport.d.ts +59 -0
  47. package/dist/renderers/media-renderer-transport.d.ts.map +1 -0
  48. package/dist/renderers/pixi-box-layer.d.ts +5 -0
  49. package/dist/renderers/pixi-box-layer.d.ts.map +1 -1
  50. package/dist/renderers/pixi-focus-layer.d.ts +18 -2
  51. package/dist/renderers/pixi-focus-layer.d.ts.map +1 -1
  52. package/dist/renderers/pixi-frame-present.d.ts +77 -0
  53. package/dist/renderers/pixi-frame-present.d.ts.map +1 -0
  54. package/dist/renderers/pixi-id-mask-shader.d.ts +12 -2
  55. package/dist/renderers/pixi-id-mask-shader.d.ts.map +1 -1
  56. package/dist/renderers/pixi-interaction-layer.d.ts.map +1 -1
  57. package/dist/renderers/pixi-interaction-presentation-layer.d.ts +13 -2
  58. package/dist/renderers/pixi-interaction-presentation-layer.d.ts.map +1 -1
  59. package/dist/renderers/pixi-mask-halo.d.ts +24 -0
  60. package/dist/renderers/pixi-mask-halo.d.ts.map +1 -1
  61. package/dist/renderers/pixi-mask-layer.d.ts +71 -8
  62. package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
  63. package/dist/renderers/pixi-media-scene.d.ts +67 -0
  64. package/dist/renderers/pixi-media-scene.d.ts.map +1 -1
  65. package/dist/renderers/pixi-polygon-layer.d.ts +7 -2
  66. package/dist/renderers/pixi-polygon-layer.d.ts.map +1 -1
  67. package/dist/renderers/pixi-region-coverage-mask.d.ts +91 -0
  68. package/dist/renderers/pixi-region-coverage-mask.d.ts.map +1 -0
  69. package/dist/renderers/pixi-region-effect.d.ts +42 -0
  70. package/dist/renderers/pixi-region-effect.d.ts.map +1 -0
  71. package/dist/renderers/pixi-region-layer.d.ts +68 -2
  72. package/dist/renderers/pixi-region-layer.d.ts.map +1 -1
  73. package/dist/renderers/pixi-vector-layer.d.ts.map +1 -1
  74. package/dist/renderers/prepared-annotation-window.d.ts +47 -0
  75. package/dist/renderers/prepared-annotation-window.d.ts.map +1 -0
  76. package/dist/renderers/presented-frame-channel.d.ts +107 -0
  77. package/dist/renderers/presented-frame-channel.d.ts.map +1 -0
  78. package/dist/renderers/scene-render-scheduler.d.ts +20 -0
  79. package/dist/renderers/scene-render-scheduler.d.ts.map +1 -0
  80. package/dist/sessions/media-session-defaults.d.ts +10 -6
  81. package/dist/sessions/media-session-defaults.d.ts.map +1 -1
  82. package/dist/sessions/media-session-media.d.ts.map +1 -1
  83. package/dist/sessions/media-session-state.d.ts.map +1 -1
  84. package/dist/sessions/media-session.d.ts.map +1 -1
  85. package/dist/tracking.worker.js +58 -3
  86. package/dist/tracking.worker.js.map +1 -1
  87. package/dist/types/media-conditions.d.ts +149 -0
  88. package/dist/types/media-conditions.d.ts.map +1 -0
  89. package/dist/types/media-normalization.d.ts +34 -0
  90. package/dist/types/media-normalization.d.ts.map +1 -1
  91. package/dist/types/media-renderer.d.ts +31 -1
  92. package/dist/types/media-renderer.d.ts.map +1 -1
  93. package/dist/types/media-session.d.ts +89 -8
  94. package/dist/types/media-session.d.ts.map +1 -1
  95. package/dist/types/render-preparation.d.ts +101 -4
  96. package/dist/types/render-preparation.d.ts.map +1 -1
  97. package/dist/web-video-engine/analysis-session.d.ts +76 -0
  98. package/dist/web-video-engine/analysis-session.d.ts.map +1 -0
  99. package/dist/web-video-engine/analysis.d.ts +7 -0
  100. package/dist/web-video-engine/analysis.d.ts.map +1 -0
  101. package/dist/web-video-engine/analysis.js +1678 -0
  102. package/dist/web-video-engine/analysis.js.map +1 -0
  103. package/dist/web-video-engine/cache-budget.d.ts +19 -0
  104. package/dist/web-video-engine/cache-budget.d.ts.map +1 -0
  105. package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts +90 -0
  106. package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts.map +1 -0
  107. package/dist/web-video-engine/clock.d.ts +83 -0
  108. package/dist/web-video-engine/clock.d.ts.map +1 -0
  109. package/dist/web-video-engine/constants.d.ts +253 -0
  110. package/dist/web-video-engine/constants.d.ts.map +1 -0
  111. package/dist/web-video-engine/create-scrub-cursor.d.ts +62 -0
  112. package/dist/web-video-engine/create-scrub-cursor.d.ts.map +1 -0
  113. package/dist/web-video-engine/decode-resolution.d.ts +115 -0
  114. package/dist/web-video-engine/decode-resolution.d.ts.map +1 -0
  115. package/dist/web-video-engine/decode-scheduler.d.ts +356 -0
  116. package/dist/web-video-engine/decode-scheduler.d.ts.map +1 -0
  117. package/dist/web-video-engine/decode-session.d.ts +276 -0
  118. package/dist/web-video-engine/decode-session.d.ts.map +1 -0
  119. package/dist/web-video-engine/decode-source.d.ts +250 -0
  120. package/dist/web-video-engine/decode-source.d.ts.map +1 -0
  121. package/dist/web-video-engine/diagnostics-store.d.ts +18 -0
  122. package/dist/web-video-engine/diagnostics-store.d.ts.map +1 -0
  123. package/dist/web-video-engine/diagnostics.d.ts +316 -0
  124. package/dist/web-video-engine/diagnostics.d.ts.map +1 -0
  125. package/dist/web-video-engine/embedded-engine-worker.d.ts +2 -0
  126. package/dist/web-video-engine/embedded-engine-worker.d.ts.map +1 -0
  127. package/dist/web-video-engine/engine-core.d.ts +258 -0
  128. package/dist/web-video-engine/engine-core.d.ts.map +1 -0
  129. package/dist/web-video-engine/engine.d.ts +26 -0
  130. package/dist/web-video-engine/engine.d.ts.map +1 -0
  131. package/dist/web-video-engine/engine.js +873 -0
  132. package/dist/web-video-engine/engine.js.map +1 -0
  133. package/dist/web-video-engine/engine.worker.d.ts +2 -0
  134. package/dist/web-video-engine/engine.worker.d.ts.map +1 -0
  135. package/dist/web-video-engine/engine.worker.js +31320 -0
  136. package/dist/web-video-engine/engine.worker.js.map +1 -0
  137. package/dist/web-video-engine/frame-cache.d.ts +129 -0
  138. package/dist/web-video-engine/frame-cache.d.ts.map +1 -0
  139. package/dist/web-video-engine/frame-extractor.d.ts +28 -0
  140. package/dist/web-video-engine/frame-extractor.d.ts.map +1 -0
  141. package/dist/web-video-engine/frame-timeline-GINI8Gum.js +560 -0
  142. package/dist/web-video-engine/frame-timeline-GINI8Gum.js.map +1 -0
  143. package/dist/web-video-engine/frame-timeline.d.ts +71 -0
  144. package/dist/web-video-engine/frame-timeline.d.ts.map +1 -0
  145. package/dist/web-video-engine/frame-walker.d.ts +74 -0
  146. package/dist/web-video-engine/frame-walker.d.ts.map +1 -0
  147. package/dist/web-video-engine/index.d.ts +3 -0
  148. package/dist/web-video-engine/index.d.ts.map +1 -0
  149. package/dist/web-video-engine/index.js +3 -0
  150. package/dist/web-video-engine/index.js.map +1 -0
  151. package/dist/web-video-engine/key-packet.d.ts +65 -0
  152. package/dist/web-video-engine/key-packet.d.ts.map +1 -0
  153. package/dist/web-video-engine/keyframe-index.d.ts +91 -0
  154. package/dist/web-video-engine/keyframe-index.d.ts.map +1 -0
  155. package/dist/web-video-engine/mirror-store.d.ts +56 -0
  156. package/dist/web-video-engine/mirror-store.d.ts.map +1 -0
  157. package/dist/web-video-engine/renderer.d.ts +94 -0
  158. package/dist/web-video-engine/renderer.d.ts.map +1 -0
  159. package/dist/web-video-engine/rotation.d.ts +35 -0
  160. package/dist/web-video-engine/rotation.d.ts.map +1 -0
  161. package/dist/web-video-engine/scrub-controller.d.ts +376 -0
  162. package/dist/web-video-engine/scrub-controller.d.ts.map +1 -0
  163. package/dist/web-video-engine/scrub-cursor.d.ts +342 -0
  164. package/dist/web-video-engine/scrub-cursor.d.ts.map +1 -0
  165. package/dist/web-video-engine/scrub-trajectory.d.ts +30 -0
  166. package/dist/web-video-engine/scrub-trajectory.d.ts.map +1 -0
  167. package/dist/web-video-engine/source-residency.d.ts +57 -0
  168. package/dist/web-video-engine/source-residency.d.ts.map +1 -0
  169. package/dist/web-video-engine/trace-recorder.d.ts +164 -0
  170. package/dist/web-video-engine/trace-recorder.d.ts.map +1 -0
  171. package/dist/web-video-engine/types.d.ts +204 -0
  172. package/dist/web-video-engine/types.d.ts.map +1 -0
  173. package/dist/web-video-engine/video-engine.d.ts +426 -0
  174. package/dist/web-video-engine/video-engine.d.ts.map +1 -0
  175. package/dist/web-video-engine/webgpu-renderer.d.ts +62 -0
  176. package/dist/web-video-engine/webgpu-renderer.d.ts.map +1 -0
  177. package/dist/web-video-engine/worker-bridge.d.ts +12 -0
  178. package/dist/web-video-engine/worker-bridge.d.ts.map +1 -0
  179. package/dist/web-video-engine/worker-dispatch.d.ts +17 -0
  180. package/dist/web-video-engine/worker-dispatch.d.ts.map +1 -0
  181. package/dist/web-video-engine/worker-protocol.d.ts +267 -0
  182. package/dist/web-video-engine/worker-protocol.d.ts.map +1 -0
  183. package/node_modules/supervision-js-core/dist/detections/buffered-detection-timeline.d.ts.map +1 -1
  184. package/node_modules/supervision-js-core/dist/detections/composite-detection-frame-source.d.ts.map +1 -1
  185. package/node_modules/supervision-js-core/dist/index.d.ts +4 -3
  186. package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
  187. package/node_modules/supervision-js-core/dist/index.js +1075 -266
  188. package/node_modules/supervision-js-core/dist/index.js.map +1 -1
  189. package/node_modules/supervision-js-core/dist/styles/default-annotation-presentation.d.ts.map +1 -1
  190. package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts +4 -36
  191. package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts.map +1 -1
  192. package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts +5 -0
  193. package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts.map +1 -1
  194. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts +92 -7
  195. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts.map +1 -1
  196. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts +179 -17
  197. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts.map +1 -1
  198. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +78 -2
  199. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
  200. package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts +2 -0
  201. package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts.map +1 -1
  202. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts +16 -0
  203. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts.map +1 -1
  204. package/node_modules/supervision-js-core/dist/utils/detection-conversions.d.ts.map +1 -1
  205. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts +5 -0
  206. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
  207. package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts +9 -0
  208. package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts.map +1 -1
  209. package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts +18 -0
  210. package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts.map +1 -0
  211. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts +15 -2
  212. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts.map +1 -1
  213. package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts +7 -0
  214. package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts.map +1 -0
  215. package/package.json +22 -1
@@ -1,11 +1,13 @@
1
1
  import { type PreparedRenderTimelineContext } from "#render-preparation/prepared-render-window";
2
- import { type PreparedPngIdMaskFrame } from "#render-preparation/mask-frame-artifact";
2
+ import { IdMaskTextureFormat, type PreparedIdMaskFrame, type PreparedRegionMaskCoverageEntry, type PreparedRegionMaskCoverageFrame } from "#render-preparation/mask-frame-artifact";
3
3
  import type { BufferedDetectionTimeline } from "supervision-js-core";
4
4
  import type { DetectionPickPoint, DetectionPickResult } from "supervision-js-core";
5
5
  import type { MaskHaloStyle, MaskStyle } from "supervision-js-core";
6
- import type { RenderPreparationOptions, RenderPreparationArtifactKind, RenderPreparationPlaybackGateOptions } from "#types/render-preparation";
6
+ import { RenderPreparationArtifactKind } from "#types/render-preparation";
7
+ import type { RenderPreparationMaskFrameOptions, RenderPreparationOptions, RenderPreparationPlaybackGateOptions } from "#types/render-preparation";
8
+ import type { PresentedFrameId } from "./presented-frame-channel";
7
9
  import type { SerializableMaskInstruction } from "#render-preparation/mask-preparation-worker-protocol";
8
- import type { Container as PixiContainer, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Shader as PixiShader, Sprite as PixiSprite, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
10
+ import type { BufferImageSource as PixiBufferImageSource, Container as PixiContainer, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Shader as PixiShader, Sprite as PixiSprite, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
9
11
  type ImageSourceConstructor = new (options: {
10
12
  autoGenerateMipmaps?: boolean;
11
13
  dynamic: boolean;
@@ -14,9 +16,18 @@ type ImageSourceConstructor = new (options: {
14
16
  scaleMode?: "linear" | "nearest";
15
17
  width: number;
16
18
  }) => PixiImageSource;
19
+ export type BufferImageSourceConstructor = new (options: {
20
+ autoGenerateMipmaps?: boolean;
21
+ dynamic: boolean;
22
+ format: IdMaskTextureFormat;
23
+ height: number;
24
+ resource: Uint8Array;
25
+ scaleMode?: "linear" | "nearest";
26
+ width: number;
27
+ }) => PixiBufferImageSource;
17
28
  type TextureConstructor = new (options: {
18
29
  dynamic: boolean;
19
- source: PixiImageSource;
30
+ source: PixiImageSource | PixiBufferImageSource;
20
31
  }) => PixiTexture;
21
32
  type TextureConstructorWithEmpty = TextureConstructor & {
22
33
  readonly EMPTY: PixiTexture;
@@ -57,26 +68,72 @@ type UniformGroupConstructor = new (uniforms: Record<string, {
57
68
  type: "vec2<f32>" | "vec4<f32>";
58
69
  value: Float32Array;
59
70
  }>) => PixiUniformGroup;
71
+ /**
72
+ * What the mask layer has on screen after its last draw.
73
+ *
74
+ * `drawnFrameTime` is the detection frame the visible raster belongs to. It is
75
+ * the frame the rest of the present drew, or the frame beside it while that
76
+ * frame's own cook is owed, or the layer draws nothing.
77
+ * `drawnFrameId` names the producer frame that raster was accepted for, and is
78
+ * null on a draw the producer did not drive: a pull-path sample and a redraw at
79
+ * a resting playhead both carry a media time and no frame identity.
80
+ */
81
+ export interface PixiMaskLayerState {
82
+ readonly drawnFrameTime: number | null;
83
+ readonly drawnFrameKey: string | null;
84
+ readonly drawnFrameId: PresentedFrameId | null;
85
+ }
60
86
  export interface PixiMaskLayer {
61
87
  createSprite(dimensions: {
62
88
  width: number;
63
89
  height: number;
64
90
  }): PixiContainer | PixiSprite;
65
- drawFrame(mediaTime: number): void;
91
+ drawFrame(mediaTime: number, presentedFrameId?: PresentedFrameId | null): void;
92
+ /** The state the last drawFrame or clearFrame left on screen. */
93
+ getDrawnState(): PixiMaskLayerState;
94
+ /** Puts the media time in front of the cook without drawing it. */
95
+ prepareFrame(mediaTime: number): void;
96
+ clearFrame(): void;
97
+ isArtifactPrepared(mediaTime: number): boolean;
66
98
  waitForRenderPreparation(mediaTime: number, options: RenderPreparationPlaybackGateOptions): Promise<void>;
67
99
  pickDetectionAtPoint(point: DetectionPickPoint, mediaTime: number): DetectionPickResult | null;
68
- getActiveIdMaskFrameTexture(): PixiActiveIdMaskFrameTexture | null;
100
+ /**
101
+ * The raster on screen, for a caller drawing the same detection frame it
102
+ * belongs to. Both of these are read by layers that pair the raster to
103
+ * detections by position, so a raster from any other frame pairs one frame's
104
+ * silhouettes to another frame's detections.
105
+ */
106
+ getActiveIdMaskFrameTexture(detectionFrameTime: number | null): PixiActiveIdMaskFrameTexture | null;
107
+ getActiveRegionMaskCoverage(detectionFrameTime: number | null): PixiActiveRegionMaskCoverage | null;
108
+ setPlaybackActive(active: boolean): void;
69
109
  setTimelineContext(context: PreparedRenderTimelineContext): void;
70
110
  setMaskStyle(maskStyle: MaskStyle | null | undefined): void;
71
111
  setMaskHaloStyle(maskHaloStyle: MaskHaloStyle | null | undefined): void;
112
+ /**
113
+ * Whether the mask fill reaches the screen. Preparation runs either way, so
114
+ * consumers of the id raster still get an artifact while the fill is off.
115
+ */
116
+ setFillVisible(visible: boolean): void;
72
117
  destroy(): void;
73
118
  }
119
+ /**
120
+ * Cook-only style for consumers that read detection ids out of the raster
121
+ * instead of drawing the fill. Ids come from the detection index, so the colour
122
+ * and alpha here never reach the screen.
123
+ */
124
+ export declare const ID_MASK_PREPARATION_STYLE: MaskStyle;
125
+ export type IdMaskDisplayBox = NonNullable<RenderPreparationMaskFrameOptions["display"]>;
74
126
  export interface PixiActiveIdMaskFrameTexture {
75
- readonly frame: PreparedPngIdMaskFrame;
127
+ readonly frame: PreparedIdMaskFrame;
76
128
  readonly texture: PixiTexture;
77
129
  }
130
+ export interface PixiActiveRegionMaskCoverage {
131
+ readonly frame: PreparedRegionMaskCoverageFrame;
132
+ getTexture(entry: PreparedRegionMaskCoverageEntry): PixiTexture | undefined;
133
+ }
78
134
  export declare function createPixiMaskLayer(options: {
79
135
  readonly artifactKind?: RenderPreparationArtifactKind;
136
+ readonly BufferImageSource?: BufferImageSourceConstructor;
80
137
  readonly Container?: ContainerConstructor;
81
138
  readonly ImageSource: ImageSourceConstructor;
82
139
  readonly Mesh?: MeshConstructor;
@@ -95,7 +152,13 @@ export declare function createPixiMaskLayer(options: {
95
152
  readonly detectionTimeline: BufferedDetectionTimeline;
96
153
  readonly maskHaloStyle?: MaskHaloStyle | null;
97
154
  readonly maskStyle: MaskStyle;
98
- readonly onActiveIdMaskFramePresented?: () => void;
155
+ readonly onPreparedWindowChange?: () => void;
156
+ /**
157
+ * Whether the renderer takes a single-channel upload whose rows are not on a
158
+ * four-byte boundary. Answered when the first raster is uploaded, since the
159
+ * renderer this scene ends up with is not known when the layer is built.
160
+ */
161
+ readonly acceptsUnalignedTextureRows?: () => boolean;
99
162
  readonly renderPreparation?: RenderPreparationOptions;
100
163
  readonly resolveInstructions?: (options: {
101
164
  readonly frame: import("supervision-js-core").DetectionFrame;
@@ -1 +1 @@
1
- {"version":3,"file":"pixi-mask-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-mask-layer.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,6BAA6B,EACnC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EACV,wBAAwB,EACxB,6BAA6B,EAC7B,oCAAoC,EACrC,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAQxG,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC9B,IAAI,IAAI,QAAQ,EAChB,YAAY,IAAI,gBAAgB,EAChC,MAAM,IAAI,UAAU,EACpB,MAAM,IAAI,UAAU,EACpB,OAAO,IAAI,WAAW,EACtB,YAAY,IAAI,gBAAgB,EACjC,MAAM,SAAS,CAAC;AAIjB,KAAK,sBAAsB,GAAG,KAAK,OAAO,EAAE;IAC1C,mB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B,CAAC,EAAE,wBAAwB,CAAC;IACtD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE;QACvC,QAAQ,CAAC,KAAK,EAAE,OAAO,qBAAqB,EAAE,cAAc,CAAC;QAC7D,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;QAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,KAAK,SAAS,2BAA2B,EAAE,CAAC;CAC9C,GAAG,aAAa,CA+xBhB"}
@@ -1,6 +1,73 @@
1
1
  import type { AnnotationVisibility } from "supervision-js-core";
2
2
  import type { MediaRendererScene, MediaRendererSceneOptions } from "./media-renderer-scene";
3
3
  export declare function observePixiContainerResize(container: HTMLElement, resize: () => void): () => void;
4
+ type MediaCompositor = {
5
+ upload(frame: VideoFrame): void;
6
+ destroy(): void;
7
+ };
8
+ /** The binding a compositor points at whichever texture holds the last frame. */
9
+ export interface MediaGpuTextureSource {
10
+ resize(width: number, height: number, resolution: number): void;
11
+ updateGPUTexture(texture: GPUTexture): void;
12
+ }
13
+ export interface MediaCompositorOptions {
14
+ readonly device: GPUDevice;
15
+ readonly height: number;
16
+ readonly width: number;
17
+ /**
18
+ * Puts the compositor's first texture on screen and returns the binding every
19
+ * later texture replaces it through.
20
+ */
21
+ readonly attach: (texture: GPUTexture) => MediaGpuTextureSource;
22
+ /** Runs after a decode of a new size swapped the texture underneath. */
23
+ readonly onTextureReplaced: () => void;
24
+ }
25
+ /**
26
+ * Two ways to drive the same layer stack.
27
+ *
28
+ * Pull presentation is the default: the renderer asks the media source for the
29
+ * sample it wants, hands it to `presentSample`, and Pixi's ticker paints the
30
+ * scene every frame.
31
+ *
32
+ * Push presentation engages when the opened source carries a presented-frame
33
+ * channel. The producer then decides which frame is on screen and announces it,
34
+ * so the ticker paints nothing and every render is an explicit answer to a
35
+ * change: a presented frame, a layer turned on or off, restyling, hover or
36
+ * selection, a viewport move, a resize, or the swapchain coming back after the
37
+ * tab was hidden. A notification that describes what is already drawn renders
38
+ * nothing, so a paused scene nobody touches renders nothing at all.
39
+ *
40
+ * The focus layer's fade is not an exception to that. It advances with the
41
+ * presented media time, so it fades during playback and is applied at once when
42
+ * a hover or selection arrives with no frame behind it: paused focus is static,
43
+ * and no animation keeps the scene rendering on its own.
44
+ */
4
45
  export declare function createPixiMediaScene(options: MediaRendererSceneOptions): Promise<MediaRendererScene>;
5
46
  export declare function canReuseMaskVisibilityArtifacts(previous: AnnotationVisibility | undefined, next: AnnotationVisibility | undefined): boolean;
47
+ /**
48
+ * Copies presented frames into a GPU texture Pixi samples, with no CPU readback
49
+ * in between. A decode whose size changed gets a new texture, and the swap is
50
+ * all-or-nothing: exactly one of the two textures survives it.
51
+ */
52
+ export declare function createMediaCompositor(options: MediaCompositorOptions): MediaCompositor;
53
+ /**
54
+ * Whether this device's queue takes a decoded frame as a copy source.
55
+ *
56
+ * Chrome converts a VideoFrame. Firefox's converter accepts only ImageBitmap,
57
+ * HTMLImageElement, HTMLCanvasElement and OffscreenCanvas, and rejects the
58
+ * frame with a TypeError thrown from inside the present. The present abandons
59
+ * the steps after the upload, so the media sprite keeps a texture nothing ever
60
+ * wrote to while the redraw at the resting playhead keeps putting annotations
61
+ * over it: the scene then reads as a working library over a broken video,
62
+ * which is worse than an error. Answering here instead routes those frames
63
+ * through the staging canvas, which every non-WebGPU scene already uses.
64
+ *
65
+ * The answer is a property of the browser rather than of the decode, so it is
66
+ * asked once when the compositor is built and never per frame: a browser that
67
+ * takes the frame pays one one-pixel copy each time media is opened, and
68
+ * nothing at all while it plays.
69
+ */
70
+ export declare function acceptsVideoFrameUpload(device: GPUDevice): boolean;
71
+ export declare function resolvePixiResolution(maxDevicePixelRatio: number | undefined): number;
72
+ export {};
6
73
  //# sourceMappingURL=pixi-media-scene.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pixi-media-scene.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-media-scene.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EA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B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,qBAAqB,CAAC;IAChE,wEAAwE;IACxE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAmyE7B;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAC1C,IAAI,EAAE,oBAAoB,GAAG,SAAS,WAoBvC;AAmBD;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAC9B,eAAe,CAqDjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAgClE;AAmED,wBAAgB,qBAAqB,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,UAK5E"}
@@ -1,6 +1,6 @@
1
1
  import type { SerializableMaskInstruction } from "#render-preparation/mask-preparation-worker-protocol";
2
2
  import { type AnnotationStyleContext, type Detection, type DetectionFrame, type PolygonDrawInstruction, type PolygonStyle } from "supervision-js-core";
3
- import { createPixiMaskLayer, type PixiMaskLayer } from "./pixi-mask-layer";
3
+ import { createPixiMaskLayer, type BufferImageSourceConstructor, type PixiMaskLayer } from "./pixi-mask-layer";
4
4
  type PixiMaskLayerOptions = Parameters<typeof createPixiMaskLayer>[0];
5
5
  export interface PixiPolygonLayer {
6
6
  createDisplay(dimensions: {
@@ -8,13 +8,18 @@ export interface PixiPolygonLayer {
8
8
  readonly width: number;
9
9
  }): ReturnType<PixiMaskLayer["createSprite"]>;
10
10
  drawFrame(mediaTime: number, viewportScale?: number): void;
11
+ prepareFrame(mediaTime: number, viewportScale?: number): void;
12
+ clearFrame: PixiMaskLayer["clearFrame"];
13
+ isArtifactPrepared: PixiMaskLayer["isArtifactPrepared"];
11
14
  getVectorFallbackStyle(): PolygonStyle;
12
15
  setPolygonStyle(polygonStyle: PolygonStyle | null | undefined): void;
13
16
  setTimelineContext: PixiMaskLayer["setTimelineContext"];
14
17
  waitForRenderPreparation: PixiMaskLayer["waitForRenderPreparation"];
15
18
  destroy(): void;
16
19
  }
17
- export declare function createPixiPolygonLayer(options: Omit<PixiMaskLayerOptions, "artifactKind" | "maskStyle" | "resolveInstructions"> & {
20
+ export declare function createPixiPolygonLayer(options: Omit<PixiMaskLayerOptions, "BufferImageSource" | "artifactKind" | "maskStyle" | "resolveInstructions"> & {
21
+ /** Without it a frame that cooked to an id raster reaches no texture. */
22
+ readonly BufferImageSource: BufferImageSourceConstructor;
18
23
  readonly polygonStyle: PolygonStyle;
19
24
  readonly resolveContextState?: (detection: Detection) => Partial<AnnotationStyleContext>;
20
25
  }): PixiPolygonLayer;
@@ -1 +1 @@
1
- {"version":3,"file":"pixi-polygon-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-polygon-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAExG,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,UAAU,EAAE;QACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,GAAG,UAAU,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;IAC9C,SAAS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,CAAC,iBAAiB,EAAE,4BAA4B,CAAC;IACzD,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAC7B,SAAS,EAAE,SAAS,KACjB,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtC,GACA,gBAAgB,CAwGlB;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,sBAAsB,WAcpC;AAED,wBAAgB,kCAAkC,CAAC,OAAO,EAAE;IAC1D,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAC7B,SAAS,EAAE,SAAS,KACjB,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,GAAG,SAAS,2BAA2B,EAAE,CAkDzC"}
@@ -0,0 +1,91 @@
1
+ import type { PreparedRegionMaskCoverageEntry } from "#render-preparation/mask-frame-artifact";
2
+ import type { AlphaMask as PixiAlphaMask, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Shader as PixiShader, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
3
+ type RegionCoverageMaskMesh = PixiMesh<PixiMeshGeometry, PixiShader>;
4
+ type AlphaMaskConstructor = new (options: {
5
+ mask: RegionCoverageMaskMesh;
6
+ }) => PixiAlphaMask;
7
+ type ImageSourceConstructor = new (options: {
8
+ autoGenerateMipmaps?: boolean;
9
+ dynamic: boolean;
10
+ height: number;
11
+ resource: HTMLCanvasElement;
12
+ scaleMode?: "linear" | "nearest";
13
+ width: number;
14
+ }) => PixiImageSource;
15
+ type MeshConstructor = new (options: {
16
+ geometry: PixiMeshGeometry;
17
+ shader: PixiShader;
18
+ }) => RegionCoverageMaskMesh;
19
+ type MeshGeometryConstructor = new (options: {
20
+ indices: Uint32Array;
21
+ positions: Float32Array;
22
+ shrinkBuffersToFit: boolean;
23
+ topology: "triangle-list";
24
+ uvs: Float32Array;
25
+ }) => PixiMeshGeometry;
26
+ type ShaderFactory = {
27
+ from(options: {
28
+ gl: {
29
+ fragment: string;
30
+ vertex: string;
31
+ };
32
+ gpu: {
33
+ fragment: {
34
+ entryPoint: string;
35
+ source: string;
36
+ };
37
+ vertex: {
38
+ entryPoint: string;
39
+ source: string;
40
+ };
41
+ };
42
+ resources: Record<string, unknown>;
43
+ }): PixiShader;
44
+ };
45
+ type UniformGroupConstructor = new (uniforms: Record<string, {
46
+ type: "f32";
47
+ value: number;
48
+ } | {
49
+ type: "vec4<f32>";
50
+ value: Float32Array;
51
+ }>) => PixiUniformGroup;
52
+ export interface PixiRegionCoverageMaskArtifact {
53
+ readonly texture: PixiTexture;
54
+ }
55
+ export interface PixiRegionCoverageMask {
56
+ readonly display: RegionCoverageMaskMesh;
57
+ readonly effect: PixiAlphaMask;
58
+ render(options: {
59
+ readonly artifact: PixiRegionCoverageMaskArtifact;
60
+ readonly coverage: PreparedRegionMaskCoverageEntry;
61
+ readonly crop: {
62
+ readonly height: number;
63
+ readonly width: number;
64
+ readonly x: number;
65
+ readonly y: number;
66
+ };
67
+ readonly flipHorizontal: boolean;
68
+ readonly flipVertical: boolean;
69
+ readonly height: number;
70
+ readonly rotation: number;
71
+ readonly width: number;
72
+ readonly x: number;
73
+ readonly y: number;
74
+ }): void;
75
+ destroy(): void;
76
+ }
77
+ /**
78
+ * Produces a per-detection alpha mask from a compact prepared coverage crop.
79
+ * The crop is sampled and transformed entirely on the GPU; semantic RLE masks
80
+ * never enter the playback hot path.
81
+ */
82
+ export declare function createPixiRegionCoverageMask(options: {
83
+ readonly AlphaMask: AlphaMaskConstructor;
84
+ readonly ImageSource: ImageSourceConstructor;
85
+ readonly Mesh: MeshConstructor;
86
+ readonly MeshGeometry: MeshGeometryConstructor;
87
+ readonly Shader: ShaderFactory;
88
+ readonly UniformGroup: UniformGroupConstructor;
89
+ }): PixiRegionCoverageMask;
90
+ export {};
91
+ //# sourceMappingURL=pixi-region-coverage-mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-region-coverage-mask.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-region-coverage-mask.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC9B,IAAI,IAAI,QAAQ,EAChB,YAAY,IAAI,gBAAgB,EAChC,MAAM,IAAI,UAAU,EACpB,OAAO,IAAI,WAAW,EACtB,YAAY,IAAI,gBAAgB,EACjC,MAAM,SAAS,CAAC;AAEjB,KAAK,sBAAsB,GAAG,QAAQ,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAErE,KAAK,oBAAoB,GAAG,KAAK,OAAO,EAAE;IACxC,IAAI,EAAE,sBAAsB,CAAC;CAC9B,KAAK,aAAa,CAAC;AAEpB,KAAK,sBAAsB,GAAG,KAAK,OAAO,EAAE;IAC1C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf,KAAK,eAAe,CAAC;AAEtB,KAAK,eAAe,GAAG,KAAK,OAAO,EAAE;IACnC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;CACpB,KAAK,sBAAsB,CAAC;AAE7B,KAAK,uBAAuB,GAAG,KAAK,OAAO,E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,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;YACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YACvB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;YACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC;QACF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;QACjC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACpD,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,uBAAuB,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,uBAAuB,CAAC;CAChD,GAAG,sBAAsB,CA8GzB"}
@@ -0,0 +1,42 @@
1
+ import { type RegionRendererMediaEffect } from "supervision-js-core";
2
+ import type { Filter as PixiFilterClass } from "pixi.js";
3
+ type PixiFilter = {
4
+ destroy?(): void;
5
+ padding?: number;
6
+ };
7
+ type PixiFilterDisplay = {
8
+ filters?: readonly PixiFilter[] | null;
9
+ };
10
+ type BlurFilterConstructor = new (options: {
11
+ kernelSize?: number;
12
+ quality?: number;
13
+ repeatEdgePixels?: boolean;
14
+ strength?: number;
15
+ }) => PixiFilter;
16
+ type FilterFactory = Pick<typeof PixiFilterClass, "from">;
17
+ export interface PixiRegionEffect {
18
+ /**
19
+ * Applies the effect at the current media-to-viewport scale.
20
+ *
21
+ * Public effect sizes are expressed in media pixels, while Pixi evaluates a
22
+ * filter over the scaled display texture. Rebuild only when that scale
23
+ * changes so the filter's rendered-pixel inputs remain semantically stable.
24
+ */
25
+ apply(display: PixiFilterDisplay, viewportScale?: number): void;
26
+ destroy(): void;
27
+ }
28
+ /**
29
+ * Creates one filter for one pooled region display.
30
+ *
31
+ * The public descriptor stays semantic. This browser-only primitive owns the
32
+ * Pixi filter and is deliberately kept beneath the region layer so no filter,
33
+ * shader, texture, or render target appears in the package API.
34
+ */
35
+ export declare function createPixiRegionEffect(options: {
36
+ readonly BlurFilter?: BlurFilterConstructor;
37
+ readonly defaultFilterVert?: string;
38
+ readonly Filter?: FilterFactory;
39
+ readonly effect: RegionRendererMediaEffect;
40
+ }): PixiRegionEffect | undefined;
41
+ export {};
42
+ //# sourceMappingURL=pixi-region-effect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-region-effect.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-region-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAAC;CACxC,CAAC;AAEF,KAAK,qBAAqB,GAAG,KAAK,OAAO,EAAE;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KAAK,UAAU,CAAC;AAEjB,KAAK,aAAa,GAAG,IAAI,CAAC,OAAO,eAAe,EAAE,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,EAAE,iBAAiB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChE,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAC5C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;CAC5C,GAAG,gBAAgB,GAAG,SAAS,CAuD/B"}
@@ -1,6 +1,7 @@
1
1
  import type { AnnotationStyleContext, BufferedDetectionTimeline, Detection, RegionAnnotationRenderer } from "supervision-js-core";
2
- import type { Container as PixiContainer, Sprite as PixiSprite, Texture as PixiTexture } from "pixi.js";
2
+ import type { AlphaMask as PixiAlphaMask, BlurFilter as PixiBlurFilter, Container as PixiContainer, Filter as PixiFilter, Graphics as PixiGraphics, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Rectangle as PixiRectangle, Shader as PixiShader, Sprite as PixiSprite, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
3
3
  import type { GifSource as PixiGifSource, GifSprite as PixiGifSprite } from "pixi.js/gif";
4
+ import type { PixiActiveRegionMaskCoverage } from "./pixi-mask-layer";
4
5
  type RegionAsset = PixiTexture | PixiGifSource;
5
6
  interface RegionAssetLoader {
6
7
  load<T = RegionAsset>(src: string): Promise<T>;
@@ -16,8 +17,18 @@ export interface PixiRegionLayer {
16
17
  translateDetection(id: string | number, x: number, y: number): boolean;
17
18
  destroy(): void;
18
19
  }
19
- /** Browser implementation for asset-backed region renderer descriptors. */
20
+ /** Browser implementation for asset- and media-backed region descriptors. */
20
21
  export declare function createPixiRegionLayer(options: {
22
+ readonly AlphaMask: new (options: {
23
+ mask: PixiMesh<PixiMeshGeometry, PixiShader>;
24
+ }) => PixiAlphaMask;
25
+ readonly BlurFilter?: new (options: {
26
+ kernelSize?: number;
27
+ quality?: number;
28
+ repeatEdgePixels?: boolean;
29
+ strength?: number;
30
+ }) => PixiBlurFilter;
31
+ readonly defaultFilterVert?: string;
21
32
  readonly Assets: RegionAssetLoader;
22
33
  readonly Container: new () => PixiContainer;
23
34
  readonly GifSprite: new (options: {
@@ -25,10 +36,65 @@ export declare function createPixiRegionLayer(options: {
25
36
  readonly loop?: boolean;
26
37
  readonly source: PixiGifSource;
27
38
  }) => PixiGifSprite;
39
+ readonly Filter?: typeof PixiFilter;
40
+ readonly Graphics: new () => PixiGraphics;
41
+ readonly ImageSource: new (options: {
42
+ autoGenerateMipmaps?: boolean;
43
+ dynamic: boolean;
44
+ height: number;
45
+ resource: HTMLCanvasElement;
46
+ scaleMode?: "linear" | "nearest";
47
+ width: number;
48
+ }) => PixiImageSource;
49
+ readonly Mesh: new (options: {
50
+ geometry: PixiMeshGeometry;
51
+ shader: PixiShader;
52
+ }) => PixiMesh<PixiMeshGeometry, PixiShader>;
53
+ readonly MeshGeometry: new (options: {
54
+ indices: Uint32Array;
55
+ positions: Float32Array;
56
+ shrinkBuffersToFit: boolean;
57
+ topology: "triangle-list";
58
+ uvs: Float32Array;
59
+ }) => PixiMeshGeometry;
60
+ readonly Rectangle: new (x?: number, y?: number, width?: number, height?: number) => PixiRectangle;
28
61
  readonly Sprite: new (options: {
29
62
  texture: PixiTexture;
30
63
  }) => PixiSprite;
64
+ readonly Shader: {
65
+ from(options: {
66
+ gl: {
67
+ fragment: string;
68
+ vertex: string;
69
+ };
70
+ gpu: {
71
+ fragment: {
72
+ entryPoint: string;
73
+ source: string;
74
+ };
75
+ vertex: {
76
+ entryPoint: string;
77
+ source: string;
78
+ };
79
+ };
80
+ resources: Record<string, unknown>;
81
+ }): PixiShader;
82
+ };
83
+ readonly Texture: new (options: {
84
+ readonly dynamic?: boolean;
85
+ readonly frame?: PixiRectangle;
86
+ readonly source: PixiTexture["source"];
87
+ }) => PixiTexture;
88
+ readonly UniformGroup: new (uniforms: Record<string, {
89
+ type: "f32";
90
+ value: number;
91
+ } | {
92
+ type: "vec4<f32>";
93
+ value: Float32Array;
94
+ }>) => PixiUniformGroup;
31
95
  readonly detectionTimeline: BufferedDetectionTimeline;
96
+ readonly getActiveRegionMaskCoverage: (detectionFrameTime: number | null) => PixiActiveRegionMaskCoverage | null;
97
+ readonly getMediaTexture: () => PixiTexture | undefined;
32
98
  readonly onInvalidate?: () => void;
33
99
  readonly onAssetError?: (options: {
34
100
  readonly error: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"pixi-region-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-region-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EACzB,SAAS,EAGT,wBAAwB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,MAAM,IAAI,UAAU,EACpB,OAAO,IAAI,WAAW,EACvB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC3B,MAAM,aAAa,CAAC;AAErB,KAAK,WAAW,GAAG,WAAW,GAAG,aAAa,CAAC;AAG/C,UAAU,iBAAiB;IACzB,IAAI,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAwBD,MAAM,WAAW,oBAAoB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C,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACvE,SAAS,CAAC,MAAM,EAAE;QAChB,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;QACnC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;QACrC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;QACrC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;KAChC,GAAG,IAAI,CAAC;IACT,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,QAAQ,CAAC,SAAS,EAAE,UAAU,aAAa,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,UAAU,YAAY,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IACtD,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAC7B,SAAS,EAAE,SAAS,KACjB,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtC,GAAG,eAAe,CAoPlB;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,uBAAuB,EACpC,aAAa,EAAE,MAAM,QAoDtB"}
@@ -0,0 +1,47 @@
1
+ import type { RenderPreparationOptions } from "#types/render-preparation";
2
+ import type { BufferedDetectionTimeline, DetectionFrame } from "supervision-js-core";
3
+ /** One frame of the window, and whether every enabled layer's data for it is cooked. */
4
+ export interface PreparedAnnotationWindowFrame {
5
+ readonly frameIndex: number | null;
6
+ readonly mediaTime: number;
7
+ readonly prepared: boolean;
8
+ }
9
+ export interface PreparedAnnotationWindowSnapshot {
10
+ readonly frames: readonly PreparedAnnotationWindowFrame[];
11
+ readonly playheadMediaTime: number;
12
+ readonly playheadPrepared: boolean;
13
+ readonly preparedFrameCount: number;
14
+ /** Frames ahead of the playhead the cooks aim to cover. */
15
+ readonly spanFrameCount: number;
16
+ }
17
+ /** A layer that cooks per-frame data ahead of the playhead. */
18
+ export interface PreparedAnnotationLayer {
19
+ isArtifactPrepared(mediaTime: number): boolean;
20
+ }
21
+ export interface PreparedAnnotationWindow {
22
+ /**
23
+ * The detection frame a media time may draw, or null where the timeline holds
24
+ * none. A layer still cooking its artifact for that frame skips its own draw;
25
+ * it does not withhold the frame from the layers with nothing to cook.
26
+ */
27
+ getPreparedFrame(mediaTime: number): DetectionFrame | null;
28
+ /**
29
+ * What a draw of a media time would find: its frame and each layer's cook. A
30
+ * caller holding the token of what is on screen knows a redraw would change
31
+ * it, which is how a cook that lands late reaches the screen at all.
32
+ */
33
+ getReadinessToken(mediaTime: number): string;
34
+ getSnapshot(): PreparedAnnotationWindowSnapshot;
35
+ }
36
+ /**
37
+ * Which frame a media time draws and how much of it is cooked, as two separate
38
+ * facts. Reporting readiness is what the snapshot and the token are for; a
39
+ * layer owing an artifact costs that layer its draw, not the whole frame.
40
+ */
41
+ export declare function createPreparedAnnotationWindow(options: {
42
+ readonly detectionTimeline: BufferedDetectionTimeline;
43
+ readonly getLayers: () => readonly PreparedAnnotationLayer[];
44
+ readonly getPlayheadMediaTime: () => number;
45
+ readonly renderPreparation?: RenderPreparationOptions;
46
+ }): PreparedAnnotationWindow;
47
+ //# sourceMappingURL=prepared-annotation-window.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepared-annotation-window.d.ts","sourceRoot":"","sources":["../../src/renderers/prepared-annotation-window.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EACV,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