# Xui.Core.Canvas.Symbols

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

## Types

- [`class SymbolContent`](#api-2d629997b5718a1c)
- [`readonly struct SymbolOptions`](#api-93c8055bb326a2eb)
- [`ref struct SymbolScope`](#api-b11f6d3f5e803315)

<a id="api-2d629997b5718a1c"></a>

## `class SymbolContent`

Immutable, shareable drawing instructions. Recorded placements retain this exact definition, even when its key is subsequently updated. Storage is reclaimed when the last reference dies.

```csharp
public sealed class SymbolContent
{
    public Rect Bounds { get; }
    public int CommandCount { get; }

    public void Replay(IContext context);
}
```

<a id="api-60796fce96c781c3"></a>

### [`Rect SymbolContent.Bounds`](#api-60796fce96c781c3)


```csharp
public Rect Bounds { get; }
```

The local clip and native recording bounds.

<a id="api-c08128dbe9ce5e39"></a>

### [`int SymbolContent.CommandCount`](#api-c08128dbe9ce5e39)


```csharp
public int CommandCount { get; }
```

Number of recorded instructions, useful for diagnostics.

<a id="api-cbb32353b72455af"></a>

### [`SymbolContent.~SymbolContent()`](#api-cbb32353b72455af)

Returns pooled storage after all retained placements are released.

<a id="api-ddc860a9f20abd28"></a>

### [`void SymbolContent.Replay(IContext context)`](#api-ddc860a9f20abd28)


```csharp
public void Replay(IContext context);
```

Portable vector replay. Paint defaults belong to the definition; transform, clip, and brightness come from the placement. Save/Restore isolates changes to drawing state. The current path is consumed, as with other path drawing operations.


<a id="api-93c8055bb326a2eb"></a>

## `readonly struct SymbolOptions`

Identity and local drawing bounds of a reusable symbol.

```csharp
public readonly struct SymbolOptions
{
    public required object Key { get; init; }
    public required Rect Bounds { get; init; }
    public bool HasUpdates { get; init; }
}
```

<a id="api-8a6255ce79e56c79"></a>

### [`Rect SymbolOptions.Bounds`](#api-8a6255ce79e56c79)


```csharp
public required Rect Bounds { get; init; }
```

Local drawing bounds, including strokes. Content is clipped to these bounds.

<a id="api-21492e2e4461eebb"></a>

### [`bool SymbolOptions.HasUpdates`](#api-21492e2e4461eebb)


```csharp
public bool HasUpdates { get; init; }
```

True replaces the definition; false (the default) reuses it when available.

<a id="api-639478c37c0716a7"></a>

### [`object SymbolOptions.Key`](#api-639478c37c0716a7)


```csharp
public required object Key { get; init; }
```

A stable reference, never a boxed value or a serialized identifier.


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

## `ref struct SymbolScope`

A stack-only definition scope. Do not copy a live scope. Dispose before placing the symbol.

```csharp
public ref struct SymbolScope
{
    public bool NeedsDrawing { get; }
    public IContext Context { get; }

    public void Cancel();
    public void Dispose();
}
```

<a id="api-1c0abfe9a5c333c2"></a>

### [`void SymbolScope.Cancel()`](#api-1c0abfe9a5c333c2)


```csharp
public void Cancel();
```

Abandons a failed definition, preserving the previous completed content.

<a id="api-7598f0badefec9b9"></a>

### [`IContext SymbolScope.Context`](#api-7598f0badefec9b9)


```csharp
public IContext Context { get; }
```

The definition canvas; drawing here never draws into the surrounding scene.

<a id="api-b6c54e25b1baaaec"></a>

### [`void SymbolScope.Dispose()`](#api-b6c54e25b1baaaec)


```csharp
public void Dispose();
```

Publishes balanced drawing instructions as immutable reusable content.

<a id="api-34b0474819957dee"></a>

### [`bool SymbolScope.NeedsDrawing`](#api-34b0474819957dee)


```csharp
public bool NeedsDrawing { get; }
```

Whether the caller must supply drawing instructions.

