pub struct GifDecoder { /* private fields */ }Expand description
Pure-Rust GIF87a/GIF89a container parser and indexed LZW frame decoder.
Implementations§
Source§impl GifDecoder
GIF87a/GIF89a container parsing and true LZW pixel decompression for GifDecoder.
impl GifDecoder
GIF87a/GIF89a container parsing and true LZW pixel decompression for GifDecoder.
Sourcepub fn parse_with_config(
bytes: &[u8],
config: GifDecodeConfig,
) -> Result<Self, String>
pub fn parse_with_config( bytes: &[u8], config: GifDecodeConfig, ) -> Result<Self, String>
Sourcepub fn normalize_delay_ms(delay_cs: u16, config: &GifDecodeConfig) -> u32
pub fn normalize_delay_ms(delay_cs: u16, config: &GifDecodeConfig) -> u32
Sourcepub fn decode_lzw_subblocks(
subblocks: &[u8],
min_code_size: u8,
expected_pixels: usize,
out_indices: &mut Vec<u8>,
) -> Result<(), String>
pub fn decode_lzw_subblocks( subblocks: &[u8], min_code_size: u8, expected_pixels: usize, out_indices: &mut Vec<u8>, ) -> Result<(), String>
Decompresses variable-width GIF LZW sub-blocks directly into out_indices without copying sub-blocks.
§Arguments
&[u8]- Raw sub-block byte slice starting at the first sub-block length byte.u8- Initial LZW minimum code size (2..=8).usize- Expected pixel index count (frame_width * frame_height).&mut Vec<u8>- Reusable destination palette-index vector cleared and populated in place.
§Returns
Result<(), String>-Ok(())on exact decompression, orErron corrupt/truncated LZW data.
Sourcepub fn deinterlace_row(src_row: usize, height: usize) -> usize
pub fn deinterlace_row(src_row: usize, height: usize) -> usize
Sourcepub fn lookup_rgb(&self, desc: &GifFrameDescriptor, color_idx: u8) -> [u8; 3]
pub fn lookup_rgb(&self, desc: &GifFrameDescriptor, color_idx: u8) -> [u8; 3]
Resolves RGB color for palette index color_idx against the frame’s Local Color Table or fallback Global Color Table.
§Arguments
&Self- GIF decoder reference.&GifFrameDescriptor- Active frame descriptor.u8- Palette index.
§Returns
[u8; 3]- Resolved[r, g, b]color triplet ([0, 0, 0]if out of palette bounds).
Sourcepub fn decode_all_animation(&self, title: &str) -> Result<GifAnimation, String>
pub fn decode_all_animation(&self, title: &str) -> Result<GifAnimation, String>
Source§impl GifDecoder
impl GifDecoder
pub fn get_version(&self) -> &String
pub fn get_mut_version(&mut self) -> &mut String
pub fn set_version(&mut self, val: String) -> &mut Self
pub fn get_logical_width(&self) -> u16
pub fn get_mut_logical_width(&mut self) -> &mut u16
pub fn set_logical_width(&mut self, val: u16) -> &mut Self
pub fn get_logical_height(&self) -> u16
pub fn get_mut_logical_height(&mut self) -> &mut u16
pub fn set_logical_height(&mut self, val: u16) -> &mut Self
pub fn get_background_color_index(&self) -> u8
pub fn get_mut_background_color_index(&mut self) -> &mut u8
pub fn set_background_color_index(&mut self, val: u8) -> &mut Self
pub fn get_global_color_table(&self) -> &Vec<[u8; 3]>
pub fn get_mut_global_color_table(&mut self) -> &mut Vec<[u8; 3]>
pub fn set_global_color_table(&mut self, val: Vec<[u8; 3]>) -> &mut Self
pub fn get_has_netscape_loop(&self) -> bool
pub fn get_mut_has_netscape_loop(&mut self) -> &mut bool
pub fn set_has_netscape_loop(&mut self, val: bool) -> &mut Self
pub fn get_loop_count(&self) -> u32
pub fn get_mut_loop_count(&mut self) -> &mut u32
pub fn set_loop_count(&mut self, val: u32) -> &mut Self
pub fn get_frames(&self) -> &Vec<GifFrameDescriptor>
pub fn get_mut_frames(&mut self) -> &mut Vec<GifFrameDescriptor>
pub fn set_frames(&mut self, val: Vec<GifFrameDescriptor>) -> &mut Self
pub fn get_config(&self) -> GifDecodeConfig
pub fn get_mut_config(&mut self) -> &mut GifDecodeConfig
pub fn set_config(&mut self, val: GifDecodeConfig) -> &mut Self
Trait Implementations§
Source§impl Clone for GifDecoder
impl Clone for GifDecoder
Source§impl Debug for GifDecoder
impl Debug for GifDecoder
Auto Trait Implementations§
impl Forget for GifDecoder
impl Freeze for GifDecoderwhere
*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,
impl Move for GifDecoder
impl RefUnwindSafe for GifDecoder
impl Send for GifDecoder
impl Sync for GifDecoder
impl Unpin for GifDecoder
impl UnsafeUnpin for GifDecoderwhere
*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,
impl UnwindSafe for GifDecoder
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