pub struct RawBmp<'a> { /* private fields */ }Expand description
Low-level access to BMP image data.
This struct can be used to access the image data in a BMP file at a lower level than with the
Bmp struct. It doesn’t do automatic color conversion and doesn’t apply the color
table, if it is present in the BMP file. For images with a color table the iterator returned by
pixels will instead return the color indices, that can be looked up manually
using the ColorTable struct.
Implementations§
Source§impl<'a> RawBmp<'a>
impl<'a> RawBmp<'a>
Sourcepub const fn from_slice(bytes: &'a [u8]) -> Result<Self, ParseError>
pub const fn from_slice(bytes: &'a [u8]) -> Result<Self, ParseError>
Create a bitmap object from a byte slice.
The created object keeps a shared reference to the input and does not dynamically allocate memory.
Sourcepub const fn color_table(&self) -> Option<&ColorTable<'a>>
pub const fn color_table(&self) -> Option<&ColorTable<'a>>
Returns the color table associated with the image.
Sourcepub const fn image_data(&self) -> &'a [u8]
pub const fn image_data(&self) -> &'a [u8]
Returns a slice containing the raw image data.
Sourcepub fn pixels(&self) -> RawPixels<'_> ⓘ
pub fn pixels(&self) -> RawPixels<'_> ⓘ
Returns an iterator over the raw pixels in the image.
The iterator returns the raw pixel colors as u32 values. To automatically convert the
raw values into embedded_graphics color types use Bmp::pixels
instead.
Sourcepub fn colors(&self) -> DynamicRawColors<'_> ⓘ
pub fn colors(&self) -> DynamicRawColors<'_> ⓘ
Returns an iterator over the raw colors in the image.
The iterator returns the color value in the order the pixels are stored in the file.
Use row_order to determine the correct
pixel arrangement.
Sourcepub fn pixel(&self, p: Point) -> Option<u32>
pub fn pixel(&self, p: Point) -> Option<u32>
Returns the raw color of a pixel.
Returns None if p is outside the image bounding box. Note that this function doesn’t
apply a color map, if the image contains one.
This routine always returns None if the bitmap is RLE compressed, as RLE compressed
bitmaps don’t easily allow direct access to any given pixel.