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