pub enum DrawCmd {
Fill {
path: Path,
paint: Fill,
opacity: f64,
},
Stroke {
path: Path,
paint: Stroke,
style: LineStyle,
opacity: f64,
},
Text {
text: String,
x: f64,
y: f64,
style: TextStyle,
},
Image {
image: HtmlImageElement,
x: f64,
y: f64,
width: f64,
height: f64,
},
Clip {
path: Path,
},
PopClip,
Strip {
points: Vec<Point>,
baseline: f32,
paint: Fill,
opacity: f64,
},
}Expand description
A single drawing instruction in the display list.
The display list is the boundary between the chart model and the rendering backends: the model produces it, and every backend knows how to replay it. Nothing above this layer mentions WebGPU, WebGL, or Canvas2D, which is what lets a single API serve all three.
Variants§
Fill
Fills a path.
Fields
Stroke
Strokes a path.
Fields
Text
Draws a text run.
Fields
Image
Draws an image.
Fields
image: HtmlImageElementThe image element to draw.
Clip
Intersects the clip region with a path.
PopClip
Restores the clip region that was in effect before the matching
DrawCmd::Clip.
Strip
Draws a filled triangle strip, the shape of an area chart.
The strip is a first-class instruction rather than a path so the GPU backends can emit it without running the tessellator: a strip is already triangles, and the area series is the hottest path in the whole crate.