pub struct GifDecoder<S>where
S: Source,{ /* private fields */ }Expand description
Decodes a GIF stream.
Decoder presents the first frame; GifDecoder::next_frame walks the
rest. See the crate docs for why the split is where it is.
Implementations§
Source§impl<S> GifDecoder<S>where
S: Source,
impl<S> GifDecoder<S>where
S: Source,
Sourcepub fn new(source: S, limits: Limits) -> Result<GifDecoder<S>, PixelsError>
pub fn new(source: S, limits: Limits) -> Result<GifDecoder<S>, PixelsError>
Parse the header and logical screen descriptor, reading nothing more.
§Errors
Returns PixelsError::Malformed for a bad signature or screen
descriptor, or PixelsError::LimitExceeded if the canvas exceeds
limits.
Sourcepub fn next_frame(&mut self) -> Result<Option<Frame>, PixelsError>
pub fn next_frame(&mut self) -> Result<Option<Frame>, PixelsError>
Decode the next frame, compositing it onto the canvas.
Returns None once the stream’s trailer is reached. Each frame carries
the whole canvas, because that is what a viewer draws — a frame’s own
rectangle is meaningless without what it was composited onto.
§Errors
Returns PixelsError::Malformed for a malformed block or a frame
that does not fit its canvas, or PixelsError::Io on source failure.
Trait Implementations§
Source§impl<S> Debug for GifDecoder<S>
impl<S> Debug for GifDecoder<S>
Source§impl<S> Decoder for GifDecoder<S>
impl<S> Decoder for GifDecoder<S>
Source§fn descriptor(&self) -> ImageDescriptor
fn descriptor(&self) -> ImageDescriptor
The shape of the image, known after the header is parsed.
Source§fn capability(&self) -> DecodeCapability
fn capability(&self) -> DecodeCapability
What this decoder can produce without a full decode.
Source§fn animation(&self) -> Option<Animation>
fn animation(&self) -> Option<Animation>
The source’s animation, if it has more than one frame. Read more
Source§fn read_row(&mut self, out: &mut [u8]) -> Result<(), PixelsError>
fn read_row(&mut self, out: &mut [u8]) -> Result<(), PixelsError>
Decode the next row, top to bottom, into
out. Read moreSource§fn orientation(&self) -> Orientation
fn orientation(&self) -> Orientation
How the stored image must be turned to display upright, as its
metadata declares. Read more
Source§fn icc_profile(&self) -> Option<&[u8]>
fn icc_profile(&self) -> Option<&[u8]>
The embedded ICC colour profile, if the file carries one. Read more
Source§fn read_region(
&mut self,
region: Region,
out: &mut TileMut<'_>,
) -> Result<(), PixelsError>
fn read_region( &mut self, region: Region, out: &mut TileMut<'_>, ) -> Result<(), PixelsError>
Decode an arbitrary region into
out. Read moreSource§fn reduced_descriptor(&self, target: (u32, u32)) -> Option<ImageDescriptor>
fn reduced_descriptor(&self, target: (u32, u32)) -> Option<ImageDescriptor>
What this decoder would produce if asked for
target or larger, when
the format lets it reach that size more cheaply than a full decode. Read moreSource§fn reduce_to(&mut self, descriptor: ImageDescriptor) -> Result<(), PixelsError>
fn reduce_to(&mut self, descriptor: ImageDescriptor) -> Result<(), PixelsError>
Auto Trait Implementations§
impl<S> Freeze for GifDecoder<S>
impl<S> RefUnwindSafe for GifDecoder<S>
impl<S> Send for GifDecoder<S>
impl<S> Sync for GifDecoder<S>
impl<S> Unpin for GifDecoder<S>
impl<S> UnsafeUnpin for GifDecoder<S>
impl<S> UnwindSafe for GifDecoder<S>
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