#[non_exhaustive]pub struct Animation {
pub frame_count: u32,
pub loop_count: u32,
pub frame_durations_ms: Vec<u32>,
}Expand description
How an animated image plays: its frames and their timing.
Reported by Decoder::animation for a file with more than one frame.
The pipeline processes the first frame; this describes the source, so a
caller can see it is animated and decide what to do (pass it through,
refuse it, or take the still).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.frame_count: u32Frames in the animation, always two or more.
loop_count: u32How many times it plays; 0 means forever, as in GIF and WebP.
frame_durations_ms: Vec<u32>How long each frame shows, in milliseconds, in order.
Implementations§
Source§impl Animation
impl Animation
Sourcepub fn new(frame_durations_ms: Vec<u32>, loop_count: u32) -> Option<Self>
pub fn new(frame_durations_ms: Vec<u32>, loop_count: u32) -> Option<Self>
An animation of the given frame durations, playing loop_count
times (0 for forever). None for fewer than two frames, which is a
still image.
Sourcepub fn duration_ms(&self) -> u64
pub fn duration_ms(&self) -> u64
The total time one play-through takes, in milliseconds.
Trait Implementations§
impl Eq for Animation
impl StructuralPartialEq for Animation
Auto Trait Implementations§
impl Freeze for Animation
impl RefUnwindSafe for Animation
impl Send for Animation
impl Sync for Animation
impl Unpin for Animation
impl UnsafeUnpin 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