pub struct Canvas<C: PixelColor> {
    pub canvas: Size,
    pub pixels: Box<[Option<C>]>,
}
Expand description

Canvas on which you can draw but it’s not drawable on the display yet.

Draw on the Canvas using origin of Point::zero().

Fields

canvas: Size

The size of the Canvas.

pixels: Box<[Option<C>]>

The pixels of the Canvas.

Implementations

Create a new blank Canvas.

Panics

Panics when width * height > usize::MAX.

Create a Canvas filled with a default color.

Panics

Panics when width * height > usize::MAX.

Returns the center of Size of the Canvas.

Create a new cropped Canvas.

This method takes into account the top left Point of the area you’d like to crop relative to the Canvas itself. If the width or height of the Rectangle is 0, this method will return None (see Rectangle::bottom_right())

Sets the place with top left offset where the canvas will be drawn to the display.

Sets the center of the Canvas where it will be drawn to the display.

Trait Implementations

The pixel color type the targetted display supports.

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

Draw individual pixels to the display without a defined order. Read more

Fill a given area with an iterator providing a contiguous stream of pixel colors. Read more

Fill a given area with a solid color. Read more

Fill the entire display with a solid color. Read more

Returns the size of the bounding box.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the bounding box.

Creates a translated draw target based on this draw target. Read more

Creates a cropped draw target based on this draw target. Read more

Creates a clipped draw target based on this draw target. Read more

Creates a color conversion draw target. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Casts the value.

OverflowingCasts the value.

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.