Struct Encoder
pub struct Encoder<W: Write> { /* private fields */ }
GIF encoder.
Implementations
impl<W: Write> Encoder<W>
fn new(w: W, width: u16, height: u16, global_palette: &[u8]) -> Result<Self, EncodingError>Creates a new encoder.
global_palettegives the global color palette in the format[r, g, b, ...], if no global palette shall be used an empty slice may be supplied.fn set_repeat(&mut self, repeat: Repeat) -> Result<(), EncodingError>Write an extension block that signals a repeat behaviour.
fn write_frame(&mut self, frame: &Frame<'_>) -> Result<(), EncodingError>Writes a frame to the image.
Note: This function also writes a control extension if necessary.
fn write_extension(&mut self, extension: ExtensionData) -> Result<(), EncodingError>Writes an extension to the image.
It is normally not necessary to call this method manually.
fn write_raw_extension(&mut self, func: AnyExtension, data: &[&[u8]]) -> Result<(), EncodingError>Writes a raw extension to the image.
This method can be used to write an unsupported extension to the file.
funcis the extension identifier (e.g.Extension::Application as u8).dataare the extension payload blocks. If any contained slice has a lenght > 255 it is automatically divided into sub-blocks.fn write_lzw_pre_encoded_frame(&mut self, frame: &Frame<'_>) -> Result<(), EncodingError>Writes a frame to the image, but expects
Frame.bufferto contain LZW-encoded data fromFrame::make_lzw_pre_encoded.Note: This function also writes a control extension if necessary.
fn get_ref(&self) -> &WGets a reference to the writer instance used by this encoder.
fn get_mut(&mut self) -> &mut WGets a mutable reference to the writer instance used by this encoder.
It is inadvisable to directly write to the underlying writer.
fn into_inner(self) -> Result<W, EncodingError>Finishes writing, and returns the
io::Writeinstance used by this encoder
Trait Implementations
impl<W: Write> Drop for Encoder<W>
fn drop(&mut self)
Auto Trait Implementations
impl<W> Freeze for Encoder<W>
where
Option<W>: Freeze,
impl<W> RefUnwindSafe for Encoder<W>
where
Option<W>: RefUnwindSafe,
impl<W> Send for Encoder<W>
where
Option<W>: Send,
impl<W> Sync for Encoder<W>
where
Option<W>: Sync,
impl<W> Unpin for Encoder<W>
where
Option<W>: Unpin,
impl<W> UnsafeUnpin for Encoder<W>
where
Option<W>: UnsafeUnpin,
impl<W> UnwindSafe for Encoder<W>
where
Option<W>: UnwindSafe,
Blanket Implementations
impl<T> Any for Encoder<W>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Encoder<W>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Encoder<W>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Encoder<W>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Encoder<W>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Encoder<W>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Encoder<W>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>