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

pub struct Frame { /* fields omitted */ }
This is supported on crate features canvas or glow_canvas only.

The frame of a Canvas.

Implementations

impl Frame

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

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

Returns the width of the Frame.

pub fn height(&self) -> f32

Returns the width of the Frame.

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

Returns the dimensions of the Frame.

pub fn center(&self) -> Point

Returns the coordinate of the center of the Frame.

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

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>
)

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>)

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

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

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))

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>)

Applies a translation to the current transform of the Frame.

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

Applies a rotation to the current transform of the Frame.

pub fn scale(&mut self, scale: f32)

Applies a scaling to the current transform of the Frame.

pub fn into_geometry(self) -> Geometry

Produces the Geometry representing everything drawn on the Frame.

Trait Implementations

impl Debug for Frame

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> Downcast<T> for T

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

impl<T> Instrument for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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<T> Upcast<T> for T

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