pub struct Decoder<R: Read> { /* private fields */ }
Expand description
GIF decoder
Implementations
sourceimpl<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
Auto Trait Implementations
impl<R> !RefUnwindSafe for Decoder<R>
impl<R> Send for Decoder<R> where
R: Send,
impl<R> !Sync for Decoder<R>
impl<R> Unpin for Decoder<R> where
R: Unpin,
impl<R> !UnwindSafe for Decoder<R>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more