[][src]Struct iced::widget::canvas::Frame

pub struct Frame { /* fields omitted */ }
This is supported on feature="canvas" or feature="glow_canvas" only.

The frame of a Canvas.

Implementations

impl Frame[src]

pub fn new(size: Size<f32>) -> Frame[src]

This is supported on feature="canvas" or feature="glow_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.

pub fn width(&self) -> f32[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Returns the width of the Frame.

pub fn height(&self) -> f32[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Returns the width of the Frame.

pub fn size(&self) -> Size<f32>[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Returns the dimensions of the Frame.

pub fn center(&self) -> Point[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Returns the coordinate of the center of the Frame.

pub fn fill(&mut self, path: &Path, fill: impl Into<Fill>)[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

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

pub fn fill_rectangle(
    &mut self,
    top_left: Point,
    size: Size<f32>,
    fill: impl Into<Fill>
)
[src]

This is supported on feature="canvas" or feature="glow_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.

pub fn stroke(&mut self, path: &Path, stroke: impl Into<Stroke>)[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

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

pub fn fill_text(&mut self, text: impl Into<Text>)[src]

This is supported on feature="canvas" or feature="glow_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.

pub fn with_save(&mut self, f: impl FnOnce(&mut Frame))[src]

This is supported on feature="canvas" or feature="glow_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.

pub fn translate(&mut self, translation: Vector<f32>)[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Applies a translation to the current transform of the Frame.

pub fn rotate(&mut self, angle: f32)[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Applies a rotation to the current transform of the Frame.

pub fn scale(&mut self, scale: f32)[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Applies a scaling to the current transform of the Frame.

pub fn into_geometry(self) -> Geometry[src]

This is supported on feature="canvas" or feature="glow_canvas" only.

Produces the Geometry representing everything drawn on the Frame.

Trait Implementations

impl Debug for Frame[src]

Auto Trait Implementations

impl RefUnwindSafe for Frame

impl Send for Frame

impl Sync for Frame

impl Unpin for Frame

impl UnwindSafe for Frame

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

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, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

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

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

impl<T> SetParameter for T

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,