pub struct Collector { /* private fields */ }
Expand description
Collect frames that will be encoded
Note that writing will finish only when the collector is dropped.
Collect frames on another thread, or call drop(collector)
before calling writer.write()
!
Implementations§
source§impl Collector
impl Collector
sourcepub fn add_frame_rgba(
&self,
frame_index: usize,
frame: ImgVec<RGBA8>,
presentation_timestamp: f64
) -> GifResult<()>
pub fn add_frame_rgba( &self, frame_index: usize, frame: ImgVec<RGBA8>, presentation_timestamp: f64 ) -> GifResult<()>
Frame index starts at 0.
Set each frame (index) only once, but you can set them in any order. However, out-of-order frames will be buffered in RAM, and big gaps in frame indices will cause high memory usage.
Presentation timestamp is time in seconds (since file start at 0) when this frame is to be displayed.
If the first frame doesn’t start at pts=0, the delay will be used for the last frame.
If this function appears to be stuck after a few frames, it’s because crate::Writer::write()
is not running.
sourcepub fn add_frame_png_data(
&self,
frame_index: usize,
png_data: Vec<u8>,
presentation_timestamp: f64
) -> GifResult<()>
pub fn add_frame_png_data( &self, frame_index: usize, png_data: Vec<u8>, presentation_timestamp: f64 ) -> GifResult<()>
Decode a frame from in-memory PNG-compressed data.
Frame index starts at 0. Set each frame (index) only once, but you can set them in any order. However, out-of-order frames will be buffered in RAM, and big gaps in frame indices will cause high memory usage.
Presentation timestamp is time in seconds (since file start at 0) when this frame is to be displayed.
If the first frame doesn’t start at pts=0, the delay will be used for the last frame.
If this function appears to be stuck after a few frames, it’s because crate::Writer::write()
is not running.
sourcepub fn add_frame_png_file(
&self,
frame_index: usize,
path: PathBuf,
presentation_timestamp: f64
) -> GifResult<()>
pub fn add_frame_png_file( &self, frame_index: usize, path: PathBuf, presentation_timestamp: f64 ) -> GifResult<()>
Read and decode a PNG file from disk.
Frame index starts at 0. Set each frame (index) only once, but you can set them in any order.
Presentation timestamp is time in seconds (since file start at 0) when this frame is to be displayed.
If the first frame doesn’t start at pts=0, the delay will be used for the last frame.
If this function appears to be stuck after a few frames, it’s because crate::Writer::write()
is not running.
Auto Trait Implementations§
impl Freeze for Collector
impl RefUnwindSafe for Collector
impl Send for Collector
impl Sync for Collector
impl Unpin for Collector
impl UnwindSafe for Collector
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
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>
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>
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