pub struct GifEncoder { /* private fields */ }Expand description
Encodes a single-frame GIF.
Implementations§
Source§impl GifEncoder
impl GifEncoder
Sourcepub const fn new() -> GifEncoder
pub const fn new() -> GifEncoder
An encoder with a full 256-colour palette and dithering.
Sourcepub fn with_colours(self, colours: usize) -> Result<GifEncoder, PixelsError>
pub fn with_colours(self, colours: usize) -> Result<GifEncoder, PixelsError>
An encoder aiming for at most colours palette entries.
§Errors
Returns PixelsError::InvalidArgument outside 2..=256.
Sourcepub const fn without_dithering(self) -> GifEncoder
pub const fn without_dithering(self) -> GifEncoder
An encoder with dithering disabled.
Sourcepub fn from_options(options: &EncodeOptions) -> GifEncoder
pub fn from_options(options: &EncodeOptions) -> GifEncoder
An encoder configured from generic encode options.
GIF has no quality dial in the JPEG sense — it is lossless given a palette, and the palette is where all the loss lives. So quality is read as palette size, mapping 1..=100 onto 2..=256 entries, which is the axis that actually trades size for fidelity.
Trait Implementations§
Source§impl Debug for GifEncoder
impl Debug for GifEncoder
Source§impl Default for GifEncoder
impl Default for GifEncoder
Source§fn default() -> GifEncoder
fn default() -> GifEncoder
Returns the “default value” for a type. Read more
Source§impl Encoder for GifEncoder
impl Encoder for GifEncoder
Source§fn write_header(
&mut self,
desc: &ImageDescriptor,
_sink: &mut dyn Sink,
) -> Result<(), PixelsError>
fn write_header( &mut self, desc: &ImageDescriptor, _sink: &mut dyn Sink, ) -> Result<(), PixelsError>
Begin an image, writing any container header. Read more
Source§fn write_row(
&mut self,
row: &[u8],
_sink: &mut dyn Sink,
) -> Result<(), PixelsError>
fn write_row( &mut self, row: &[u8], _sink: &mut dyn Sink, ) -> Result<(), PixelsError>
Write the next row, top to bottom. Read more
Source§fn finish(&mut self, sink: &mut dyn Sink) -> Result<(), PixelsError>
fn finish(&mut self, sink: &mut dyn Sink) -> Result<(), PixelsError>
Finish the image, writing any trailer and flushing the sink. Read more
Source§fn set_icc_profile(&mut self, profile: Option<&[u8]>) -> Result<(), PixelsError>
fn set_icc_profile(&mut self, profile: Option<&[u8]>) -> Result<(), PixelsError>
Embed
profile as the image’s ICC colour profile, or write none. Read moreAuto Trait Implementations§
impl Freeze for GifEncoder
impl RefUnwindSafe for GifEncoder
impl Send for GifEncoder
impl Sync for GifEncoder
impl Unpin for GifEncoder
impl UnsafeUnpin for GifEncoder
impl UnwindSafe for GifEncoder
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