pub enum Node {
Container {
children: Vec<Arc<Node>>,
},
Transform {
matrix: Affine2,
child: Arc<Node>,
},
Opacity {
alpha: f32,
child: Arc<Node>,
},
Clip {
shape: ClipShape,
child: Arc<Node>,
},
Rect {
bounds: Rect,
brush: Brush,
corner: f32,
corners: Option<[f32; 4]>,
},
Shadow {
origin: Vec2,
size: Vec2,
radius: f32,
spread: f32,
blur: f32,
color: Color,
inner: bool,
rect_origin: Vec2,
},
Border {
origin: Vec2,
size: Vec2,
widths: [f32; 4],
color: Color,
side_colors: Option<[Color; 4]>,
radius: f32,
corners: Option<[f32; 4]>,
},
Outline {
origin: Vec2,
size: Vec2,
stroke: Color,
width: f32,
radius: f32,
},
Text {
run: ExtractedText,
},
Image {
image: ExtractedImage,
blob: Option<Arc<dyn Any + Send + Sync>>,
},
Svg {
payload: Arc<dyn Any + Send + Sync>,
},
Native {
extension_id: Arc<str>,
payload: Arc<dyn Any + Send + Sync>,
},
}Expand description
One node in the retained scene-graph tree. The tree is produced each tick by
transform_extracted_to_nodes and rendered by the back-end walker.
Children - wherever they appear - are held as Arc<Node> so identical subtrees share storage and the
inter-frame diff can short-circuit on Arc::ptr_eq. Leaf variants own their parameters by value (cheap
copies, the inner brush already shares its stop array via Arc<[...]>).
Variants§
Container
Ordered list of children painted back-to-front. The tree root is always a Container.
Transform
Affine transform pushed onto the back-end’s transform stack. Wraps a single child subtree.
Maps to QSGTransformNode::setMatrix / gtk_snapshot_push_transform.
Opacity
Opacity multiplier pushed onto the back-end’s compositing stack. Multiplies into the alpha of every
descendant - including nested Opacity groups. Wraps a single child subtree.
Maps to QSGOpacityNode::setOpacity / gtk_snapshot_push_opacity.
Clip
Clip region pushed onto the back-end’s clip stack. Descendants are masked to shape. Wraps a single
child subtree.
Maps to QSGClipNode (scissor when rectangular, stencil when rounded) /
gtk_snapshot_push_clip / gtk_snapshot_push_rounded_clip. Authored from
overflow: hidden containers and <scroll> viewports.
Rect
Filled rectangle leaf - solid or gradient.
Maps to QSGSimpleRectNode / GskColorNode / gradient nodes.
Fields
Shadow
Shadow leaf - outer drop shadow or inset shadow.
Outer maps to gtk_snapshot_append_outset_shadow / QSGGeometryNode + blur material;
inner maps to gtk_snapshot_append_inset_shadow.
Fields
Border
CSS border leaf - the ring between the border box and the padding
box, filled with one solid color. Per-side widths supported;
distinct from Node::Outline, which strokes centered on the box
edge and never affects layout.
Maps to GskBorderNode / a QSGGeometryNode ring.
Fields
Outline
Stroked outline leaf - typically a focus ring.
Maps to QSGGeometryNode (line list) / GskBorderNode.
Fields
Text
Text leaf - one shaped run for now. Future BiDi rewrite (wave 5) lifts this to a Vec<ShapedRunRef>.
Maps to QSGTextNode / GskTextNode. The leaf carries the unshaped string + style; the renderer
drives the shaper because text shaping is &mut TextShaper-bound and can’t sit in an immutable IR.
Fields
run: ExtractedTextWrapped legacy ExtractedText - keeps the field set stable while wave 2 ships the IR.
Wave 5 BiDi rewrites this to a Vec<ShapedRunRef> + baseline.
Image
Raster image leaf.
Maps to QSGSimpleTextureNode / GskTextureNode. Wraps the legacy ExtractedImage payload so the
existing pipeline keeps its blob-identity GPU upload cache.
Fields
image: ExtractedImageWrapped legacy ExtractedImage.
Svg
Vector image leaf (SVG pre-rendered into a vello sub-scene).
Maps to QQuickSvgItem -> SG subtree / GskCairoNode (or a pre-baked GskTextureNode).
Stored as an opaque Arc<dyn Any + Send + Sync> so lumen-core doesn’t need to depend on vello.
Fields
Native
Native back-end escape hatch - apps record custom RHI/wgpu commands.
Maps to QSGRenderNode / GskGLShaderNode. The renderer downcasts payload based on extension_id.