pub struct DetectionOverlay { /* private fields */ }Expand description
Ring-buffered detection box and label overlay.
Constructed by DetectionOverlay::create; records are uploaded through
the non-blocking DetectionOverlay::update, composed into a Ui frame
through DetectionOverlay::draw, and released back for overwrite through
DetectionOverlay::mark_consumed.
Implementations§
Source§impl DetectionOverlay
impl DetectionOverlay
Sourcepub fn create(runtime: &Runtime, config: DetectionOverlayConfig) -> Result<Self>
pub fn create(runtime: &Runtime, config: DetectionOverlayConfig) -> Result<Self>
Allocate the three-slot detection and glyph upload ring.
§Errors
Returns an error when either capacity is zero or allocation fails.
Sourcepub fn update(
&mut self,
items: &[DetectionOverlayItem],
atlas: &TextAtlas,
) -> Result<()>
pub fn update( &mut self, items: &[DetectionOverlayItem], atlas: &TextAtlas, ) -> Result<()>
Upload items into the first ready ring slot without blocking.
Non-finite detection geometry is rejected and zero-extent boxes are
skipped; remaining fields are clamped to [0, 1] and a zero
color_rgba receives the configured box color.
§Errors
Returns an error when items exceeds max_detections, shaped labels
exceed max_glyphs, geometry is non-finite, or all three upload slots
are still consumed by in-flight frames.
Sourcepub fn draw(
&self,
ui: &mut Ui<'_>,
destination: PixelRect,
clip: PixelRect,
) -> Result<()>
pub fn draw( &self, ui: &mut Ui<'_>, destination: PixelRect, clip: PixelRect, ) -> Result<()>
Emit the active slot’s box outlines and glyph batch into ui through
its shared coverage atlas.
destination maps normalized source-image geometry into the compose
image; clip bounds rasterization.