pub struct BufferedDecoder { /* private fields */ }Expand description
A buffered GIF decoder that loads and composites all frames.
This decoder properly handles GIF disposal methods and transparency, producing fully composited RGBA frames suitable for analysis.
§Example
ⓘ
use figif_core::decoders::BufferedDecoder;
use figif_core::traits::GifDecoder;
let decoder = BufferedDecoder::new();
let frames: Vec<_> = decoder.decode_file("animation.gif")?.collect::<Result<Vec<_>, _>>()?;Implementations§
Source§impl BufferedDecoder
impl BufferedDecoder
Sourcepub fn with_memory_limit(self, limit: usize) -> Self
pub fn with_memory_limit(self, limit: usize) -> Self
Set a memory limit for decoding.
If the GIF would require more memory than this limit, decoding will fail with an error.
Trait Implementations§
Source§impl BufferedGifDecoder for BufferedDecoder
impl BufferedGifDecoder for BufferedDecoder
Source§fn decode_all(&self, data: &[u8]) -> Result<Vec<DecodedFrame>>
fn decode_all(&self, data: &[u8]) -> Result<Vec<DecodedFrame>>
Decode all frames into a vector.
Source§fn decode_all_from_file(
&self,
path: impl AsRef<Path>,
) -> Result<Vec<DecodedFrame>>
fn decode_all_from_file( &self, path: impl AsRef<Path>, ) -> Result<Vec<DecodedFrame>>
Decode all frames from a file into a vector.
Source§impl Clone for BufferedDecoder
impl Clone for BufferedDecoder
Source§fn clone(&self) -> BufferedDecoder
fn clone(&self) -> BufferedDecoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BufferedDecoder
impl Debug for BufferedDecoder
Source§impl Default for BufferedDecoder
impl Default for BufferedDecoder
Source§fn default() -> BufferedDecoder
fn default() -> BufferedDecoder
Returns the “default value” for a type. Read more
Source§impl GifDecoder for BufferedDecoder
impl GifDecoder for BufferedDecoder
Source§type FrameIter = BufferedFrameIter
type FrameIter = BufferedFrameIter
The type of iterator returned by decode operations.
Source§fn decode_file(&self, path: impl AsRef<Path>) -> Result<Self::FrameIter>
fn decode_file(&self, path: impl AsRef<Path>) -> Result<Self::FrameIter>
Decode a GIF from a file path. Read more
Source§fn decode_bytes(&self, data: &[u8]) -> Result<Self::FrameIter>
fn decode_bytes(&self, data: &[u8]) -> Result<Self::FrameIter>
Decode a GIF from a byte slice. Read more
Source§fn decode_reader<R: Read + Send>(&self, reader: R) -> Result<Self::FrameIter>
fn decode_reader<R: Read + Send>(&self, reader: R) -> Result<Self::FrameIter>
Decode a GIF from any reader. Read more
Source§fn metadata_from_bytes(&self, data: &[u8]) -> Result<GifMetadata>
fn metadata_from_bytes(&self, data: &[u8]) -> Result<GifMetadata>
Extract metadata without fully decoding all frames. Read more
Source§fn metadata_from_file(&self, path: impl AsRef<Path>) -> Result<GifMetadata>
fn metadata_from_file(&self, path: impl AsRef<Path>) -> Result<GifMetadata>
Extract metadata from a file.
Auto Trait Implementations§
impl Freeze for BufferedDecoder
impl RefUnwindSafe for BufferedDecoder
impl Send for BufferedDecoder
impl Sync for BufferedDecoder
impl Unpin for BufferedDecoder
impl UnsafeUnpin for BufferedDecoder
impl UnwindSafe for BufferedDecoder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more