#[non_exhaustive]pub enum DrawCommand {
Show 22 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,
},
SetBlendMode {
mode: BlendMode,
},
BackdropBlur {
rect: Rect,
blur_radius: f32,
},
}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.
Fields
SetBlendMode
Set the blend mode for all subsequent draw commands.
The blend mode remains in effect until the next SetBlendMode command
or the end of the draw list. The initial blend mode at the start of
every frame is BlendMode::Normal.
Backends that do not support non-Normal blend modes may ignore this command and continue rendering with source-over compositing.
BackdropBlur
Apply a Gaussian blur to the content already rendered behind this rect (frosted-glass / backdrop-blur effect).
The blur is applied to the colour data that has been rendered into the
target before this command. The blurred result replaces the content
in rect on the target. Commands issued after BackdropBlur paint
on top of the blurred backdrop.
Backends that do not support backdrop blur may ignore this command.
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 ==.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
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>
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 more