[−][src]Struct embedded_graphics::image::Image8BPP
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
impl<'a, C> Drawable for Image8BPP<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
impl<'a, C> Dimensions for Image8BPP<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
fn top_left(&self) -> Coord
[src]
fn bottom_right(&self) -> Coord
[src]
fn size(&self) -> UnsignedCoord
[src]
impl<'a, C> Image<'a> for Image8BPP<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
fn new(imagedata: &'a [u8], width: u32, height: u32) -> Self
[src]
Create a new 8BPP image with given data, width and height. Data length must equal
width * height
impl<'a, C> Transform for Image8BPP<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
fn translate(&self, by: Coord) -> Self
[src]
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));
fn translate_mut(&mut self, by: Coord) -> &mut Self
[src]
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: Debug + PixelColor> Debug for Image8BPP<'a, C>
[src]
impl<'a, C> IntoIterator for &'a Image8BPP<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
Auto Trait Implementations
impl<'a, C> Send for Image8BPP<'a, C> where
C: Send,
C: Send,
impl<'a, C> Sync for Image8BPP<'a, C> where
C: Sync,
C: Sync,
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,