Struct embedded_graphics_simulator::SimulatorDisplay[][src]

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

Simulator display.

Implementations

impl<C: PixelColor> SimulatorDisplay<C>[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_rgb_output_image(
    &self,
    output_settings: &OutputSettings
) -> OutputImage<Rgb888>
[src]

Converts the display contents into a RGB output image.

Examples

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

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

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

// draw something to the display

let output_image = display.to_rgb_output_image(&output_settings);
assert_eq!(output_image.size(), Size::new(256, 128));

// use output image:
// example: output_image.save_png("out.png")?;

pub fn to_grayscale_output_image(
    &self,
    output_settings: &OutputSettings
) -> OutputImage<Gray8>
[src]

Converts the display contents into a grayscale output image.

Examples

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

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

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

// draw something to the display

let output_image = display.to_grayscale_output_image(&output_settings);
assert_eq!(output_image.size(), Size::new(256, 128));

// use output image:
// example: output_image.save_png("out.png")?;

Trait Implementations

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

type Color = C

The pixel color type the targetted display supports.

type Error = Infallible

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

impl<C> OriginDimensions for SimulatorDisplay<C>[src]

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> Dimensions for T where
    T: OriginDimensions, 

impl<T> DrawTargetExt for T where
    T: DrawTarget, 
[src]

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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.