pub enum DrawCommand {
Show 15 variants
Clear(Color),
FillRoundedRect {
rect: Rect,
color: Color,
radius: CornerRadius,
border: Border,
},
LinearGradientRect {
rect: Rect,
gradient: LinearGradient,
radius: CornerRadius,
},
BoxShadow {
rect: Rect,
radius: CornerRadius,
shadow: Shadow,
},
BackdropBlur {
rect: Rect,
radius: CornerRadius,
blur_radius: f32,
},
TextRun {
rect: Rect,
text: String,
style: TextStyle,
},
TextCaret {
text_rect: Rect,
content_rect: Rect,
text: String,
style: TextStyle,
caret_height: f32,
color: Color,
multiline: bool,
},
Image {
rect: Rect,
buffer: ImageBuffer,
radius: CornerRadius,
},
Line {
from: Point,
to: Point,
color: Color,
width: f32,
},
Circle {
center: Point,
radius: f32,
color: Color,
},
Triangle {
p0: Point,
p1: Point,
p2: Point,
color: Color,
},
SpriteRegion {
rect: Rect,
buffer: ImageBuffer,
src_rect: Rect,
tint: Color,
},
PushClip(Rect),
PushRoundedClip {
rect: Rect,
radius: CornerRadius,
},
PopClip,
}Expand description
Backend-agnostic vector/UI drawing primitive emitted by PaintPass and consumed by all renderers.
Variants§
Clear(Color)
Clears the target surface to Color.
FillRoundedRect
Draws a rounded or sharp filled rectangle with optional border stroke.
Fields
radius: CornerRadiusCorner radii.
LinearGradientRect
Draws a two-stop linear gradient inside a rounded rectangle.
BoxShadow
Draws a soft drop shadow under a rounded rectangle.
Fields
radius: CornerRadiusCorner radii.
BackdropBlur
Applies a backdrop blur sampling the previously rendered pixels beneath rect.
Fields
radius: CornerRadiusCorner radii mask in logical pixels.
TextRun
Draws a laid-out text run using the shared deterministic glyph atlas.
Fields
TextCaret
Draws a blinking text-input caret aligned to exact rasterized glyph advances.
Fields
Image
Blits a decoded RGBA8 image buffer into rect.
Line
Draws a straight anti-aliased line segment (used by custom canvases and dividers).
Fields
Circle
Draws a filled anti-aliased circle (used by badges, avatars, spinners, and custom canvases).
Triangle
Draws a filled triangle primitive (used by 2D game meshes, spaceships, lasers, and polygons).
Fields
SpriteRegion
Blits a cropped sub-region of an ImageBuffer sprite sheet with optional tint color.
Fields
buffer: ImageBufferSource sprite-sheet RGBA8 buffer.
PushClip(Rect)
Pushes an axis-aligned clip rectangle onto the clip stack.
PushRoundedClip
Pushes a rounded-rectangle clip mask onto the clip stack, balanced by PopClip.
Fields
radius: CornerRadiusCorner radii in logical pixels.
PopClip
Pops the top clip rectangle from the clip stack.