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 fn from_slice(bytes: &'a [u8]) -> Result<Self, ParseError>
pub 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 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.
Trait Implementations§
source§impl<'a> Ord for RawBmp<'a>
impl<'a> Ord for RawBmp<'a>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<'a> PartialEq for RawBmp<'a>
impl<'a> PartialEq for RawBmp<'a>
source§impl<'a> PartialOrd for RawBmp<'a>
impl<'a> PartialOrd for RawBmp<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more