pub struct Animation { /* private fields */ }Expand description
Represents an animation with multiple frames.
The Animation struct is designed to store and manage data for animated sequences such as those from animated formats (e.g., GIF, AVIF, APNG, WebP).
It provides support for looping, background color settings, frame timing, and frame storage.
Implementations§
Source§impl Animation
impl Animation
Sourcepub fn new(loop_count: i32, bg_color: Scalar) -> Result<Animation>
pub fn new(loop_count: i32, bg_color: Scalar) -> Result<Animation>
Constructs an Animation object with optional loop count and background color.
§Parameters
- loopCount: An integer representing the number of times the animation should loop:
0(default) indicates infinite looping, meaning the animation will replay continuously.- Positive values denote finite repeat counts, allowing the animation to play a limited number of times.
- If a negative value or a value beyond the maximum of
0xffff(65535) is provided, it is reset to0(infinite looping) to maintain valid bounds.
- bgColor: A
Scalarobject representing the background color in BGR format:
- Defaults to
Scalar(), indicating an empty color (usually transparent if supported). - This background color provides a solid fill behind frames that have transparency, ensuring a consistent display appearance.
§C++ default parameters
- loop_count: 0
- bg_color: Scalar()
Sourcepub fn new_def() -> Result<Animation>
pub fn new_def() -> Result<Animation>
Constructs an Animation object with optional loop count and background color.
§Parameters
- loopCount: An integer representing the number of times the animation should loop:
0(default) indicates infinite looping, meaning the animation will replay continuously.- Positive values denote finite repeat counts, allowing the animation to play a limited number of times.
- If a negative value or a value beyond the maximum of
0xffff(65535) is provided, it is reset to0(infinite looping) to maintain valid bounds.
- bgColor: A
Scalarobject representing the background color in BGR format:
- Defaults to
Scalar(), indicating an empty color (usually transparent if supported). - This background color provides a solid fill behind frames that have transparency, ensuring a consistent display appearance.
§Note
This alternative version of [new] function uses the following default values for its arguments:
- loop_count: 0
- bg_color: Scalar()
Trait Implementations§
Source§impl AnimationTrait for Animation
impl AnimationTrait for Animation
fn as_raw_mut_Animation(&mut self) -> *mut c_void
Source§fn set_loop_count(&mut self, val: i32)
fn set_loop_count(&mut self, val: i32)
Number of times the animation should loop. 0 means infinite looping. Read more
Source§fn set_bgcolor(&mut self, val: Scalar)
fn set_bgcolor(&mut self, val: Scalar)
Background color of the animation in BGRA format.
Source§fn set_durations(&mut self, val: Vector<i32>)
fn set_durations(&mut self, val: Vector<i32>)
Duration for each frame in milliseconds. Read more
Source§fn set_frames(&mut self, val: Vector<Mat>)
fn set_frames(&mut self, val: Vector<Mat>)
Vector of frames, where each Mat represents a single frame.
Source§fn set_still_image(&mut self, val: Mat)
fn set_still_image(&mut self, val: Mat)
image that can be used for the format in addition to the animation or if animation is not supported in the reader (like in PNG).
Source§impl AnimationTraitConst for Animation
impl AnimationTraitConst for Animation
fn as_raw_Animation(&self) -> *const c_void
Source§fn loop_count(&self) -> i32
fn loop_count(&self) -> i32
Number of times the animation should loop. 0 means infinite looping. Read more
Source§fn still_image(&self) -> Mat
fn still_image(&self) -> Mat
image that can be used for the format in addition to the animation or if animation is not supported in the reader (like in PNG).
Source§impl Boxed for Animation
impl Boxed for Animation
Source§unsafe fn from_raw(ptr: <Animation as OpenCVFromExtern>::ExternReceive) -> Self
unsafe fn from_raw(ptr: <Animation as OpenCVFromExtern>::ExternReceive) -> Self
Wrap the specified raw pointer Read more
Source§fn into_raw(self) -> <Animation as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <Animation as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying raw pointer while consuming this wrapper. Read more
Source§fn as_raw(&self) -> <Animation as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <Animation as OpenCVTypeExternContainer>::ExternSend
Return the underlying raw pointer. Read more
Source§fn as_raw_mut(
&mut self,
) -> <Animation as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <Animation as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying mutable raw pointer Read more
impl Send for Animation
Auto Trait Implementations§
impl Freeze for Animation
impl RefUnwindSafe for Animation
impl !Sync for Animation
impl Unpin for Animation
impl UnwindSafe for Animation
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Helper function to call OpenCV functions that allow in-place modification of a
Mat or another similar object. By passing
a mutable reference to the Mat to this function your closure will get called with the read reference and a write references
to the same Mat. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold. Read more