#[non_exhaustive]pub struct AnimationFrame<'a> { /* private fields */ }Expand description
A composited full-canvas animation frame, borrowing the decoder’s canvas.
Returned by AnimationFrameDecoder::render_next_frame().
The pixel data borrows the decoder’s internal canvas buffer — calling
render_next_frame() again invalidates this borrow.
Use to_owned_frame() to copy the pixel data
if you need to retain the frame across calls.
Implementations§
Source§impl<'a> AnimationFrame<'a>
impl<'a> AnimationFrame<'a>
Sourcepub fn new(pixels: PixelSlice<'a>, duration_ms: u32, frame_index: u32) -> Self
pub fn new(pixels: PixelSlice<'a>, duration_ms: u32, frame_index: u32) -> Self
Create a full frame borrowing pixel data.
Sourcepub fn pixels(&self) -> &PixelSlice<'a>
pub fn pixels(&self) -> &PixelSlice<'a>
Borrow the composited pixel data.
Sourcepub fn duration_ms(&self) -> u32
pub fn duration_ms(&self) -> u32
Frame duration in milliseconds.
Zero means platform-dependent minimum display time for most formats.
For JXL, zero-duration frames are compositing helpers and are never
yielded by AnimationFrameDecoder.
Sourcepub fn frame_index(&self) -> u32
pub fn frame_index(&self) -> u32
Displayed frame index (0-based).
Counts only frames yielded by the decoder — internal compositing frames (e.g. JXL zero-duration) are not counted.
Sourcepub fn to_owned_frame(&self) -> OwnedAnimationFrame
pub fn to_owned_frame(&self) -> OwnedAnimationFrame
Copy pixel data to produce an owned frame.