#[non_exhaustive]pub enum DrawCommand {
Show 20 variants
PushClip {
rect: Rect,
},
PopClip,
FillRect {
rect: Rect,
color: Color,
},
StrokeRect {
rect: Rect,
thickness: f32,
color: Color,
},
FillRoundedRect {
rect: Rect,
radius: f32,
color: Color,
},
FillRoundedRectPerCorner {
rect: Rect,
radii: [f32; 4],
color: Color,
},
FillCircle {
center: Point,
radius: f32,
color: Color,
},
FillEllipse {
center: Point,
rx: f32,
ry: f32,
color: Color,
},
Line {
from: Point,
to: Point,
color: Color,
},
LineAa {
from: Point,
to: Point,
color: Color,
},
LineThick {
from: Point,
to: Point,
width: f32,
color: Color,
},
LineDashed {
from: Point,
to: Point,
dash_len: f32,
gap_len: f32,
color: Color,
},
FillPath {
path: PathData,
color: Color,
},
StrokePath {
path: PathData,
style: StrokeStyle,
color: Color,
},
LinearGradient {
rect: Rect,
start: Point,
end: Point,
stops: Vec<GradientStop>,
},
RadialGradient {
rect: Rect,
center: Point,
radius: f32,
stops: Vec<GradientStop>,
},
Image {
image: ImageData,
dest: Rect,
filter: ImageFilter,
},
NineSlice {
image: ImageData,
dest: Rect,
insets: [u32; 4],
},
BoxShadow {
rect: Rect,
offset: Point,
blur_radius: f32,
color: Color,
},
DrawText {
rect: Rect,
text: String,
font: FontSpec,
color: Color,
},
}Expand description
A single, backend-agnostic draw operation.
Commands are stored in a DrawList and later replayed by a
RenderBackend. The enum is #[non_exhaustive] so that new variants
can be added without breaking downstream code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PushClip
Push a rectangular clip region onto the clip stack.
All subsequent commands are clipped to the intersection of active clip
rectangles until the matching DrawCommand::PopClip.
PopClip
Pop the most recently pushed clip rectangle from the clip stack.
FillRect
Fill an axis-aligned rectangle with a solid colour.
StrokeRect
Stroke the outline of an axis-aligned rectangle.
Fields
FillRoundedRect
Fill a rectangle with uniformly rounded corners.
Fields
FillRoundedRectPerCorner
Fill a rectangle with per-corner radii.
radii is [top-left, top-right, bottom-right, bottom-left].
Fields
FillCircle
Fill a circle with a solid colour.
Fields
FillEllipse
Fill an ellipse with a solid colour.
Fields
Line
Draw a 1-pixel aliased line segment.
Fields
LineAa
Draw a 1-pixel anti-aliased line segment.
Fields
LineThick
Draw a thick, filled line segment.
Fields
LineDashed
Draw a dashed line segment.
Fields
FillPath
Fill a path with a solid colour.
StrokePath
Stroke a path with a solid colour and style.
Fields
style: StrokeStyleStroke parameters (width, join, cap, miter limit).
LinearGradient
Fill a rectangular region with a linear gradient.
Fields
stops: Vec<GradientStop>Colour stops defining the ramp.
RadialGradient
Fill a rectangular region with a radial gradient.
Fields
stops: Vec<GradientStop>Colour stops defining the ramp.
Image
Blit a raw RGBA image into a destination rectangle.
Fields
filter: ImageFilterResampling filter to use when scaling.
NineSlice
Draw an image using 9-slice scaling.
insets is [top, right, bottom, left] in pixels of the source image.
Fields
BoxShadow
Draw a box shadow behind a rectangle.
Fields
DrawText
Draw text into a rectangle.
Full shaping is delegated to the backend; this command is a v1
placeholder. Backends that do not support text return Err.
Trait Implementations§
Source§impl Clone for DrawCommand
impl Clone for DrawCommand
Source§fn clone(&self) -> DrawCommand
fn clone(&self) -> DrawCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DrawCommand
impl Debug for DrawCommand
Source§impl PartialEq for DrawCommand
impl PartialEq for DrawCommand
Source§fn eq(&self, other: &DrawCommand) -> bool
fn eq(&self, other: &DrawCommand) -> bool
self and other values to be equal, and is used by ==.