pub enum DrawCommand {
Path {
points: Vec<Point>,
closed: bool,
style: StrokeStyle,
},
Fill {
path: u32,
color: Color,
rule: FillRule,
},
Rect {
bounds: Rect,
radius: CornerRadius,
style: BoxStyle,
},
Circle {
center: Point,
radius: f32,
style: BoxStyle,
},
Arc {
center: Point,
radius: f32,
start_angle: f32,
end_angle: f32,
color: Color,
},
Text {
content: String,
position: Point,
style: TextStyle,
},
Image {
tensor: u32,
bounds: Rect,
sampling: Sampling,
},
Group {
children: Vec<DrawCommand>,
transform: Transform2D,
},
Clip {
bounds: Rect,
child: Box<DrawCommand>,
},
Opacity {
alpha: f32,
child: Box<DrawCommand>,
},
}Expand description
Drawing primitive - all rendering reduces to these.
Variants§
Path
Draw a path (polyline or polygon)
Fields
§
style: StrokeStyleStroke style
Fill
Fill a path
Rect
Draw a rectangle
Circle
Draw a circle
Arc
Draw an arc (pie slice)
Fields
Text
Draw text
Image
Draw an image from tensor
Fields
Group
Group of commands with transform
Clip
Clip to bounds
Opacity
Apply opacity
Implementations§
Source§impl DrawCommand
impl DrawCommand
Sourcepub const fn filled_rect(bounds: Rect, color: Color) -> DrawCommand
pub const fn filled_rect(bounds: Rect, color: Color) -> DrawCommand
Create a filled rectangle.
Sourcepub const fn rounded_rect(
bounds: Rect,
radius: f32,
color: Color,
) -> DrawCommand
pub const fn rounded_rect( bounds: Rect, radius: f32, color: Color, ) -> DrawCommand
Create a rounded rectangle.
Sourcepub const fn stroked_rect(bounds: Rect, stroke: StrokeStyle) -> DrawCommand
pub const fn stroked_rect(bounds: Rect, stroke: StrokeStyle) -> DrawCommand
Create a stroked rectangle.
Sourcepub const fn filled_circle(
center: Point,
radius: f32,
color: Color,
) -> DrawCommand
pub const fn filled_circle( center: Point, radius: f32, color: Color, ) -> DrawCommand
Create a filled circle.
Sourcepub fn line(from: Point, to: Point, style: StrokeStyle) -> DrawCommand
pub fn line(from: Point, to: Point, style: StrokeStyle) -> DrawCommand
Create a line between two points.
Sourcepub fn with_transform(self, transform: Transform2D) -> DrawCommand
pub fn with_transform(self, transform: Transform2D) -> DrawCommand
Wrap in a group with transform.
Sourcepub fn with_opacity(self, alpha: f32) -> DrawCommand
pub fn with_opacity(self, alpha: f32) -> DrawCommand
Wrap with opacity.
Sourcepub fn with_clip(self, bounds: Rect) -> DrawCommand
pub fn with_clip(self, bounds: Rect) -> DrawCommand
Wrap with clip bounds.
Trait Implementations§
Source§impl Clone for DrawCommand
impl Clone for DrawCommand
Source§fn clone(&self) -> DrawCommand
fn clone(&self) -> DrawCommand
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DrawCommand
impl Debug for DrawCommand
Source§impl<'de> Deserialize<'de> for DrawCommand
impl<'de> Deserialize<'de> for DrawCommand
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DrawCommand, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DrawCommand, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for DrawCommand
impl PartialEq for DrawCommand
Source§fn eq(&self, other: &DrawCommand) -> bool
fn eq(&self, other: &DrawCommand) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DrawCommand
impl Serialize for DrawCommand
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DrawCommand
Auto Trait Implementations§
impl Freeze for DrawCommand
impl RefUnwindSafe for DrawCommand
impl Send for DrawCommand
impl Sync for DrawCommand
impl Unpin for DrawCommand
impl UnsafeUnpin for DrawCommand
impl UnwindSafe for DrawCommand
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