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

Canvas which is drawable at the provided Point (location) on the display.

Fields

top_left: Point

The top left offset where the CanvasAt will be drawn to the display.

canvas: Size

The size of the CanvasAt.

pixels: Box<[Option<C>]>

The pixels of the CanvasAt.

Implementations

Create a new blank CanvasAt.

Panics

Panics when width * height > usize::MAX.

Create a CanvasAt filled with a default color.

Panics

Panics when width * height > usize::MAX.

Create a new blank CanvasAt with a set center on the display.

Returns the center of the bounding box.

Returns the color of the pixel at a given Point.

Returns None if the Point is outside of the CanvasAt.

Create a new cropped CanvasAt.

This method takes into account the top left Point of the area you’d like to crop relative to the display.

If the width or height of the Rectangle is 0, this method will return None (see Rectangle::bottom_right())

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the bounding box.

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

The pixel color type.

The return type of the draw method. Read more

Draw the graphics object using the supplied DrawTarget.

Move the origin of an object by a given number of (x, y) pixels, returning a new object

Move the origin of an object by a given number of (x, y) pixels, mutating the object in place Read more

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.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

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.