Struct embedded_graphics::image::Image8BPP
source · pub struct Image8BPP<'a, C: PixelColor> {
pub offset: Coord,
/* private fields */
}
Expand description
8 bits per pixel image
Each byte of input data defines the on/off state for each pixel. This currently only supports monochrome displays, so if the pixel value is 0, it’s off, anything above 0 is on.
You can convert an image to 8BPP for inclusion with include_bytes!()
using the following
Imagemagick command:
convert image.png -depth 8 gray:"image.raw"
Fields
offset: Coord
Top left corner offset from display origin (0,0)
Trait Implementations
sourceimpl<'a, C: Debug + PixelColor> Debug for Image8BPP<'a, C>
impl<'a, C: Debug + PixelColor> Debug for Image8BPP<'a, C>
sourceimpl<'a, C> Dimensions for Image8BPP<'a, C>where
C: PixelColor,
impl<'a, C> Dimensions for Image8BPP<'a, C>where
C: PixelColor,
sourcefn bottom_right(&self) -> Coord
fn bottom_right(&self) -> Coord
Get the bottom right corner of the bounding box for an object
sourcefn size(&self) -> UnsignedCoord
fn size(&self) -> UnsignedCoord
Get the width and height for an object
sourceimpl<'a, C> Image<'a> for Image8BPP<'a, C>where
C: PixelColor,
impl<'a, C> Image<'a> for Image8BPP<'a, C>where
C: PixelColor,
sourceimpl<'a, C> IntoIterator for &'a Image8BPP<'a, C>where
C: PixelColor,
impl<'a, C> IntoIterator for &'a Image8BPP<'a, C>where
C: PixelColor,
sourceimpl<'a, C> Transform for Image8BPP<'a, C>where
C: PixelColor,
impl<'a, C> Transform for Image8BPP<'a, C>where
C: PixelColor,
sourcefn 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 Image8BPP
. For a mutating transform, see translate_mut
.
// 1px x 1px test image
let image: Image8BPP<PixelColorU8> = Image8BPP::new(&[ 0xff ], 1, 1);
let moved = image.translate(Coord::new(25, 30));
assert_eq!(image.offset, Coord::new(0, 0));
assert_eq!(moved.offset, Coord::new(25, 30));
sourcefn 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.
// 1px x 1px test image
let mut image: Image8BPP<PixelColorU8> = Image8BPP::new(&[ 0xff ], 1, 1);
image.translate_mut(Coord::new(25, 30));
assert_eq!(image.offset, Coord::new(25, 30));
impl<'a, C> Drawable for Image8BPP<'a, C>where
C: PixelColor,
Auto Trait Implementations
impl<'a, C> RefUnwindSafe for Image8BPP<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for Image8BPP<'a, C>where
C: Send,
impl<'a, C> Sync for Image8BPP<'a, C>where
C: Sync,
impl<'a, C> Unpin for Image8BPP<'a, C>where
C: Unpin,
impl<'a, C> UnwindSafe for Image8BPP<'a, C>where
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more