pub struct RenderFrame {
pub commands: Vec<Canvas2DCommand>,
}Expand description
A frame’s worth of render commands.
Fields§
§commands: Vec<Canvas2DCommand>The commands to execute this frame.
Implementations§
Source§impl RenderFrame
impl RenderFrame
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a render frame with an initial capacity.
Sourcepub fn push(&mut self, cmd: Canvas2DCommand)
pub fn push(&mut self, cmd: Canvas2DCommand)
Adds a command to the frame.
Sourcepub fn clear_screen(&mut self, color: Color)
pub fn clear_screen(&mut self, color: Color)
Clears the canvas with a color.
Sourcepub fn fill_rect(
&mut self,
x: f32,
y: f32,
width: f32,
height: f32,
color: Color,
)
pub fn fill_rect( &mut self, x: f32, y: f32, width: f32, height: f32, color: Color, )
Draws a filled rectangle.
Sourcepub fn fill_circle(&mut self, x: f32, y: f32, radius: f32, color: Color)
pub fn fill_circle(&mut self, x: f32, y: f32, radius: f32, color: Color)
Draws a filled circle.
Sourcepub fn fill_text(
&mut self,
text: &str,
x: f32,
y: f32,
font: &str,
color: Color,
)
pub fn fill_text( &mut self, text: &str, x: f32, y: f32, font: &str, color: Color, )
Draws text.
Sourcepub fn fill_text_aligned(
&mut self,
text: &str,
x: f32,
y: f32,
font: &str,
color: Color,
align: TextAlign,
baseline: TextBaseline,
)
pub fn fill_text_aligned( &mut self, text: &str, x: f32, y: f32, font: &str, color: Color, align: TextAlign, baseline: TextBaseline, )
Draws text with alignment options.
Sourcepub fn line(
&mut self,
x1: f32,
y1: f32,
x2: f32,
y2: f32,
color: Color,
line_width: f32,
)
pub fn line( &mut self, x1: f32, y1: f32, x2: f32, y2: f32, color: Color, line_width: f32, )
Draws a line.
Sourcepub fn stroke_rect(
&mut self,
x: f32,
y: f32,
width: f32,
height: f32,
color: Color,
line_width: f32,
)
pub fn stroke_rect( &mut self, x: f32, y: f32, width: f32, height: f32, color: Color, line_width: f32, )
Strokes a rectangle outline.
Trait Implementations§
Source§impl Clone for RenderFrame
impl Clone for RenderFrame
Source§fn clone(&self) -> RenderFrame
fn clone(&self) -> RenderFrame
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RenderFrame
impl Debug for RenderFrame
Source§impl Default for RenderFrame
impl Default for RenderFrame
Source§fn default() -> RenderFrame
fn default() -> RenderFrame
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RenderFrame
impl<'de> Deserialize<'de> for RenderFrame
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RenderFrame
impl PartialEq for RenderFrame
Source§impl Serialize for RenderFrame
impl Serialize for RenderFrame
impl StructuralPartialEq for RenderFrame
Auto Trait Implementations§
impl Freeze for RenderFrame
impl RefUnwindSafe for RenderFrame
impl Send for RenderFrame
impl Sync for RenderFrame
impl Unpin for RenderFrame
impl UnwindSafe for RenderFrame
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more