pub struct Decoder<R: Read> { /* private fields */ }
Expand description
GIF decoder
Implementations§
source§impl<R> Decoder<R>where
R: Read,
impl<R> Decoder<R>where
R: Read,
sourcepub fn new(reader: R) -> Result<Self, DecodingError>
pub fn new(reader: R) -> Result<Self, DecodingError>
Create a new decoder with default options.
sourcepub fn build() -> DecodeOptions
pub fn build() -> DecodeOptions
Return a builder that allows configuring limits etc.
sourcepub fn next_frame_info(
&mut self,
) -> Result<Option<&Frame<'static>>, DecodingError>
pub fn next_frame_info( &mut self, ) -> Result<Option<&Frame<'static>>, DecodingError>
Returns the next frame info
sourcepub fn read_next_frame(
&mut self,
) -> Result<Option<&Frame<'static>>, DecodingError>
pub fn read_next_frame( &mut self, ) -> Result<Option<&Frame<'static>>, DecodingError>
Reads the next frame from the image.
Do not call Self::next_frame_info
beforehand.
Deinterlaces the result.
sourcepub fn read_into_buffer(&mut self, buf: &mut [u8]) -> Result<(), DecodingError>
pub fn read_into_buffer(&mut self, buf: &mut [u8]) -> Result<(), DecodingError>
Reads the data of the current frame into a pre-allocated buffer.
Self::next_frame_info
needs to be called beforehand.
The length of buf
must be at least Self::buffer_size
.
Deinterlaces the result.
sourcepub fn fill_buffer(&mut self, buf: &mut [u8]) -> Result<bool, DecodingError>
pub fn fill_buffer(&mut self, buf: &mut [u8]) -> Result<bool, DecodingError>
Reads data of the current frame into a pre-allocated buffer until the buffer has been filled completely.
Self::next_frame_info
needs to be called beforehand. Returns true
if the supplied
buffer could be filled completely. Should not be called after false
had been returned.
sourcepub fn buffer_size(&self) -> usize
pub fn buffer_size(&self) -> usize
Output buffer size
sourcepub fn line_length(&self) -> usize
pub fn line_length(&self) -> usize
Line length of the current frame
sourcepub fn palette(&self) -> Result<&[u8], DecodingError>
pub fn palette(&self) -> Result<&[u8], DecodingError>
Returns the color palette relevant for the current (next) frame
sourcepub fn global_palette(&self) -> Option<&[u8]>
pub fn global_palette(&self) -> Option<&[u8]>
The global color palette