Struct iced::widget::canvas::Frame

source ·
pub struct Frame { /* private fields */ }
Available on crate feature canvas only.
Expand description

The frame of a Canvas.

Implementations

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.

Returns the width of the Frame.

Returns the height of the Frame.

Returns the dimensions of the Frame.

Returns the coordinate of the center of the Frame.

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

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

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

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.

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.

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.

Applies a translation to the current transform of the Frame.

Applies a rotation in radians to the current transform of the Frame.

Applies a scaling to the current transform of the Frame.

Produces the Geometry representing everything drawn on the Frame.

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more
Convert the source color to the destination color using the bradford method by default Read more
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.

Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
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.
Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more