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    /// Applies a backdrop blur sampling the previously rendered pixels beneath `rect`.
38    BackdropBlur {
39        /// Output bounds in logical pixels.
40        rect: Rect,
41        /// Corner radii mask in logical pixels.
42        radius: CornerRadius,
43        /// Gaussian blur radius in logical pixels.
44        blur_radius: f32,
45    },
46    /// Draws a laid-out text run using the shared deterministic glyph atlas.
47    TextRun {
48        /// Bounding rectangle in logical pixels.
49        rect: Rect,
50        /// UTF-8 text string.
51        text: String,
52        /// Typography style.
53        style: TextStyle,
54    },
55    /// Draws a blinking text-input caret aligned to exact rasterized glyph advances.
56    TextCaret {
57        /// Text layout bounding rectangle in logical pixels.
58        text_rect: Rect,
59        /// Input inner content clip rectangle in logical pixels.
60        content_rect: Rect,
61        /// Active input text preceding the caret.
62        text: String,
63        /// Typography style matching the input's `TextRun`.
64        style: TextStyle,
65        /// Caret height in logical pixels.
66        caret_height: f32,
67        /// Caret fill color.
68        color: Color,
69        /// Whether the input wraps across multiple lines.
70        multiline: bool,
71    },
72    /// Blits a decoded RGBA8 image buffer into `rect`.
73    Image {
74        /// Destination bounds.
75        rect: Rect,
76        /// Image pixel buffer.
77        buffer: ImageBuffer,
78        /// Corner radii mask.
79        radius: CornerRadius,
80    },
81    /// Draws a straight anti-aliased line segment (used by custom canvases and dividers).
82    Line {
83        /// Start point.
84        from: Point,
85        /// End point.
86        to: Point,
87        /// Line color.
88        color: Color,
89        /// Stroke width.
90        width: f32,
91    },
92    /// Draws a filled anti-aliased circle (used by badges, avatars, spinners, and custom canvases).
93    Circle {
94        /// Center point.
95        center: Point,
96        /// Circle radius.
97        radius: f32,
98        /// Fill color.
99        color: Color,
100    },
101    /// Draws a filled triangle primitive (used by 2D game meshes, spaceships, lasers, and polygons).
102    Triangle {
103        /// First vertex in logical pixels.
104        p0: Point,
105        /// Second vertex in logical pixels.
106        p1: Point,
107        /// Third vertex in logical pixels.
108        p2: Point,
109        /// Fill color.
110        color: Color,
111    },
112    /// Blits a cropped sub-region of an `ImageBuffer` sprite sheet with optional tint color.
113    SpriteRegion {
114        /// Destination bounds in logical pixels.
115        rect: Rect,
116        /// Source sprite-sheet RGBA8 buffer.
117        buffer: ImageBuffer,
118        /// Source pixel sub-rectangle `(x, y, w, h)`.
119        src_rect: Rect,
120        /// Multiplicative tint color (`COLOR_WHITE` for untinted).
121        tint: Color,
122    },
123    /// Pushes an axis-aligned clip rectangle onto the clip stack.
124    PushClip(Rect),
125    /// Pushes a rounded-rectangle clip mask onto the clip stack, balanced by `PopClip`.
126    PushRoundedClip {
127        /// Clip rectangle bounds in logical pixels.
128        rect: Rect,
129        /// Corner radii in logical pixels.
130        radius: CornerRadius,
131    },
132    /// Pops the top clip rectangle from the clip stack.
133    PopClip,
134}