# Xui.Core.Canvas.Filter

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

## Types

- [`readonly struct Brightness`](#api-21078f528dc8e6bb)
- [`enum FilterKind`](#api-b52893d23378692f)
- [`readonly struct FilterState`](#api-960f6e2ae081573e)

<a id="api-21078f528dc8e6bb"></a>

## `readonly struct Brightness`

Multiplies paint RGB channels, preserving alpha. One is unchanged; zero is black.

```csharp
public readonly struct Brightness
{
    public nfloat Amount { get; }

    public Brightness(nfloat amount);
}
```

<a id="api-c84e54015150008a"></a>

### [`Brightness.Brightness(NFloat amount)`](#api-c84e54015150008a)


```csharp
public Brightness(nfloat amount);
```

Creates a brightness adjustment.

<a id="api-3ecfc52e5b305bc8"></a>

### [`NFloat Brightness.Amount`](#api-3ecfc52e5b305bc8)


```csharp
public nfloat Amount { get; }
```

The nonnegative, finite RGB multiplier.


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

## `enum FilterKind`

The paint color adjustment stored in a canvas state.

```csharp
public enum FilterKind
{
    None,
    Brightness,
}
```

<a id="api-b59d219fab828aed"></a>

### [`FilterKind.Brightness`](#api-b59d219fab828aed)


```csharp
Brightness
```

Multiply RGB channels by the brightness amount.

<a id="api-0b156e603b3aa5f3"></a>

### [`FilterKind.None`](#api-0b156e603b3aa5f3)


```csharp
None
```

No color adjustment.


<a id="api-960f6e2ae081573e"></a>

## `readonly struct FilterState`

Owned, allocation-free filter state. The default value leaves colors unchanged.

```csharp
public readonly struct FilterState
{
    public FilterKind Kind { get; }
    public nfloat Amount { get; }

    public FilterState(Brightness brightness);
    public Color Apply(Color color);
}
```

<a id="api-eab43276f9fa6c1a"></a>

### [`FilterState.FilterState(Brightness brightness)`](#api-eab43276f9fa6c1a)


```csharp
public FilterState(Brightness brightness);
```

Creates state for a brightness adjustment.

<a id="api-262565aef5624f55"></a>

### [`NFloat FilterState.Amount`](#api-262565aef5624f55)


```csharp
public nfloat Amount { get; }
```

The brightness multiplier, or one when no adjustment is active.

<a id="api-144ea606dfc915a6"></a>

### [`Color FilterState.Apply(Color color)`](#api-144ea606dfc915a6)


```csharp
public Color Apply(Color color);
```

Adjusts RGB, clamps each channel to [0,1], and preserves alpha.

<a id="api-1867e033030d1af9"></a>

### [`FilterKind FilterState.Kind`](#api-1867e033030d1af9)


```csharp
public FilterKind Kind { get; }
```

The active adjustment.

