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)