motion_core/drawing/command.rs
1//! Device drawing command records.
2
3use super::*;
4
5/// A fill or isolated-layer boundary; more primitives await their contracts.
6#[derive(Clone, Debug, PartialEq)]
7#[non_exhaustive]
8pub enum DrawCommand {
9 /// Particle instances, independent of path strips.
10 ParticleInstances {
11 /// Immutable validated instance/style/program payload.
12 batch: Arc<dyn crate::instances::InstanceBatch>,
13 /// Local-to-device mapping.
14 transform: Transform,
15 },
16 /// Begins a source-only filter capture in an independent geometric domain.
17 PushFilterLayer {
18 /// Device bounds of the input; preparation derives intermediate/output bounds.
19 bounds: Rect,
20 /// Validated device-unit filters in declaration order.
21 filters: Vec<crate::Filter>,
22 },
23 /// Begins isolated composition of subsequent commands.
24 PushLayer {
25 /// Group opacity, retained as f64 until preparation.
26 opacity: f64,
27 /// Conservative device-coordinate capture bounds, not a clip.
28 bounds: Rect,
29 /// Mode applied once against the parent when this layer completes.
30 blend_mode: BlendMode,
31 /// Optional path coverage applied once before layer opacity and blending.
32 clip: Option<PathClip>,
33 },
34 /// Begins isolation with an additional geometric rectangle clip.
35 PushRectLayer {
36 /// Opacity applied after the completed subtree is clipped.
37 opacity: f64,
38 /// Conservative device capture bounds, not a clipping region.
39 bounds: Rect,
40 /// Mode applied once against the immediate parent backdrop.
41 blend_mode: BlendMode,
42 /// Independent path coverage, retaining its multiplicative semantics.
43 clip: Option<PathClip>,
44 /// Device rectangle intersected with ancestor geometric clips.
45 rect_clip: RectClip,
46 },
47 /// Begins isolation with geometric Shape intersection and optional rectangle.
48 PushShapeLayer {
49 /// Opacity applied after the subtree is clipped.
50 opacity: f64,
51 /// Conservative device capture bounds, not a clipping region.
52 bounds: Rect,
53 /// Mode applied once against the immediate parent backdrop.
54 blend_mode: BlendMode,
55 /// Independent multiplicative path coverage.
56 clip: Option<PathClip>,
57 /// Optional additional geometric rectangle on this same layer.
58 rect_clip: Option<RectClip>,
59 /// Shape region intersected with all geometric ancestors.
60 shape_clip: ShapeClip,
61 },
62 /// Ends the most recent isolated layer.
63 PopLayer,
64 /// Begins isolated mask artwork for the current completed layer.
65 BeginMask {
66 /// Extraction mode applied once at EndMask.
67 mode: MaskMode,
68 },
69 /// Applies completed mask artwork; only PopLayer may follow in that layer.
70 EndMask,
71 /// Fills an axis-aligned logical rectangle, preserving its opposite corners.
72 FillRect {
73 /// Local f64 bounds, independent of the output scale.
74 bounds: Rect,
75 /// Local-to-device mapping; identity in standalone Canvas recording.
76 transform: Transform,
77 /// Floating paint.
78 paint: Paint,
79 },
80 /// Fills a logical path; open contours close implicitly for filling.
81 Fill {
82 /// Shared checked f64 geometry, flattened only by the backend.
83 path: Arc<Path2D>,
84 /// Local-to-device mapping; identity in standalone Canvas recording.
85 transform: Transform,
86 /// floating paint.
87 paint: Paint,
88 /// Explicit contour interpretation, retained without approximation.
89 rule: FillRule,
90 },
91}