pub struct GifStreamPlayer { /* private fields */ }Expand description
Stateful streaming GIF player with reusable composite canvas, bounded pre-decode cache, disposal-aware dirty tracking, and off-screen pause/resume.
Implementations§
Source§impl GifStreamPlayer
Reusable-canvas compositing, bounded pre-decode caching, disposal dirty reporting, and visibility pause/resume for GifStreamPlayer.
impl GifStreamPlayer
Reusable-canvas compositing, bounded pre-decode caching, disposal dirty reporting, and visibility pause/resume for GifStreamPlayer.
Sourcepub fn from_bytes_with_config(
bytes: &[u8],
config: GifDecodeConfig,
) -> Result<Self, String>
pub fn from_bytes_with_config( bytes: &[u8], config: GifDecodeConfig, ) -> Result<Self, String>
Sourcepub fn from_decoder(decoder: GifDecoder) -> Self
pub fn from_decoder(decoder: GifDecoder) -> Self
Sourcepub fn set_visible(&mut self, visible: bool)
pub fn set_visible(&mut self, visible: bool)
Updates viewport visibility, suspending pre-decoding and timing while off-screen and resuming cleanly per visibility_policy.
§Arguments
&Self- Mutable streaming GIF player.bool-truewhen the GIF is visible on screen,falsewhen off-screen or frozen.
Sourcepub fn step_ms(&mut self, dt_ms: u32) -> Result<Option<GifDecodedFrame>, String>
pub fn step_ms(&mut self, dt_ms: u32) -> Result<Option<GifDecodedFrame>, String>
Advances playback by dt_ms milliseconds when visible and playing, returning Some(GifDecodedFrame) whenever the active frame updates.
§Arguments
&Self- Mutable streaming GIF player.u32- Elapsed wall time in milliseconds.
§Returns
Result<Option<GifDecodedFrame>, String>- Newly active composited frame and dirty region, orNonewhen unchanged/paused/off-screen.
Sourcepub fn decode_frame(
&mut self,
target_index: usize,
) -> Result<GifDecodedFrame, String>
pub fn decode_frame( &mut self, target_index: usize, ) -> Result<GifDecodedFrame, String>
Returns the composited GifDecodedFrame for target_index, hitting the bounded cache when available or compositing sequentially on the reusable canvas.
§Arguments
&Self- Mutable streaming GIF player.usize- Zero-based frame index.
§Returns
Result<GifDecodedFrame, String>- Composited frame with disposal-aware dirty rectangle or decode error.
Source§impl GifStreamPlayer
impl GifStreamPlayer
pub fn get_decoder(&self) -> &GifDecoder
pub fn get_mut_decoder(&mut self) -> &mut GifDecoder
pub fn set_decoder(&mut self, val: GifDecoder) -> &mut Self
pub fn get_canvas(&self) -> &Vec<u8> ⓘ
pub fn get_mut_canvas(&mut self) -> &mut Vec<u8> ⓘ
pub fn set_canvas(&mut self, val: Vec<u8>) -> &mut Self
pub fn get_cache(&self) -> &VecDeque<GifDecodedFrame>
pub fn get_mut_cache(&mut self) -> &mut VecDeque<GifDecodedFrame>
pub fn set_cache(&mut self, val: VecDeque<GifDecodedFrame>) -> &mut Self
pub fn get_cache_bytes(&self) -> usize
pub fn get_mut_cache_bytes(&mut self) -> &mut usize
pub fn set_cache_bytes(&mut self, val: usize) -> &mut Self
pub fn get_mut_last_composited_index(&mut self) -> &mut Option<usize>
pub fn set_last_composited_index(&mut self, val: Option<usize>) -> &mut Self
pub fn get_mut_pending_disposal_rect(&mut self) -> &mut Option<GifDirtyRect>
pub fn set_pending_disposal_rect( &mut self, val: Option<GifDirtyRect>, ) -> &mut Self
pub fn get_pending_disposal(&self) -> GifDisposalMethod
pub fn get_mut_pending_disposal(&mut self) -> &mut GifDisposalMethod
pub fn set_pending_disposal(&mut self, val: GifDisposalMethod) -> &mut Self
pub fn get_current_frame(&self) -> usize
pub fn get_mut_current_frame(&mut self) -> &mut usize
pub fn set_current_frame(&mut self, val: usize) -> &mut Self
pub fn get_elapsed_ms(&self) -> u32
pub fn get_mut_elapsed_ms(&mut self) -> &mut u32
pub fn set_elapsed_ms(&mut self, val: u32) -> &mut Self
pub fn get_completed_loops(&self) -> u32
pub fn get_mut_completed_loops(&mut self) -> &mut u32
pub fn set_completed_loops(&mut self, val: u32) -> &mut Self
pub fn get_visible(&self) -> bool
pub fn get_mut_visible(&mut self) -> &mut bool
pub fn get_visibility_policy(&self) -> GifVisibilityPolicy
pub fn get_mut_visibility_policy(&mut self) -> &mut GifVisibilityPolicy
pub fn set_visibility_policy(&mut self, val: GifVisibilityPolicy) -> &mut Self
pub fn get_status(&self) -> GifPlaybackStatus
pub fn get_mut_status(&mut self) -> &mut GifPlaybackStatus
pub fn set_status(&mut self, val: GifPlaybackStatus) -> &mut Self
pub fn get_last_dirty_rect(&self) -> GifDirtyRect
pub fn get_mut_last_dirty_rect(&mut self) -> &mut GifDirtyRect
pub fn set_last_dirty_rect(&mut self, val: GifDirtyRect) -> &mut Self
pub fn get_cache_hits(&self) -> u64
pub fn get_mut_cache_hits(&mut self) -> &mut u64
pub fn set_cache_hits(&mut self, val: u64) -> &mut Self
pub fn get_decode_count(&self) -> u64
pub fn get_mut_decode_count(&mut self) -> &mut u64
pub fn set_decode_count(&mut self, val: u64) -> &mut Self
Trait Implementations§
Source§impl Clone for GifStreamPlayer
impl Clone for GifStreamPlayer
Source§impl Debug for GifStreamPlayer
impl Debug for GifStreamPlayer
Auto Trait Implementations§
impl Forget for GifStreamPlayer
impl Freeze for GifStreamPlayerwhere
*const ArcInner<[u8]> is !null: Freeze,
PhantomData<ArcInner<[u8]>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<[u8; 3]>: Freeze,
PhantomData<GifFrameDescriptor>: Freeze,
PhantomData<GifDecodedFrame>: Freeze,
impl Move for GifStreamPlayer
impl RefUnwindSafe for GifStreamPlayer
impl Send for GifStreamPlayer
impl Sync for GifStreamPlayer
impl Unpin for GifStreamPlayer
impl UnsafeUnpin for GifStreamPlayerwhere
*const ArcInner<[u8]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[u8]>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<[u8; 3]>: UnsafeUnpin,
PhantomData<GifFrameDescriptor>: UnsafeUnpin,
PhantomData<GifDecodedFrame>: UnsafeUnpin,
impl UnwindSafe for GifStreamPlayer
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