# Xui.Core.Canvas.Composition

Assembly: **Xui.Core** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`class Node`](#api-9c2f713e7eb9b759)
- [`ref struct Node.Enumerator`](#api-e40cb8a64b5be7a7)

<a id="api-9c2f713e7eb9b759"></a>

## `class Node`

A platform-independent retained composition element with identity, placement and children.

Applications declare composition through ICompositionContext.Group and GpuSurface. A retained context reconciles those declarations by key into nodes. A platform presenter maps each node to suitable resources: native views or layers, compositor visuals, GPU surfaces, or drawing replayed into a parent. A node does not require a native view or an intermediate bitmap. Content can remain unchanged while its placement and presentation are updated.



Immediate and export contexts can implement the same declarations without constructing this tree. SVG currently emits groups directly. iOS presents the retained tree using UIKit views, effect views and MTKView GPU surfaces. Android presents backed graphics groups through Java views and hardware display lists, with Vulkan presentation for GPU leaves. Windows currently draws groups immediately. Native visuals or offscreen GPU textures are possible backend strategies, not capabilities guaranteed by this base class. GPU surface support and the need for a portable fallback are reported by ICompositionContext.GpuSurface.



This is a rendering/composition model, not the Xui UI view tree. It does not supply layout, input routing, focus or accessibility semantics merely because a backend uses native views. Derived nodes own their content, children and any platform resources, released by overriding DisposeCore. The base provides presentation properties and an idempotent disposal entry point.

```csharp
public abstract partial class Node
{
    public ref struct Enumerator
    {
        public readonly Node Current { get; }

        public bool MoveNext();
    }
}
public abstract partial class Node
{
    public virtual int Count { get; }

    public virtual Node this[int index] { get; }

    public Enumerator GetEnumerator();
}
public abstract partial class Node : IDisposable
{
    public GroupOptions Options { get; }
    public Rect RasterBounds { get; }
    public AffineTransform Placement { get; }
    public nfloat Scale { get; }
    public bool Updating { get; }

    public void Dispose();
    protected virtual void DisposeCore();
}
```

<a id="api-219b130a3058e22e"></a>

### [`int Node.Count`](#api-219b130a3058e22e)


```csharp
public virtual int Count { get; }
```

Number of visible children in back-to-front order. Leaf nodes return zero.

<a id="api-0de8eebede8cce31"></a>

### [`void Node.Dispose()`](#api-0de8eebede8cce31)


```csharp
public void Dispose();
```

Releases the node&#39;s owned resources once, including derived content and children.

<a id="api-1c30a2392f72cdc4"></a>

### [`void Node.DisposeCore()`](#api-1c30a2392f72cdc4)


```csharp
protected virtual void DisposeCore();
```

Overrides release their owned content, children and platform resources, then call base.

<a id="api-be6d7f3adbe1119d"></a>

### [`Enumerator Node.GetEnumerator()`](#api-be6d7f3adbe1119d)


```csharp
public Enumerator GetEnumerator();
```

Enumerates visible children without allocating or boxing an enumerator.

Do not mutate the hierarchy during enumeration.

<a id="api-7dd7fcca1868bc65"></a>

### [`Node Node.this[int index]`](#api-7dd7fcca1868bc65)


```csharp
public virtual Node this[int index] { get; }
```

Returns the visible child at the given index.

<a id="api-5c69bf804fbc74bf"></a>

### [`GroupOptions Node.Options`](#api-5c69bf804fbc74bf)


```csharp
public GroupOptions Options { get; }
```

Stable sibling identity, effects, clipping and content-update declarations.

<a id="api-fb6e27c273673e5c"></a>

### [`AffineTransform Node.Placement`](#api-fb6e27c273673e5c)


```csharp
public AffineTransform Placement { get; }
```

Resolved transform relative to the parent presentation surface.

<a id="api-cf4a5bdac251021e"></a>

### [`Rect Node.RasterBounds`](#api-cf4a5bdac251021e)


```csharp
public Rect RasterBounds { get; }
```

Resolved content bounds used for drawing or native surface placement.

<a id="api-54b59cf686813783"></a>

### [`NFloat Node.Scale`](#api-54b59cf686813783)


```csharp
public nfloat Scale { get; }
```

Device scale used to present the content.

<a id="api-00c7eaf64bbf6e11"></a>

### [`bool Node.Updating`](#api-00c7eaf64bbf6e11)


```csharp
public bool Updating { get; }
```

Whether this frame requested fresh content for this node.


<a id="api-e40cb8a64b5be7a7"></a>

## `ref struct Node.Enumerator`

Stack-only enumerator over a node&#39;s visible children.

```csharp
public ref struct Enumerator
{
    public readonly Node Current { get; }

    public bool MoveNext();
}
```

<a id="api-3fd1c9e508fe9ed3"></a>

### [`readonly Node Enumerator.Current`](#api-3fd1c9e508fe9ed3)


```csharp
public readonly Node Current { get; }
```

The current child. Valid only after MoveNext returns true.

<a id="api-a287c9e581409abd"></a>

### [`bool Enumerator.MoveNext()`](#api-a287c9e581409abd)


```csharp
public bool MoveNext();
```

Advances to the next visible child in presentation order.

