pub struct AnimatedImage {
pub width: u32,
pub height: u32,
/* private fields */
}Fields§
§width: u32§height: u32Implementations§
Source§impl AnimatedImage
impl AnimatedImage
Sourcepub fn decode(path: &Path) -> Result<Option<Self>>
pub fn decode(path: &Path) -> Result<Option<Self>>
Parses path’s GIF header for timing metadata without decoding any
pixels. Returns Ok(None) when the file is not a GIF so callers can
keep their existing static-image path.
Sourcepub fn first_frame(&mut self) -> &[u8] ⓘ
pub fn first_frame(&mut self) -> &[u8] ⓘ
RGBA8 bytes of the first frame, used as the transition’s incoming image.
pub fn frame_at(&mut self, index: usize) -> &[u8] ⓘ
Sourcepub fn decompress_into(&mut self, index: usize, out: &mut [u8]) -> bool
pub fn decompress_into(&mut self, index: usize, out: &mut [u8]) -> bool
Decompresses the frame at index directly into out (which must be
exactly width * height * 4 bytes), skipping the shared scratch
buffer. Returns false when the frame is not cached yet.
Sourcepub fn frame_index_at(&self, elapsed: Duration) -> usize
pub fn frame_index_at(&self, elapsed: Duration) -> usize
Index of the frame to display at elapsed time, looping forever.
Sourcepub fn frame_start(&self, index: usize) -> Duration
pub fn frame_start(&self, index: usize) -> Duration
Cumulative time at which frame index begins. For index == len this
equals the total duration (the next wrap back to frame 0).
pub fn frame_count(&self) -> usize
pub fn cache_bytes(&self) -> usize
pub fn raw_cached(&self) -> usize
pub fn zstd_cached(&self) -> usize
pub fn total_duration(&self) -> Duration
Auto Trait Implementations§
impl !RefUnwindSafe for AnimatedImage
impl !Sync for AnimatedImage
impl !UnwindSafe for AnimatedImage
impl Freeze for AnimatedImage
impl Send for AnimatedImage
impl Unpin for AnimatedImage
impl UnsafeUnpin for AnimatedImage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.