pub struct AnimationDecoder { /* private fields */ }Expand description
Stateful decoder for exactly one stored animation sequence.
Implementations§
Source§impl AnimationDecoder
impl AnimationDecoder
Sourcepub fn new(input: &[u8], limits: DecodeLimits) -> Result<Self, DecodeError>
pub fn new(input: &[u8], limits: DecodeLimits) -> Result<Self, DecodeError>
Creates a decoder for one stored animated WebP sequence.
The input bytes are copied so the returned decoder owns the data needed by libwebp. Frames are returned as composited, full-canvas RGBA buffers. The decoder does not replay the sequence according to its loop count.
Sourcepub fn info(&self) -> &AnimationInfo
pub fn info(&self) -> &AnimationInfo
Returns metadata for the stored animation sequence.
Sourcepub fn frame_durations(&self) -> Result<Vec<Duration>, DecodeError>
pub fn frame_durations(&self) -> Result<Vec<Duration>, DecodeError>
Returns one source display duration per stored frame, in frame order.
This reads animation-container metadata only: it does not decode RGBA pixels or advance the sequential decoder. The configured total-duration limit is applied and may cause this method to return an error.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets this decoder to the first frame of its stored animation sequence.
The decoder, input allocation, immutable metadata, and configured limits
are preserved; only libwebp’s sequence state and this wrapper’s timing
accumulator are reset.
This is a sequence reset, not a random-seek operation; the next
Self::next_frame call starts at the first stored frame.
Sourcepub fn has_more_frames(&self) -> bool
pub fn has_more_frames(&self) -> bool
Returns whether unread frames remain in the stored sequence.
Sourcepub fn next_frame(&mut self) -> Result<Option<AnimationFrame>, DecodeError>
pub fn next_frame(&mut self) -> Result<Option<AnimationFrame>, DecodeError>
Returns None only after every frame in the stored sequence was read.