pub struct BmpEncoder<'a, W>where
W: 'a,{ /* private fields */ }
Expand description
The representation of a BMP encoder.
Implementations§
Source§impl<'a, W> BmpEncoder<'a, W>where
W: Write + 'a,
impl<'a, W> BmpEncoder<'a, W>where
W: Write + 'a,
Sourcepub fn new(w: &'a mut W) -> BmpEncoder<'a, W>
pub fn new(w: &'a mut W) -> BmpEncoder<'a, W>
Create a new encoder that writes its output to w
.
Sourcepub fn encode(
&mut self,
image: &[u8],
width: u32,
height: u32,
c: ExtendedColorType,
) -> Result<(), ImageError>
pub fn encode( &mut self, image: &[u8], width: u32, height: u32, c: ExtendedColorType, ) -> Result<(), ImageError>
Encodes the image image
that has dimensions width
and height
and ExtendedColorType
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: ExtendedColorType,
palette: Option<&[[u8; 3]]>,
) -> Result<(), ImageError>
pub fn encode_with_palette( &mut self, image: &[u8], width: u32, height: u32, c: ExtendedColorType, palette: Option<&[[u8; 3]]>, ) -> Result<(), ImageError>
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<W> ImageEncoder for BmpEncoder<'_, W>where
W: Write,
impl<W> ImageEncoder for BmpEncoder<'_, W>where
W: Write,
Source§fn write_image(
self,
buf: &[u8],
width: u32,
height: u32,
color_type: ExtendedColorType,
) -> Result<(), ImageError>
fn write_image( self, buf: &[u8], width: u32, height: u32, color_type: ExtendedColorType, ) -> Result<(), ImageError>
Writes all the bytes in an image to the encoder. Read more
Source§fn set_icc_profile(
&mut self,
icc_profile: Vec<u8>,
) -> Result<(), UnsupportedError>
fn set_icc_profile( &mut self, icc_profile: Vec<u8>, ) -> Result<(), UnsupportedError>
Set the ICC profile to use for the image. 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, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
Source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.