pub struct OverlayState { /* private fields */ }Expand description
The watermark’s uploaded pixels plus its current placement and bounce state, kept across frames so a moving (bouncing) watermark can be advanced and re-placed each tick without re-reading or re-uploading the image.
Implementations§
Source§impl OverlayState
impl OverlayState
Sourcepub fn load_watermark(&mut self, path: &str, output_scale: f64)
pub fn load_watermark(&mut self, path: &str, output_scale: f64)
Load the watermark image from disk; output_scale is the output’s fractional
scale, ceiled to the integer buffer scale of the upload. A failed load clears the overlay.
Sourcepub fn blend_bgra(
&self,
frame: &mut [u8],
stride: usize,
frame_w: i32,
frame_h: i32,
)
pub fn blend_bgra( &self, frame: &mut [u8], stride: usize, frame_w: i32, frame_h: i32, )
Alpha-blend the watermark into a BGRA frame (row stride in bytes) at its
current position. Clips per pixel at the frame bounds because the animated
position — or a watermark larger than the capture — can leave part of the
image off-frame, and only the in-frame portion may be written.
Sourcepub fn damage_rect(
&self,
frame_w: i32,
frame_h: i32,
) -> Option<Rectangle<i32, Physical>>
pub fn damage_rect( &self, frame_w: i32, frame_h: i32, ) -> Option<Rectangle<i32, Physical>>
Frame-clipped union of the watermark’s current and previous rectangles — the region a damage-gated encoder must repaint after a bounce step moved the image (the vacated area needs repainting as much as the new one).
Sourcepub fn is_animated(&self) -> bool
pub fn is_animated(&self) -> bool
True when the watermark moves and must be re-rendered every frame.
Sourcepub fn update_position(
&mut self,
frame_width: i32,
frame_height: i32,
loc_enum: i32,
)
pub fn update_position( &mut self, frame_width: i32, frame_height: i32, loc_enum: i32, )
Place the watermark for the current frame size. Fixed anchors (corners / middle) are
pure geometry, but the AN anchor makes the watermark bounce, so each call also advances
that animation one step and reflects it off the frame edges — which is precisely why an AN
watermark has to be re-rendered every frame (see is_animated). loc_enum is the i32 form
of WatermarkLocation.
Sourcepub fn get_watermark_element<R>(
&self,
renderer: &mut R,
) -> Option<MemoryRenderBufferRenderElement<R>>
pub fn get_watermark_element<R>( &self, renderer: &mut R, ) -> Option<MemoryRenderBufferRenderElement<R>>
Render element for the watermark; None when no watermark is loaded.
Sourcepub fn get_cursor_element<R>(
&self,
renderer: &mut R,
image: Image,
pos: Point<f64, Logical>,
scale: f64,
) -> Option<MemoryRenderBufferRenderElement<R>>
pub fn get_cursor_element<R>( &self, renderer: &mut R, image: Image, pos: Point<f64, Logical>, scale: f64, ) -> Option<MemoryRenderBufferRenderElement<R>>
Render element for a software cursor image at logical pos on an output with
fractional scale; the position converts to physical here so the composited cursor
lands where the damage tracker and clients (which work in physical pixels) expect it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OverlayState
impl RefUnwindSafe for OverlayState
impl Send for OverlayState
impl Sync for OverlayState
impl Unpin for OverlayState
impl UnsafeUnpin for OverlayState
impl UnwindSafe for OverlayState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().