Struct embedded_graphics::image::ImageBmp
source · pub struct ImageBmp<'a, C: PixelColor> {
pub offset: Coord,
/* private fields */
}Expand description
BMP format image
ImageBmp is available with the bmp feature turned on
§Examples
§Load a 16 bit per pixel image from a raw byte slice and draw it to a display
Note that images must be passed to Display#draw by reference, or by explicitly calling
.into_iter() on them, unlike other embedded_graphics objects.
use embedded_graphics::prelude::*;
use embedded_graphics::image::ImageBmp;
// Load `patch_16bpp.bmp`, a 16BPP 4x4px image
let image = ImageBmp::new(include_bytes!("../../../assets/patch_16bpp.bmp")).unwrap();
// Equivalent behaviour
display.draw(&image);
display.draw(image.into_iter());Fields§
§offset: CoordTop left corner offset from display origin (0,0)
Trait Implementations§
source§impl<'a, C> Dimensions for ImageBmp<'a, C>where
C: PixelColor,
impl<'a, C> Dimensions for ImageBmp<'a, C>where
C: PixelColor,
source§impl<'a, C> ImageFile<'a> for ImageBmp<'a, C>where
C: PixelColor,
impl<'a, C> ImageFile<'a> for ImageBmp<'a, C>where
C: PixelColor,
source§impl<'a, C> IntoIterator for &'a ImageBmp<'a, C>
impl<'a, C> IntoIterator for &'a ImageBmp<'a, C>
source§impl<'a, C> Transform for ImageBmp<'a, C>where
C: PixelColor,
impl<'a, C> Transform for ImageBmp<'a, C>where
C: PixelColor,
source§fn translate(&self, by: Coord) -> Self
fn translate(&self, by: Coord) -> Self
Translate the image from its current position to a new position by (x, y) pixels, returning
a new ImageBmp. For a mutating transform, see translate_mut.
source§fn translate_mut(&mut self, by: Coord) -> &mut Self
fn translate_mut(&mut self, by: Coord) -> &mut Self
Translate the image from its current position to a new position by (x, y) pixels.
impl<'a, C> Drawable for ImageBmp<'a, C>where
C: PixelColor,
Auto Trait Implementations§
impl<'a, C> Freeze for ImageBmp<'a, C>
impl<'a, C> RefUnwindSafe for ImageBmp<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for ImageBmp<'a, C>where
C: Send,
impl<'a, C> Sync for ImageBmp<'a, C>where
C: Sync,
impl<'a, C> Unpin for ImageBmp<'a, C>where
C: Unpin,
impl<'a, C> UnwindSafe for ImageBmp<'a, C>where
C: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.