Skip to main content

euv_core/render/command/
enum.rs

1use super::*;
2
3/// Backend-agnostic vector/UI drawing primitive emitted by `PaintPass` and consumed by all renderers.
4#[derive(Clone, Debug, PartialEq)]
5pub enum DrawCommand {
6    /// Clears the target surface to `Color`.
7    Clear(Color),
8    /// Draws a rounded or sharp filled rectangle with optional border stroke.
9    FillRoundedRect {
10        /// Bounds in logical pixels.
11        rect: Rect,
12        /// Fill color.
13        color: Color,
14        /// Corner radii.
15        radius: CornerRadius,
16        /// Optional border stroke.
17        border: Border,
18    },
19    /// Draws a two-stop linear gradient inside a rounded rectangle.
20    LinearGradientRect {
21        /// Bounds in logical pixels.
22        rect: Rect,
23        /// Gradient specification.
24        gradient: LinearGradient,
25        /// Corner radii.
26        radius: CornerRadius,
27    },
28    /// Draws a soft drop shadow under a rounded rectangle.
29    BoxShadow {
30        /// Casting box bounds.
31        rect: Rect,
32        /// Corner radii.
33        radius: CornerRadius,
34        /// Shadow parameters.
35        shadow: Shadow,
36    },
37    /// Draws a laid-out text run using the shared deterministic glyph atlas.
38    TextRun {
39        /// Bounding rectangle in logical pixels.
40        rect: Rect,
41        /// UTF-8 text string.
42        text: String,
43        /// Typography style.
44        style: TextStyle,
45    },
46    /// Blits a decoded RGBA8 image buffer into `rect`.
47    Image {
48        /// Destination bounds.
49        rect: Rect,
50        /// Image pixel buffer.
51        buffer: ImageBuffer,
52        /// Corner radii mask.
53        radius: CornerRadius,
54    },
55    /// Draws a straight anti-aliased line segment (used by custom canvases and dividers).
56    Line {
57        /// Start point.
58        from: Point,
59        /// End point.
60        to: Point,
61        /// Line color.
62        color: Color,
63        /// Stroke width.
64        width: f32,
65    },
66    /// Draws a filled anti-aliased circle (used by badges, avatars, spinners, and custom canvases).
67    Circle {
68        /// Center point.
69        center: Point,
70        /// Circle radius.
71        radius: f32,
72        /// Fill color.
73        color: Color,
74    },
75    /// Draws a filled triangle primitive (used by 2D game meshes, spaceships, lasers, and polygons).
76    Triangle {
77        /// First vertex in logical pixels.
78        p0: Point,
79        /// Second vertex in logical pixels.
80        p1: Point,
81        /// Third vertex in logical pixels.
82        p2: Point,
83        /// Fill color.
84        color: Color,
85    },
86    /// Blits a cropped sub-region of an `ImageBuffer` sprite sheet with optional tint color.
87    SpriteRegion {
88        /// Destination bounds in logical pixels.
89        rect: Rect,
90        /// Source sprite-sheet RGBA8 buffer.
91        buffer: ImageBuffer,
92        /// Source pixel sub-rectangle `(x, y, w, h)`.
93        src_rect: Rect,
94        /// Multiplicative tint color (`COLOR_WHITE` for untinted).
95        tint: Color,
96    },
97    /// Pushes an axis-aligned clip rectangle onto the clip stack.
98    PushClip(Rect),
99    /// Pops the top clip rectangle from the clip stack.
100    PopClip,
101}