DrawList

#![allow(unused)]
fn main() {
pub struct Color { pub r: u8, pub g: u8, pub b: u8, pub a: f64 }

pub enum Cmd {
    Stroke { path: CubicBez, width: f64, color: Color },
    FillCircle { center: Vec2, r: f64, color: Color },
}

pub type DrawList = Vec<Cmd>;
}

The intermediate representation a scene returns. It is deliberately not a scene graph: each frame is a fresh flat list of primitives. Renderers consume it top-to-bottom (later commands paint over earlier ones).

Two primitives so far — cubic-Bezier stroke and filled circle — are enough to build every demo in this book, because straight segments are cubics with collinear control points. As new geometry becomes worth first-classing (paths, polygons, text) it lands here.

Color is plain RGB(A) with r/g/b: u8 and a: f64. Pick mid-saturation colors so the demos read on both light and dark mdBook themes.

Source

The DrawList type is used by every example in this book — see any of the Vec2, CubicBez, ArcLen, or Easing pages for concrete uses.