# Xui.Runtime.Software.Raster

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

## Types

- [`class RGBABitmap`](#api-beffcd7a8a170c96)
- [`struct Rect`](#api-0cacedcda54123f3)
- [`class StencilBitmap`](#api-6f51eaf0ac0125d9)

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

## `class RGBABitmap`



```csharp
public unsafe sealed class RGBABitmap : IDisposable
{
    public readonly int Width;
    public readonly int Height;
    public readonly int Stride;
    public RGBA* Pixels { get; }
    public Span<RGBA> Span { get; }
    public Span<Vector<uint>> VectorSpan { get; }

    public RGBABitmap(int width, int height);
    public RGBA this[int x, int y] { get; set; }

    public void Fill(RGBA value = 0);
    public void FillRect(in Rect rect, RGBA value);
    public void InitRect(in Rect rect, RGBA value = 0);
    public void Dispose();
}
```

<a id="api-20c0fd367d89ffa5"></a>

### [`RGBABitmap.RGBABitmap(int width, int height)`](#api-20c0fd367d89ffa5)


```csharp
public RGBABitmap(int width, int height);
```



<a id="api-ecdc2c336f431882"></a>

### [`void RGBABitmap.Dispose()`](#api-ecdc2c336f431882)


```csharp
public void Dispose();
```



<a id="api-0c723d7ff4ee5f00"></a>

### [`void RGBABitmap.Fill(uint value = 0)`](#api-0c723d7ff4ee5f00)


```csharp
public void Fill(RGBA value = 0);
```



<a id="api-2081e2218f16e2d0"></a>

### [`void RGBABitmap.FillRect(in Rect rect, uint value)`](#api-2081e2218f16e2d0)


```csharp
public void FillRect(in Rect rect, RGBA value);
```



<a id="api-66d0fd3b9cfed209"></a>

### [`RGBABitmap.~RGBABitmap()`](#api-66d0fd3b9cfed209)



<a id="api-6a127dfb8b30f2d3"></a>

### [`int RGBABitmap.Height`](#api-6a127dfb8b30f2d3)


```csharp
public readonly int Height;
```



<a id="api-092789a2fa6cb6b6"></a>

### [`void RGBABitmap.InitRect(in Rect rect, uint value = 0)`](#api-092789a2fa6cb6b6)


```csharp
public void InitRect(in Rect rect, RGBA value = 0);
```

Initializes a rectangular region of the bitmap using SIMD, aligned outward to the nearest vector boundary. This method may overdraw slightly beyond the specified rectangle for performance. Suitable for fast clearing of bounds when rendering shapes or tiles.

- **`rect`** — The region to initialize.

- **`value`** — The fill color (default is transparent black).

<a id="api-dc8cf660ce3c5050"></a>

### [`uint RGBABitmap.this[int x, int y]`](#api-dc8cf660ce3c5050)


```csharp
public RGBA this[int x, int y] { get; set; }
```



<a id="api-c1ebfbf437660c82"></a>

### [`uint* RGBABitmap.Pixels`](#api-c1ebfbf437660c82)


```csharp
public RGBA* Pixels { get; }
```



<a id="api-da77477f17642db0"></a>

### [`Span<uint> RGBABitmap.Span`](#api-da77477f17642db0)


```csharp
public Span<RGBA> Span { get; }
```



<a id="api-0531e1e20b7e537f"></a>

### [`int RGBABitmap.Stride`](#api-0531e1e20b7e537f)


```csharp
public readonly int Stride;
```



<a id="api-5e04c0d49e847025"></a>

### [`Span<Vector<uint>> RGBABitmap.VectorSpan`](#api-5e04c0d49e847025)


```csharp
public Span<Vector<uint>> VectorSpan { get; }
```



<a id="api-7d05f4a80a43e331"></a>

### [`int RGBABitmap.Width`](#api-7d05f4a80a43e331)


```csharp
public readonly int Width;
```




<a id="api-0cacedcda54123f3"></a>

## `struct Rect`



```csharp
public struct Rect
{
    public uint Left;
    public uint Top;
    public uint Right;
    public uint Bottom;
    public static readonly Rect Empty;
    public bool IsEmpty { get; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void UnionWith(in Rect other);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void IntersectWith(in Rect other);
    public static Rect AlignOutward(Rect rect, int simdWidth);
}
```

<a id="api-0497725aa4bd64ba"></a>

### [`Rect Rect.AlignOutward(Rect rect, int simdWidth)`](#api-0497725aa4bd64ba)


```csharp
public static Rect AlignOutward(Rect rect, int simdWidth);
```

Returns a new rectangle expanded outward and aligned to a SIMD boundary. This is used for conservative region initialization where vectorization is preferred.

- **`simdWidth`** — The number of pixels per vector (e.g., Vector&lt;T&gt;.Count).

<a id="api-298035db0c05c725"></a>

### [`uint Rect.Bottom`](#api-298035db0c05c725)


```csharp
public uint Bottom;
```



<a id="api-5e3dac52d08c3e55"></a>

### [`Rect Rect.Empty`](#api-5e3dac52d08c3e55)


```csharp
public static readonly Rect Empty;
```



<a id="api-38970dff8aad2184"></a>

### [`void Rect.IntersectWith(in Rect other)`](#api-38970dff8aad2184)


```csharp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void IntersectWith(in Rect other);
```



<a id="api-511927a0c0a8aed3"></a>

### [`bool Rect.IsEmpty`](#api-511927a0c0a8aed3)


```csharp
public bool IsEmpty { get; }
```



<a id="api-8b4902893d2e4c5c"></a>

### [`uint Rect.Left`](#api-8b4902893d2e4c5c)


```csharp
public uint Left;
```



<a id="api-a74bf7147a63b9e1"></a>

### [`uint Rect.Right`](#api-a74bf7147a63b9e1)


```csharp
public uint Right;
```



<a id="api-aba329eb6a909f6e"></a>

### [`uint Rect.Top`](#api-aba329eb6a909f6e)


```csharp
public uint Top;
```



<a id="api-4acdc5b7f9deb904"></a>

### [`void Rect.UnionWith(in Rect other)`](#api-4acdc5b7f9deb904)


```csharp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UnionWith(in Rect other);
```




<a id="api-6f51eaf0ac0125d9"></a>

## `class StencilBitmap`



```csharp
public unsafe sealed class StencilBitmap : IDisposable
{
    public readonly int Width;
    public readonly int Height;
    public readonly int Stride;
    public G16* Pixels { get; }
    public Span<G16> Span { get; }

    public StencilBitmap(int width, int height);
    public G16 this[int x, int y] { get; set; }

    public void Fill(G16 value = 0);
    public void FillRect(in Rect rect, G16 value);
    public void InitRect(in Rect rect, G16 value = 0);
    public void Dispose();
}
```

<a id="api-e1a00cb60365985f"></a>

### [`StencilBitmap.StencilBitmap(int width, int height)`](#api-e1a00cb60365985f)


```csharp
public StencilBitmap(int width, int height);
```



<a id="api-274d2030acf78465"></a>

### [`void StencilBitmap.Dispose()`](#api-274d2030acf78465)


```csharp
public void Dispose();
```



<a id="api-11ec47af7232a018"></a>

### [`void StencilBitmap.Fill(ushort value = 0)`](#api-11ec47af7232a018)


```csharp
public void Fill(G16 value = 0);
```



<a id="api-ddb79a6477e85ac6"></a>

### [`void StencilBitmap.FillRect(in Rect rect, ushort value)`](#api-ddb79a6477e85ac6)


```csharp
public void FillRect(in Rect rect, G16 value);
```



<a id="api-2e7d302d57a63854"></a>

### [`StencilBitmap.~StencilBitmap()`](#api-2e7d302d57a63854)



<a id="api-40ce362e996f0dfa"></a>

### [`int StencilBitmap.Height`](#api-40ce362e996f0dfa)


```csharp
public readonly int Height;
```



<a id="api-e920c8b06bdb31bd"></a>

### [`void StencilBitmap.InitRect(in Rect rect, ushort value = 0)`](#api-e920c8b06bdb31bd)


```csharp
public void InitRect(in Rect rect, G16 value = 0);
```

Initializes a rectangular region of the stencil buffer using SIMD, aligned outward to the nearest vector boundary. This method may overdraw slightly beyond the specified rectangle for performance. Suitable for fast clearing of bounds when preparing coverage masks.

- **`rect`** — The region to initialize.

- **`value`** — The fill value (default is 0, meaning no coverage).

<a id="api-197003316f85c096"></a>

### [`ushort StencilBitmap.this[int x, int y]`](#api-197003316f85c096)


```csharp
public G16 this[int x, int y] { get; set; }
```



<a id="api-92776d4b5983e2d3"></a>

### [`ushort* StencilBitmap.Pixels`](#api-92776d4b5983e2d3)


```csharp
public G16* Pixels { get; }
```



<a id="api-dd236760faf76174"></a>

### [`Span<ushort> StencilBitmap.Span`](#api-dd236760faf76174)


```csharp
public Span<G16> Span { get; }
```



<a id="api-d407c939ad4e44af"></a>

### [`int StencilBitmap.Stride`](#api-d407c939ad4e44af)


```csharp
public readonly int Stride;
```



<a id="api-a59e140153948fb4"></a>

### [`int StencilBitmap.Width`](#api-a59e140153948fb4)


```csharp
public readonly int Width;
```



