pub type Frame<Renderer = Renderer> = Frame<Renderer>;
Expand description
The frame supported by a renderer.
Aliased Type§
struct Frame<Renderer = Renderer> { /* private fields */ }
Implementations
source§impl<Renderer> Frame<Renderer>where
Renderer: Renderer,
impl<Renderer> Frame<Renderer>where
Renderer: Renderer,
sourcepub fn new(renderer: &Renderer, size: Size) -> Frame<Renderer>
pub fn new(renderer: &Renderer, size: Size) -> Frame<Renderer>
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>)
pub fn draw_image(&mut self, bounds: Rectangle, image: impl Into<Image>)
sourcepub fn with_save<R>(&mut self, f: impl FnOnce(&mut Frame<Renderer>) -> R) -> R
pub fn with_save<R>(&mut self, f: impl FnOnce(&mut Frame<Renderer>) -> 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 Frame<Renderer>) -> R,
) -> R
pub fn with_clip<R>( &mut self, region: Rectangle, f: impl FnOnce(&mut Frame<Renderer>) -> 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 as Renderer>::Geometry
pub fn into_geometry(self) -> <Renderer as Renderer>::Geometry
Turns the Frame
into its underlying geometry.