pub enum Cmd {
FillRect {
rect: Rect,
color: Color,
blend: BlendMode,
},
FillObb {
obb: Obb,
color: Color,
blend: BlendMode,
},
FillDisc {
center: PointF,
radius: f32,
color: Color,
blend: BlendMode,
},
FillArc {
center: PointF,
r_outer: f32,
r_inner: f32,
start_cos: f32,
start_sin: f32,
end_cos: f32,
end_sin: f32,
extent: f32,
color: Color,
blend: BlendMode,
},
StrokeLine {
a: PointF,
b: PointF,
width: f32,
color: Color,
blend: BlendMode,
},
DrawText {
position: (i32, i32),
text: String,
color: Color,
},
DrawPixels {
position: (i32, i32),
pixels: Vec<Color>,
width: u32,
height: u32,
},
SetClip {
rect: Option<Rect>,
},
Barrier,
}Expand description
A single drawing command. Z-order is list position in the
CommandList that contains it.
Variants§
FillRect
Filled axis-aligned rectangle.
FillObb
Anti-aliased filled oriented bounding box (rotated rectangle).
Fields
FillDisc
Anti-aliased filled disc (filled circle).
Fields
FillArc
Anti-aliased annular arc / pie slice. See
crate::raster::rasterize_arc for the angle convention.
Fields
StrokeLine
Anti-aliased stroked line of given width (square caps).
Fields
DrawText
Text draw — owned String so the cmd can outlive the original
borrow. See module docs for the alloc trade-off.
Fields
DrawPixels
Pixel-buffer blit — owned Vec<Color> for the same reason as
Cmd::DrawText’s string.
Fields
SetClip
Clip stack marker. Some(rect) pushes a clip; None clears.
Backends should bound subsequent draws to the active clip.
Barrier
Backend flush boundary (compositor swap, telemetry checkpoint). Optimizing backends may not reorder cmds across a Barrier.
Implementations§
Source§impl Cmd
impl Cmd
Sourcepub fn dispatch_to<R: Renderer + ?Sized>(&self, r: &mut R)
pub fn dispatch_to<R: Renderer + ?Sized>(&self, r: &mut R)
Dispatch this cmd onto a Renderer, using the matching trait
method for each variant. This is the default execution semantics
— backends override CommandSink to specialize.