Struct BmpEncoder

pub struct BmpEncoder<'a, W: 'a> { /* private fields */ }

The representation of a BMP encoder.

Implementations

impl<'a, W: Write + 'a> BmpEncoder<'a, W>

fn new(w: &'a mut W) -> Self

Create a new encoder that writes its output to w.

fn encode(&mut self, image: &[u8], width: u32, height: u32, c: ExtendedColorType) -> ImageResult<()>

Encodes the image image that has dimensions width and height and ExtendedColorType c.

Panics

Panics if width * height * c.bytes_per_pixel() != image.len().

fn encode_with_palette(&mut self, image: &[u8], width: u32, height: u32, color_type: ExtendedColorType, palette: Option<&[[u8; 3]]>) -> ImageResult<()>

Same as encode, but allow a palette to be passed in. The palette is ignored for color types other than Luma/Luma-with-alpha.

Panics

Panics if width * height * c.bytes_per_pixel() != image.len().

Trait Implementations

impl<W: Write> ImageEncoder for BmpEncoder<'_, W>

fn write_image(self, buf: &[u8], width: u32, height: u32, color_type: ExtendedColorType) -> ImageResult<()>

Auto Trait Implementations

impl<'a, W> !UnwindSafe for BmpEncoder<'a, W>

impl<'a, W> Freeze for BmpEncoder<'a, W> where &'a mut W: Freeze,

impl<'a, W> RefUnwindSafe for BmpEncoder<'a, W> where &'a mut W: RefUnwindSafe,

impl<'a, W> Send for BmpEncoder<'a, W> where &'a mut W: Send,

impl<'a, W> Sync for BmpEncoder<'a, W> where &'a mut W: Sync,

impl<'a, W> Unpin for BmpEncoder<'a, W> where &'a mut W: Unpin,

impl<'a, W> UnsafeUnpin for BmpEncoder<'a, W> where &'a mut W: UnsafeUnpin,

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for BmpEncoder<'a, W> where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for BmpEncoder<'a, W> where ST: ?Sized, DT: ?Sized,

impl<T> Any for BmpEncoder<'a, W> where T: 'static + ?Sized,

impl<T> Borrow<T> for BmpEncoder<'a, W> where T: ?Sized,

impl<T> BorrowMut<T> for BmpEncoder<'a, W> where T: ?Sized,

impl<T> From<T> for BmpEncoder<'a, W>

impl<T> IntoEither for BmpEncoder<'a, W>

impl<T> Pointable for BmpEncoder<'a, W>

impl<T> Read<Exclusive, BecauseExclusive> for BmpEncoder<'a, W> where T: ?Sized,

impl<T, U> Into<U> for BmpEncoder<'a, W> where U: From<T>,

impl<T, U> TryFrom<U> for BmpEncoder<'a, W> where U: Into<T>,

impl<T, U> TryInto<U> for BmpEncoder<'a, W> where U: TryFrom<T>,