pub struct Frame<Renderer>where
Renderer: Renderer,{ /* private fields */ }
geometry
only.Expand description
The region of a surface that can be used to draw geometry.
Implementations§
Source§impl<Renderer> Frame<Renderer>where
Renderer: Renderer,
impl<Renderer> Frame<Renderer>where
Renderer: Renderer,
Sourcepub fn new(renderer: &Renderer, size: Size) -> Self
pub fn new(renderer: &Renderer, size: Size) -> Self
Creates a new Frame
with the given dimensions.
Sourcepub fn fill_rectangle(
&mut self,
top_left: Point,
size: Size,
fill: impl Into<Fill>,
)
pub fn fill_rectangle( &mut self, top_left: Point, size: Size, 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 stroke_rectangle<'a>(
&mut self,
top_left: Point,
size: Size,
stroke: impl Into<Stroke<'a>>,
)
pub fn stroke_rectangle<'a>( &mut self, top_left: Point, size: Size, stroke: impl Into<Stroke<'a>>, )
Draws the stroke of an axis-aligned rectangle with the provided style
given its top-left corner coordinate and its Size
on the Frame
.
Sourcepub fn draw_image(&mut self, bounds: Rectangle, image: impl Into<Image>)
Available on crate feature image
only.
pub fn draw_image(&mut self, bounds: Rectangle, image: impl Into<Image>)
image
only.Sourcepub fn draw_svg(&mut self, bounds: Rectangle, svg: impl Into<Svg>)
Available on crate feature svg
only.
pub fn draw_svg(&mut self, bounds: Rectangle, svg: impl Into<Svg>)
svg
only.Sourcepub fn with_save<R>(&mut self, f: impl FnOnce(&mut Self) -> R) -> R
pub fn with_save<R>(&mut self, f: impl FnOnce(&mut Self) -> R) -> R
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 push_transform(&mut self)
pub fn push_transform(&mut self)
Pushes the current transform in the transform stack.
Sourcepub fn pop_transform(&mut self)
pub fn pop_transform(&mut self)
Pops a transform from the transform stack and sets it as the current transform.
Sourcepub fn with_clip<R>(
&mut self,
region: Rectangle,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn with_clip<R>( &mut self, region: Rectangle, f: impl FnOnce(&mut Self) -> R, ) -> R
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)
pub fn translate(&mut self, translation: Vector)
Applies a translation to the current transform of the Frame
.
Sourcepub fn rotate(&mut self, angle: impl Into<Radians>)
pub fn rotate(&mut self, angle: impl Into<Radians>)
Applies a rotation in radians to the current transform of the Frame
.
Sourcepub fn scale(&mut self, scale: impl Into<f32>)
pub fn scale(&mut self, scale: impl Into<f32>)
Applies a uniform scaling to the current transform of the Frame
.
Sourcepub fn scale_nonuniform(&mut self, scale: impl Into<Vector>)
pub fn scale_nonuniform(&mut self, scale: impl Into<Vector>)
Applies a non-uniform scaling to the current transform of the Frame
.
Sourcepub fn into_geometry(self) -> Renderer::Geometry
pub fn into_geometry(self) -> Renderer::Geometry
Turns the Frame
into its underlying geometry.
Auto Trait Implementations§
impl<Renderer> Freeze for Frame<Renderer>
impl<Renderer> RefUnwindSafe for Frame<Renderer>
impl<Renderer> Send for Frame<Renderer>
impl<Renderer> Sync for Frame<Renderer>
impl<Renderer> Unpin for Frame<Renderer>
impl<Renderer> UnwindSafe for Frame<Renderer>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn 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