pub struct BmpEncoder<'a, W: 'a> { /* private fields */ }
Expand description
The representation of a BMP encoder.
Implementations§
source§impl<'a, W: Write + 'a> BmpEncoder<'a, W>
impl<'a, W: Write + 'a> BmpEncoder<'a, W>
sourcepub fn encode(
&mut self,
image: &[u8],
width: u32,
height: u32,
c: ColorType,
) -> ImageResult<()>
pub fn encode( &mut self, image: &[u8], width: u32, height: u32, c: ColorType, ) -> ImageResult<()>
Encodes the image image
that has dimensions width
and height
and ColorType
c
.
§Panics
Panics if width * height * c.bytes_per_pixel() != image.len()
.
sourcepub fn encode_with_palette(
&mut self,
image: &[u8],
width: u32,
height: u32,
c: ColorType,
palette: Option<&[[u8; 3]]>,
) -> ImageResult<()>
pub fn encode_with_palette( &mut self, image: &[u8], width: u32, height: u32, c: ColorType, 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§
source§impl<'a, W: Write> ImageEncoder for BmpEncoder<'a, W>
impl<'a, W: Write> ImageEncoder for BmpEncoder<'a, W>
source§fn write_image(
self,
buf: &[u8],
width: u32,
height: u32,
color_type: ColorType,
) -> ImageResult<()>
fn write_image( self, buf: &[u8], width: u32, height: u32, color_type: ColorType, ) -> ImageResult<()>
Writes all the bytes in an image to the encoder. Read more
Auto Trait Implementations§
impl<'a, W> Freeze for BmpEncoder<'a, W>
impl<'a, W> RefUnwindSafe for BmpEncoder<'a, W>where
W: RefUnwindSafe,
impl<'a, W> Send for BmpEncoder<'a, W>where
W: Send,
impl<'a, W> Sync for BmpEncoder<'a, W>where
W: Sync,
impl<'a, W> Unpin for BmpEncoder<'a, W>
impl<'a, W> !UnwindSafe for BmpEncoder<'a, W>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more