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,

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

fn borrow_mut(&mut self) -> &mut T

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

fn from(t: T) -> T

Returns the argument unchanged.

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

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

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

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>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>