[][src]Type Definition embedded_graphics::image::Image1BPP

type Image1BPP<'a, C> = Image<'a, C, ImageType1BPP>;

1 bit per pixel image

Each byte of input data defines the on/off state of 8 horizontal pixels to be displayed on the screen.

You can convert an image to 1BPP for inclusion with include_bytes!() using the following Imagemagick command:

convert image.png -depth 1 gray:"image.raw"

Examples

Load a 1 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::Image1BPP;

// Load `patch_1bpp.raw`, a 1BPP 4x4px image
let image = Image1BPP::new(include_bytes!("../../../assets/patch_1bpp.raw"), 4, 4);

// Equivalent behaviour
display.draw(&image);
display.draw(image.into_iter());

Trait Implementations

impl<'a, C> IntoIterator for &'a Image1BPP<'a, C> where
    C: PixelColor
[src]

type Item = Pixel<C>

The type of the elements being iterated over.

type IntoIter = ImageIterator<'a, C, ImageType1BPP>

Which kind of iterator are we turning this into?