Struct image::codecs::gif::GifEncoder
source · pub struct GifEncoder<W: Write> { /* private fields */ }
Expand description
GIF encoder.
Implementations§
source§impl<W: Write> GifEncoder<W>
impl<W: Write> GifEncoder<W>
sourcepub fn new(w: W) -> GifEncoder<W>
pub fn new(w: W) -> GifEncoder<W>
Creates a new GIF encoder with a speed of 1. This prioritizes quality over performance at any cost.
sourcepub fn new_with_speed(w: W, speed: i32) -> GifEncoder<W>
pub fn new_with_speed(w: W, speed: i32) -> GifEncoder<W>
Create a new GIF encoder, and has the speed parameter speed
. See
Frame::from_rgba_speed
for more information.
sourcepub fn set_repeat(&mut self, repeat: Repeat) -> ImageResult<()>
pub fn set_repeat(&mut self, repeat: Repeat) -> ImageResult<()>
Set the repeat behaviour of the encoded GIF
sourcepub fn encode(
&mut self,
data: &[u8],
width: u32,
height: u32,
color: ColorType
) -> ImageResult<()>
pub fn encode( &mut self, data: &[u8], width: u32, height: u32, color: ColorType ) -> ImageResult<()>
Encode a single image.
sourcepub fn encode_frame(&mut self, img_frame: Frame) -> ImageResult<()>
pub fn encode_frame(&mut self, img_frame: Frame) -> ImageResult<()>
Encode one frame of animation.
sourcepub fn encode_frames<F>(&mut self, frames: F) -> ImageResult<()>where
F: IntoIterator<Item = Frame>,
pub fn encode_frames<F>(&mut self, frames: F) -> ImageResult<()>where F: IntoIterator<Item = Frame>,
Encodes Frames.
Consider using try_encode_frames
instead to encode an animation::Frames
like iterator.
sourcepub fn try_encode_frames<F>(&mut self, frames: F) -> ImageResult<()>where
F: IntoIterator<Item = ImageResult<Frame>>,
pub fn try_encode_frames<F>(&mut self, frames: F) -> ImageResult<()>where F: IntoIterator<Item = ImageResult<Frame>>,
Try to encode a collection of ImageResult<animation::Frame>
objects.
Use this function to encode an animation::Frames
like iterator.
Whenever an Err
item is encountered, that value is returned without further actions.
Auto Trait Implementations§
impl<W> RefUnwindSafe for GifEncoder<W>where W: RefUnwindSafe,
impl<W> Send for GifEncoder<W>where W: Send,
impl<W> Sync for GifEncoder<W>where W: Sync,
impl<W> Unpin for GifEncoder<W>where W: Unpin,
impl<W> UnwindSafe for GifEncoder<W>where W: UnwindSafe,
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