Skip to main content

DetectionOverlay

Struct DetectionOverlay 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub fn mark_consumed(&mut self, completion: &Event) -> Result<()>

Pin completion on the active slot so its records cannot be overwritten until the consuming frame completes.

§Errors

Returns an error when completion does not belong to the owning runtime.

Source

pub const fn count(&self) -> u32

Return the number of records written by the last update.

Auto Trait Implementations§

§

impl !RefUnwindSafe for DetectionOverlay

§

impl !Send for DetectionOverlay

§

impl !Sync for DetectionOverlay

§

impl !UnwindSafe for DetectionOverlay

§

impl Forget for DetectionOverlay

§

impl Freeze for DetectionOverlay
where *const u8 is !null: Freeze, PhantomData<OverlaySlot>: Freeze,

§

impl Move for DetectionOverlay

§

impl Unpin for DetectionOverlay
where *const u8 is !null: Unpin, Rc<RefCell<RuntimeState>>: Unpin, Rc<StorageInner>: Unpin, Rc<MatrixSemantic>: Unpin, Rc<()>: Unpin, Arc<Device>: Unpin, Arc<RetirementCompletion>: Unpin, Arc<WorkerControl>: Unpin, Arc<TimestampPairInner>: Unpin, Arc<Mutex<Vec<Arc<DecodeStatus>>>>: Unpin, Arc<Mutex<Vec<Arc<EncodeReceipt>>>>: Unpin,

§

impl UnsafeUnpin for DetectionOverlay
where *const u8 is !null: UnsafeUnpin, PhantomData<OverlaySlot>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.