logo
pub struct Frame { /* private fields */ }
Available on crate feature pure only.
Expand description

The frame of a Canvas.

Implementations

Available on crate feature canvas only.

Creates a new empty Frame with the given dimensions.

The default coordinate system of a Frame has its origin at the top-left corner of its bounds.

Available on crate feature canvas only.

Returns the width of the Frame.

Available on crate feature canvas only.

Returns the height of the Frame.

Available on crate feature canvas only.

Returns the dimensions of the Frame.

Available on crate feature canvas only.

Returns the coordinate of the center of the Frame.

Available on crate feature canvas only.

Draws the given Path on the Frame by filling it with the provided style.

Available on crate feature canvas only.

Draws an axis-aligned rectangle given its top-left corner coordinate and its Size on the Frame by filling it with the provided style.

Available on crate feature canvas only.

Draws the stroke of the given Path on the Frame with the provided style.

Available on crate feature canvas only.

Draws the characters of the given Text on the Frame, filling them with the given color.

Warning: Text currently does not work well with rotations and scale transforms! The position will be correctly transformed, but the resulting glyphs will not be rotated or scaled properly.

Additionally, all text will be rendered on top of all the layers of a Canvas. Therefore, it is currently only meant to be used for overlays, which is the most common use case.

Support for vectorial text is planned, and should address all these limitations.

Available on crate feature canvas only.

Stores the current transform of the Frame and executes the given drawing operations, restoring the transform afterwards.

This method is useful to compose transforms and perform drawing operations in different coordinate systems.

Available on crate feature canvas only.

Executes the given drawing operations within a Rectangle region, clipping any geometry that overflows its bounds. Any transformations performed are local to the provided closure.

This method is useful to perform drawing operations that need to be clipped.

Available on crate feature canvas only.

Applies a translation to the current transform of the Frame.

Available on crate feature canvas only.

Applies a rotation to the current transform of the Frame.

Available on crate feature canvas only.

Applies a scaling to the current transform of the Frame.

Available on crate feature canvas only.

Produces the Geometry representing everything drawn on the Frame.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. 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.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. 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.