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

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

The frame of a Canvas.

Methods

impl Frame[src]

pub fn new(width: f32, height: f32) -> Frame[src]

This is supported on 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.

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

This is supported on feature="canvas" only.

Returns the width of the Frame.

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

This is supported on feature="canvas" only.

Returns the width of the Frame.

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

This is supported on feature="canvas" only.

Returns the dimensions of the Frame.

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

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

Draws the given Path 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" 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" 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" 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" 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" 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" only.

Applies a scaling to the current transform of the Frame.

pub fn into_primitive(self) -> Primitive[src]

This is supported on feature="canvas" only.

Produces the primitive 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<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> 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>,