pub struct Frame { /* private fields */ }
canvas
only.Expand description
The frame of a Canvas
.
Implementations
sourceimpl Frame
impl Frame
sourcepub fn fill_rectangle(
&mut self,
top_left: Point,
size: Size<f32>,
fill: impl Into<Fill>
)
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.
sourcepub fn fill_text(&mut self, text: impl Into<Text>)
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.
sourcepub fn with_save(&mut self, f: impl FnOnce(&mut Frame))
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.
sourcepub fn with_clip(&mut self, region: Rectangle<f32>, f: impl FnOnce(&mut Frame))
pub fn with_clip(&mut self, region: Rectangle<f32>, f: impl FnOnce(&mut Frame))
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.
sourcepub fn translate(&mut self, translation: Vector<f32>)
pub fn translate(&mut self, translation: Vector<f32>)
Applies a translation to the current transform of the Frame
.
sourcepub fn rotate(&mut self, angle: f32)
pub fn rotate(&mut self, angle: f32)
Applies a rotation in radians to the current transform of the Frame
.
sourcepub fn into_geometry(self) -> Geometry
pub fn into_geometry(self) -> Geometry
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
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
sourcefn into_color(self) -> U
fn into_color(self) -> U
sourceimpl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
sourcefn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
sourcefn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more