pub struct AnimatedImageAsset { /* private fields */ }Expand description
Fully composed immutable GIF/APNG frames and half-open display intervals. Up to 4096 frames, 24 hours and 256 MiB mip data; no seek cursor.
Implementations§
Source§impl AnimatedImageAsset
impl AnimatedImageAsset
Sourcepub fn from_frames(
frames: Vec<(Arc<ImageAsset>, Duration)>,
) -> Result<Self, ValidationError>
pub fn from_frames( frames: Vec<(Arc<ImageAsset>, Duration)>, ) -> Result<Self, ValidationError>
Freezes explicitly timed equal-sized images. Zero durations are instantaneous and never selected inside the cycle; total duration must be positive.
Sourcepub fn from_sequence(
frames: Vec<Arc<ImageAsset>>,
rate: FrameRate,
) -> Result<Self, ValidationError>
pub fn from_sequence( frames: Vec<Arc<ImageAsset>>, rate: FrameRate, ) -> Result<Self, ValidationError>
Creates a uniform sequence using independent rational frame boundaries.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Decodes GIF/APNG using library disposal/blend rules. Delays round once to nearest ticks; no browser-specific minimum display delay is invented.
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Explicit bounded local-file loading; rendering never reopens the source.
Sourcepub fn frames(&self) -> &[Arc<ImageAsset>]
pub fn frames(&self) -> &[Arc<ImageAsset>]
Immutable original composed frames.
Sourcepub fn duration(&self) -> Duration
pub fn duration(&self) -> Duration
One cycle’s actual rounded duration, not a video-frame count.
Sourcepub fn file_plays(&self) -> Option<u32>
pub fn file_plays(&self) -> Option<u32>
File-declared play count; None means indefinite repetition.
Sourcepub fn frame_duration(&self, index: usize) -> Option<Duration>
pub fn frame_duration(&self, index: usize) -> Option<Duration>
Original individual frame duration in ticks.
Sourcepub fn frame_index_at(&self, time: Time, mode: ImageLoopMode) -> Option<usize>
pub fn frame_index_at(&self, time: Time, mode: ImageLoopMode) -> Option<usize>
Negative time is absent; finite play holds the last frame afterwards.
Sourcepub fn frame_at(
&self,
time: Time,
mode: ImageLoopMode,
) -> Option<&Arc<ImageAsset>>
pub fn frame_at( &self, time: Time, mode: ImageLoopMode, ) -> Option<&Arc<ImageAsset>>
Samples without I/O, allocation, decoding or state mutation.