[][src]Struct embedded_graphics_simulator::SimulatorDisplay

pub struct SimulatorDisplay<C> { /* fields omitted */ }

Simulator display.

Methods

impl<C> SimulatorDisplay<C> where
    C: PixelColor
[src]

pub fn with_default_color(size: Size, default_color: C) -> Self[src]

Creates a new display filled with a color.

This constructor can be used if C doesn't implement From<BinaryColor> or another default color is wanted.

pub fn get_pixel(&self, point: Point) -> C[src]

Returns the color of the pixel at a point.

Panics

Panics if point is outside the display.

impl<C> SimulatorDisplay<C> where
    C: PixelColor + From<BinaryColor>, 
[src]

pub fn new(size: Size) -> Self[src]

Creates a new display.

The display is filled with C::from(BinaryColor::Off).

impl<C> SimulatorDisplay<C> where
    C: PixelColor + Into<Rgb888>, 
[src]

pub fn to_image_buffer(
    &self,
    output_settings: &OutputSettings
) -> ImageBuffer<Rgb<u8>, Box<[u8]>>
[src]

Converts the display contents into an image.rs ImageBuffer.

Examples

use embedded_graphics::{prelude::*, pixelcolor::Rgb888};
use embedded_graphics_simulator::{OutputSettingsBuilder, SimulatorDisplay};

let output_settings = OutputSettingsBuilder::new().scale(2).build();

let display: SimulatorDisplay<Rgb888> = SimulatorDisplay::new(Size::new(128, 64));

// draw something to the display

let image_buffer = display.to_image_buffer(&output_settings);
assert_eq!(image_buffer.width(), 256);
assert_eq!(image_buffer.height(), 128);

// use image buffer
// example: image_buffer.save

Trait Implementations

impl<C> DrawTarget<C> for SimulatorDisplay<C> where
    C: PixelColor
[src]

type Error = Infallible

Error type to return when a drawing operation fails. Read more

Auto Trait Implementations

impl<C> RefUnwindSafe for SimulatorDisplay<C> where
    C: RefUnwindSafe

impl<C> Send for SimulatorDisplay<C> where
    C: Send

impl<C> Sync for SimulatorDisplay<C> where
    C: Sync

impl<C> Unpin for SimulatorDisplay<C>

impl<C> UnwindSafe for SimulatorDisplay<C> where
    C: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.