Skip to main content

Node

Enum Node 

Source
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.

Fields

§children: Vec<Arc<Node>>

Ordered children (paint order = vec order).

§

Transform

Affine transform pushed onto the back-end’s transform stack. Wraps a single child subtree.

Maps to QSGTransformNode::setMatrix / gtk_snapshot_push_transform.

Fields

§matrix: Affine2

Affine matrix.

§child: Arc<Node>

Child subtree.

§

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.

Fields

§alpha: f32

[0.0, 1.0] multiplier applied to descendant alpha.

§child: Arc<Node>

Child subtree.

§

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.

Fields

§shape: ClipShape

Clip-region shape.

§child: Arc<Node>

Child subtree.

§

Rect

Filled rectangle leaf - solid or gradient.

Maps to QSGSimpleRectNode / GskColorNode / gradient nodes.

Fields

§bounds: Rect

Bounding rect in window coordinates.

§brush: Brush

Fill brush.

§corner: f32

Uniform corner radius. 0.0 = sharp.

§corners: Option<[f32; 4]>

Per-corner radii [tl, tr, br, bl]; None = uniform corner.

§

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

§origin: Vec2

Top-left in window coordinates.

§size: Vec2

Source rect size.

§radius: f32

Corner radius.

§spread: f32

CSS spread radius (inflates / deflates the rect pre-blur).

§blur: f32

Gaussian blur std-dev.

§color: Color

Shadow color.

§inner: bool

true for an inset shadow (clipped to the source rect, drawn at the negated offset).

§rect_origin: Vec2

Source rect top-left without the per-shadow offset. Used by inset shadows for the clip rect and to flip the offset; ignored for outer shadows.

§

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

§origin: Vec2

Border-box top-left in window coordinates.

§size: Vec2

Border-box size.

§widths: [f32; 4]

Per-side widths [top, right, bottom, left].

§color: Color

Solid border color.

§side_colors: Option<[Color; 4]>

Per-side color overrides [top, right, bottom, left].

§radius: f32

Outer corner radius.

§corners: Option<[f32; 4]>

Per-corner outer radii [tl, tr, br, bl]; None = uniform.

§

Outline

Stroked outline leaf - typically a focus ring.

Maps to QSGGeometryNode (line list) / GskBorderNode.

Fields

§origin: Vec2

Top-left in window coordinates.

§size: Vec2

Box size being outlined.

§stroke: Color

Stroke color.

§width: f32

Stroke width.

§radius: f32

Uniform corner radius (matches the outlined box).

§

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: ExtractedText

Wrapped 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: ExtractedImage

Wrapped legacy ExtractedImage.

§blob: Option<Arc<dyn Any + Send + Sync>>

Opaque blob carrier - typically Arc<lumen_assets::ExtractedImageBlob>. None when the renderer doesn’t need a separate blob (e.g. headless).

§

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

§payload: Arc<dyn Any + Send + Sync>

Type-erased SVG payload. The concrete type is typically Arc<lumen_assets::ExtractedSvg>.

§

Native

Native back-end escape hatch - apps record custom RHI/wgpu commands.

Maps to QSGRenderNode / GskGLShaderNode. The renderer downcasts payload based on extension_id.

Fields

§extension_id: Arc<str>

String identifier for the native extension (e.g. "lumen.native.wgpu").

§payload: Arc<dyn Any + Send + Sync>

Opaque payload the back-end downcasts.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&ExtractedBorder> for Node

Source§

fn from(b: &ExtractedBorder) -> Self

Converts to this type from the input type.
Source§

impl From<&ExtractedImage> for Node

Source§

fn from(i: &ExtractedImage) -> Self

Converts to this type from the input type.
Source§

impl From<&ExtractedOutline> for Node

Source§

fn from(o: &ExtractedOutline) -> Self

Converts to this type from the input type.
Source§

impl From<&ExtractedRect> for Node

Source§

fn from(r: &ExtractedRect) -> Self

Converts to this type from the input type.
Source§

impl From<&ExtractedShadow> for Node

Source§

fn from(s: &ExtractedShadow) -> Self

Converts to this type from the input type.
Source§

impl From<&ExtractedText> for Node

Source§

fn from(t: &ExtractedText) -> Self

Converts to this type from the input type.
Source§

impl From<&SvgPayload> for Node

Source§

fn from(s: &SvgPayload) -> Self

Converts to this type from the input type.
Source§

impl From<(&ExtractedImage, &ImageBlob)> for Node

Source§

fn from((i, b): (&ExtractedImage, &ImageBlob)) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Node

§

impl !RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl !UnwindSafe for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ConditionalSend for T
where T: Send,