# Xui.Core.Canvas

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

## Types

- [`class AssetUri`](#api-489733b5bc093221)
- [`struct Color`](#api-5fe2e13064a570d1)
- [`class Colors`](#api-7de1b23dca2d71ad)
- [`struct CornerRadius`](#api-3ef8eee91c42743c)
- [`enum FillRule`](#api-45215d784cfdfdc6)
- [`readonly struct Font`](#api-f2381092b31bf6d2)
- [`class FontCache<T>`](#api-1725c62aa051afc5)
- [`readonly struct FontFaceDescriptor`](#api-a3ad07c44fee9a6f)
- [`readonly struct FontMetrics`](#api-2c715a42daf12ab9)
- [`class FontMetricsCache`](#api-bf25180bafbd2ff0)
- [`readonly struct FontResource`](#api-9db9df530ac38867)
- [`class FontSource`](#api-159a7efe5ffb5f9a)
- [`readonly struct FontStretch`](#api-313463bf68eb64a3)
- [`struct FontStyle`](#api-b5c60993885d5dd6)
- [`readonly struct FontWeight`](#api-78b732a63c79b9c9)
- [`struct GradientStop`](#api-b4b31723d70a4475)
- [`interface ICompositionContext`](#api-e423ab0621171e85)
- [`interface IContext`](#api-6d115bd4b81b5c63)
- [`interface IFilterContext`](#api-a99bf2a9cfe0e8e7)
- [`interface IFontSource`](#api-135fd5343e7bedc7)
- [`interface IGlyphPathBuilder`](#api-d3c5c370592fbc23)
- [`interface IImage`](#api-e987d291ab0f00bb)
- [`interface IImageDrawingContext`](#api-4c654853e0c036ef)
- [`interface IMeasureContext`](#api-c994a26652088f47)
- [`interface IPathBuilder`](#api-d13fe2d4e3437459)
- [`interface IPathClipping`](#api-cc0ba864c9f94b4d)
- [`interface IPathDrawing`](#api-39751b77a3823e32)
- [`interface IPathDrawingContext`](#api-a2acd68a80a4a746)
- [`interface IPenContext`](#api-30d0f5d993a1fc75)
- [`interface IRectDrawingContext`](#api-dc26566cf85a511b)
- [`interface IStateContext`](#api-3b3119fe132bf38c)
- [`interface ISymbolContext`](#api-6a76f8ec6eb172d4)
- [`interface ITextDrawingContext`](#api-01483d29d383a917)
- [`interface ITextMeasureContext`](#api-c5fb015c0990d9ad)
- [`interface ITransformContext`](#api-215b76139b0e238d)
- [`ref struct ImagePattern`](#api-884be54e6e22aca1)
- [`enum LineCap`](#api-dffb1ad36c903f6d)
- [`enum LineJoin`](#api-79536e207e75c624)
- [`readonly struct LineMetrics`](#api-1b1a359f36daf333)
- [`ref struct LinearGradient`](#api-c530f58efbab1696)
- [`enum PaintStyle`](#api-b9d01014b76860e3)
- [`class Path2D`](#api-8d75729507390f6c)
- [`enum PatternRepeat`](#api-830343375a982f72)
- [`ref struct RadialGradient`](#api-2dfb78b2c69c2070)
- [`class RoundedRect`](#api-cd52b8a3847a2bd0)
- [`enum TextAlign`](#api-94646577818f5d60)
- [`enum TextBaseline`](#api-c380e7705904f3c7)
- [`readonly struct TextMetrics`](#api-bcb94869139203e5)
- [`class TextMetricsCache`](#api-261ac7459f97a1b3)
- [`enum Winding`](#api-9f55ff357886072e)

<a id="api-489733b5bc093221"></a>

## `class AssetUri`

Parses the portable URI form used for application-packaged image assets. `asset://icons/logo.png` identifies the logical asset `icons/logo.png`; each runtime resolves it from its application package.

```csharp
public static class AssetUri
{
    public static bool TryGetRelativePath(string uri, out string relativePath);
}
```

<a id="api-da8a6df9fbf72e08"></a>

### [`bool AssetUri.TryGetRelativePath(string uri, out string relativePath)`](#api-da8a6df9fbf72e08)


```csharp
public static bool TryGetRelativePath(string uri, out string relativePath);
```

Gets an asset&#39;s logical relative path. Returns `false` when `uri` is not a valid `asset://` URI.


<a id="api-5fe2e13064a570d1"></a>

## `struct Color`

Represents a color using red, green, blue, and alpha components, all normalized to the range [0, 1].

```csharp
public struct Color : IEquatable<Color>
{
    public readonly bool Equals(Color other);
    public override readonly bool Equals(object? obj);
    public override readonly int GetHashCode();
    public nfloat Red;
    public nfloat Green;
    public nfloat Blue;
    public nfloat Alpha;
    public Color(nfloat red, nfloat green, nfloat blue, nfloat alpha);
    public Color(byte red, byte green, byte blue, byte alpha);
    public Color(uint rgba);
    public readonly bool IsTransparent { get; }

    public static implicit operator Color(uint rgbaHex);
}
```

<a id="api-5ead40de894bb5b8"></a>

### [`Color.Color(byte red, byte green, byte blue, byte alpha)`](#api-5ead40de894bb5b8)


```csharp
public Color(byte red, byte green, byte blue, byte alpha);
```

Initializes a new [`Xui.Core.Canvas.Color`](../xui-core-canvas/index.md#api-5fe2e13064a570d1) from byte components in the range [0, 255], which are normalized to [0, 1].

- **`red`** — Red component [0, 255]

- **`green`** — Green component [0, 255]

- **`blue`** — Blue component [0, 255]

- **`alpha`** — Alpha component [0, 255]

<a id="api-99c46317c1186a25"></a>

### [`Color.Color(NFloat red, NFloat green, NFloat blue, NFloat alpha)`](#api-99c46317c1186a25)


```csharp
public Color(nfloat red, nfloat green, nfloat blue, nfloat alpha);
```

Initializes a new [`Xui.Core.Canvas.Color`](../xui-core-canvas/index.md#api-5fe2e13064a570d1) with the specified red, green, blue, and alpha components.

- **`red`** — Red component, normalized [0, 1]

- **`green`** — Green component, normalized [0, 1]

- **`blue`** — Blue component, normalized [0, 1]

- **`alpha`** — Alpha component, normalized [0, 1]

<a id="api-ed9e9f753da8014d"></a>

### [`Color.Color(uint rgba)`](#api-ed9e9f753da8014d)


```csharp
public Color(uint rgba);
```

Initializes a new [`Xui.Core.Canvas.Color`](../xui-core-canvas/index.md#api-5fe2e13064a570d1) from a packed 32-bit RGBA value. The value format is 0xRRGGBBAA, where each component is 8 bits.

- **`rgba`** — Packed RGBA value in 0xRRGGBBAA format.

<a id="api-a3bf72c4a47bc50c"></a>

### [`NFloat Color.Alpha`](#api-a3bf72c4a47bc50c)


```csharp
public nfloat Alpha;
```

Alpha (opacity) component of the color, in the range [0, 1].

<a id="api-521eab13b2560670"></a>

### [`NFloat Color.Blue`](#api-521eab13b2560670)


```csharp
public nfloat Blue;
```

Blue component of the color, in the range [0, 1].

<a id="api-3f4c1333b55d1081"></a>

### [`readonly bool Color.Equals(object? obj)`](#api-3f4c1333b55d1081)


```csharp
public override readonly bool Equals(object? obj);
```

Indicates whether this instance and a specified object are equal.

- **`obj`** — The object to compare with the current instance.

**Returns:** `true` if `obj` and this instance are the same type and represent the same value; otherwise, `false`.

<a id="api-cbf65ce2eb4bf564"></a>

### [`readonly bool Color.Equals(Color other)`](#api-cbf65ce2eb4bf564)


```csharp
public readonly bool Equals(Color other);
```

Indicates whether the current object is equal to another object of the same type.

- **`other`** — An object to compare with this object.

**Returns:** `true` if the current object is equal to the `other` parameter; otherwise, `false`.

<a id="api-f125c6ba57da7a42"></a>

### [`readonly int Color.GetHashCode()`](#api-f125c6ba57da7a42)


```csharp
public override readonly int GetHashCode();
```

Returns the hash code for this instance.

**Returns:** A 32-bit signed integer that is the hash code for this instance.

<a id="api-3d39494ada49ca7c"></a>

### [`NFloat Color.Green`](#api-3d39494ada49ca7c)


```csharp
public nfloat Green;
```

Green component of the color, in the range [0, 1].

<a id="api-c4e9117c39a1cf61"></a>

### [`readonly bool Color.IsTransparent`](#api-c4e9117c39a1cf61)


```csharp
public readonly bool IsTransparent { get; }
```

Returns true if the color is fully transparent (Alpha = 0).

<a id="api-0121e7a0d70b9a5e"></a>

### [`NFloat Color.Red`](#api-0121e7a0d70b9a5e)


```csharp
public nfloat Red;
```

Red component of the color, in the range [0, 1].

<a id="api-a6310de679e3766d"></a>

### [`Color.implicit operator Color(uint rgbaHex)`](#api-a6310de679e3766d)


```csharp
public static implicit operator Color(uint rgbaHex);
```

Implicitly converts a 32-bit RGBA value (0xRRGGBBAA) to a [`Xui.Core.Canvas.Color`](../xui-core-canvas/index.md#api-5fe2e13064a570d1).

- **`rgbaHex`** — Packed RGBA hex value.


<a id="api-7de1b23dca2d71ad"></a>

## `class Colors`

Provides web standard named color constants in 32-bit RGBA format (0xRRGGBBAA). These match the named colors from the CSS color specification: https://developer.mozilla.org/en-US/docs/Web/CSS/named-color

```csharp
public static class Colors
{
    public const uint Transparent = 0x00000000;
    public const uint Black = 0x000000FF;
    public const uint White = 0xFFFFFFFF;
    public const uint Red = 0xFF0000FF;
    public const uint Lime = 0x00FF00FF;
    public const uint Blue = 0x0000FFFF;
    public const uint Yellow = 0xFFFF00FF;
    public const uint Fuchsia = 0xFF00FFFF;
    public const uint Aqua = 0x00FFFFFF;
    public const uint Silver = 0xC0C0C0FF;
    public const uint Gray = 0x808080FF;
    public const uint Maroon = 0x800000FF;
    public const uint Purple = 0x800080FF;
    public const uint Green = 0x008000FF;
    public const uint Olive = 0x808000FF;
    public const uint Navy = 0x000080FF;
    public const uint Teal = 0x008080FF;
    public const uint AliceBlue = 0xf0f8ffFF;
    public const uint AntiqueWhite = 0xfaebd7FF;
    public const uint Aquamarine = 0x7fffd4FF;
    public const uint Azure = 0xf0ffffFF;
    public const uint Beige = 0xf5f5dcFF;
    public const uint Bisque = 0xffe4c4FF;
    public const uint BlanchedAlmond = 0xffebcdFF;
    public const uint BlueViolet = 0x8a2be2FF;
    public const uint Brown = 0xa52a2aFF;
    public const uint BurlyWood = 0xdeb887FF;
    public const uint CadetBlue = 0x5f9ea0FF;
    public const uint ChartReuse = 0x7fff00FF;
    public const uint Chocolate = 0xd2691eFF;
    public const uint Coral = 0xff7f50FF;
    public const uint CornflowerBlue = 0x6495edFF;
    public const uint CornSilk = 0xfff8dcFF;
    public const uint Crimson = 0xdc143cFF;
    public const uint Cyan = 0x00ffffFF;
    public const uint DarkBlue = 0x00008bFF;
    public const uint DarkCyan = 0x008b8bFF;
    public const uint DarkGoldenRod = 0xb8860bFF;
    public const uint DarkGray = 0xa9a9a9FF;
    public const uint DarkGreen = 0x006400FF;
    public const uint DarkGrey = 0xa9a9a9FF;
    public const uint DarkKhaki = 0xbdb76bFF;
    public const uint DarkMagenta = 0x8b008bFF;
    public const uint DarkOliveGreen = 0x556b2fFF;
    public const uint DarkOrange = 0xff8c00FF;
    public const uint DarkOrchid = 0x9932ccFF;
    public const uint DarkRed = 0x8b0000FF;
    public const uint DarkSalmon = 0xe9967aFF;
    public const uint DarkSeaGreen = 0x8fbc8fFF;
    public const uint DarkSlateBlue = 0x483d8bFF;
    public const uint DarkSlateGray = 0x2f4f4fFF;
    public const uint DarkSlateGrey = 0x2f4f4fFF;
    public const uint DarkTurquoise = 0x00ced1FF;
    public const uint DarkViolet = 0x9400d3FF;
    public const uint DeepPink = 0xff1493FF;
    public const uint DeepSkyBlue = 0x00bfffFF;
    public const uint DimGray = 0x696969FF;
    public const uint DimGrey = 0x696969FF;
    public const uint DodgerBlue = 0x1e90ffFF;
    public const uint FireBrick = 0xb22222FF;
    public const uint FloralWhite = 0xfffaf0FF;
    public const uint ForestGreen = 0x228b22FF;
    public const uint Gainsboro = 0xdcdcdcFF;
    public const uint GhostWhite = 0xf8f8ffFF;
    public const uint Gold = 0xffd700FF;
    public const uint GoldenRod = 0xdaa520FF;
    public const uint GreenYellow = 0xadff2fFF;
    public const uint Grey = 0x808080FF;
    public const uint Honeydew = 0xf0fff0FF;
    public const uint HotPink = 0xff69b4FF;
    public const uint IndianRed = 0xcd5c5cFF;
    public const uint Indigo = 0x4b0082FF;
    public const uint Ivory = 0xfffff0FF;
    public const uint Khaki = 0xf0e68cFF;
    public const uint Lavender = 0xe6e6faFF;
    public const uint LavenderBlush = 0xfff0f5FF;
    public const uint LawnGreen = 0x7cfc00FF;
    public const uint LemonChiffon = 0xfffacdFF;
    public const uint LightBlue = 0xadd8e6FF;
    public const uint LightCoral = 0xf08080FF;
    public const uint LightCyan = 0xe0ffffFF;
    public const uint LightGoldenRodYellow = 0xfafad2FF;
    public const uint LightGray = 0xd3d3d3FF;
    public const uint LightGreen = 0x90ee90FF;
    public const uint LightGrey = 0xd3d3d3FF;
    public const uint LightPink = 0xffb6c1FF;
    public const uint LightSalmon = 0xffa07aFF;
    public const uint LightSeaGreen = 0x20b2aaFF;
    public const uint LightSkyBlue = 0x87cefaFF;
    public const uint LightSlateGray = 0x778899FF;
    public const uint LightSlateGrey = 0x778899FF;
    public const uint LightSteelBlue = 0xb0c4deFF;
    public const uint LightYellow = 0xffffe0FF;
    public const uint LimeGreen = 0x32cd32FF;
    public const uint Linen = 0xfaf0e6FF;
    public const uint Magenta = 0xff00ffFF;
    public const uint MediumAquamarine = 0x66cdaaFF;
    public const uint MediumBlue = 0x0000cdFF;
    public const uint MediumOrchid = 0xba55d3FF;
    public const uint MediumPurple = 0x9370dbFF;
    public const uint MediumSeaGreen = 0x3cb371FF;
    public const uint MediumSlateBlue = 0x7b68eeFF;
    public const uint MediumSpringGreen = 0x00fa9aFF;
    public const uint MediumTurquoise = 0x48d1ccFF;
    public const uint MediumVioletRed = 0xc71585FF;
    public const uint MidnightBlue = 0x191970FF;
    public const uint MintCream = 0xf5fffaFF;
    public const uint MistyRose = 0xffe4e1FF;
    public const uint Moccasin = 0xffe4b5FF;
    public const uint NavajoWhite = 0xffdeadFF;
    public const uint OldLace = 0xfdf5e6FF;
    public const uint OliveDrab = 0x6b8e23FF;
    public const uint Orange = 0xffa500FF;
    public const uint OrangeRed = 0xff4500FF;
    public const uint Orchid = 0xda70d6FF;
    public const uint PaleGoldenRod = 0xeee8aaFF;
    public const uint PaleGreen = 0x98fb98FF;
    public const uint PaleTurquoise = 0xafeeeeFF;
    public const uint PaleVioletRed = 0xdb7093FF;
    public const uint PapayaWhip = 0xffefd5FF;
    public const uint PeachPuff = 0xffdab9FF;
    public const uint Peru = 0xcd853fFF;
    public const uint Pink = 0xffc0cbFF;
    public const uint Plum = 0xdda0ddFF;
    public const uint PowderBlue = 0xb0e0e6FF;
    public const uint RebeccaPurple = 0x663399FF;
    public const uint RosyBrown = 0xbc8f8fFF;
    public const uint RoyalBlue = 0x4169e1FF;
    public const uint SaddleBrown = 0x8b4513FF;
    public const uint Salmon = 0xfa8072FF;
    public const uint SandyBrown = 0xf4a460FF;
    public const uint SeaGreen = 0x2e8b57FF;
    public const uint Seashell = 0xfff5eeFF;
    public const uint Sienna = 0xa0522dFF;
    public const uint SkyBlue = 0x87ceebFF;
    public const uint SlateBlue = 0x6a5acdFF;
    public const uint SlateGray = 0x708090FF;
    public const uint SlateGrey = 0x708090FF;
    public const uint Snow = 0xfffafaFF;
    public const uint SpringGreen = 0x00ff7fFF;
    public const uint SteelBlue = 0x4682b4FF;
    public const uint Tan = 0xd2b48cFF;
    public const uint Thistle = 0xd8bfd8FF;
    public const uint Tomato = 0xff6347FF;
    public const uint Turquoise = 0x40e0d0FF;
    public const uint Violet = 0xee82eeFF;
    public const uint Wheat = 0xf5deb3FF;
    public const uint WhiteSmoke = 0xf5f5f5FF;
    public const uint YellowGreen = 0x9acd32FF;
}
```

<a id="api-6fdc6b1ea1bf4755"></a>

### [`uint Colors.AliceBlue`](#api-6fdc6b1ea1bf4755)


```csharp
public const uint AliceBlue = 0xf0f8ffFF;
```



<a id="api-c34b9d04793fd56f"></a>

### [`uint Colors.AntiqueWhite`](#api-c34b9d04793fd56f)


```csharp
public const uint AntiqueWhite = 0xfaebd7FF;
```



<a id="api-a3fc6ab943add5bd"></a>

### [`uint Colors.Aqua`](#api-a3fc6ab943add5bd)


```csharp
public const uint Aqua = 0x00FFFFFF;
```



<a id="api-56e9b7d6231f6cef"></a>

### [`uint Colors.Aquamarine`](#api-56e9b7d6231f6cef)


```csharp
public const uint Aquamarine = 0x7fffd4FF;
```



<a id="api-d6b7753e7e522a37"></a>

### [`uint Colors.Azure`](#api-d6b7753e7e522a37)


```csharp
public const uint Azure = 0xf0ffffFF;
```



<a id="api-83be253938013d43"></a>

### [`uint Colors.Beige`](#api-83be253938013d43)


```csharp
public const uint Beige = 0xf5f5dcFF;
```



<a id="api-e475a11f474c8100"></a>

### [`uint Colors.Bisque`](#api-e475a11f474c8100)


```csharp
public const uint Bisque = 0xffe4c4FF;
```



<a id="api-e886f028dc71151a"></a>

### [`uint Colors.Black`](#api-e886f028dc71151a)


```csharp
public const uint Black = 0x000000FF;
```



<a id="api-fadadc7b5f104f02"></a>

### [`uint Colors.BlanchedAlmond`](#api-fadadc7b5f104f02)


```csharp
public const uint BlanchedAlmond = 0xffebcdFF;
```



<a id="api-b24b530bd9c49010"></a>

### [`uint Colors.Blue`](#api-b24b530bd9c49010)


```csharp
public const uint Blue = 0x0000FFFF;
```



<a id="api-fd2900a7e147346b"></a>

### [`uint Colors.BlueViolet`](#api-fd2900a7e147346b)


```csharp
public const uint BlueViolet = 0x8a2be2FF;
```



<a id="api-709c5af35e9e376c"></a>

### [`uint Colors.Brown`](#api-709c5af35e9e376c)


```csharp
public const uint Brown = 0xa52a2aFF;
```



<a id="api-6e127d15318a548e"></a>

### [`uint Colors.BurlyWood`](#api-6e127d15318a548e)


```csharp
public const uint BurlyWood = 0xdeb887FF;
```



<a id="api-b3308a66309f7bf8"></a>

### [`uint Colors.CadetBlue`](#api-b3308a66309f7bf8)


```csharp
public const uint CadetBlue = 0x5f9ea0FF;
```



<a id="api-9865b7f83b19fea5"></a>

### [`uint Colors.ChartReuse`](#api-9865b7f83b19fea5)


```csharp
public const uint ChartReuse = 0x7fff00FF;
```



<a id="api-652e224ca2818ad7"></a>

### [`uint Colors.Chocolate`](#api-652e224ca2818ad7)


```csharp
public const uint Chocolate = 0xd2691eFF;
```



<a id="api-3f68831157021d47"></a>

### [`uint Colors.Coral`](#api-3f68831157021d47)


```csharp
public const uint Coral = 0xff7f50FF;
```



<a id="api-7e9ddf32991bb2f1"></a>

### [`uint Colors.CornSilk`](#api-7e9ddf32991bb2f1)


```csharp
public const uint CornSilk = 0xfff8dcFF;
```



<a id="api-f3b3b2c7308bbe37"></a>

### [`uint Colors.CornflowerBlue`](#api-f3b3b2c7308bbe37)


```csharp
public const uint CornflowerBlue = 0x6495edFF;
```



<a id="api-fae1238ea2ef6264"></a>

### [`uint Colors.Crimson`](#api-fae1238ea2ef6264)


```csharp
public const uint Crimson = 0xdc143cFF;
```



<a id="api-44a9f8167de3bf6e"></a>

### [`uint Colors.Cyan`](#api-44a9f8167de3bf6e)


```csharp
public const uint Cyan = 0x00ffffFF;
```



<a id="api-41a2d2c71fdc8654"></a>

### [`uint Colors.DarkBlue`](#api-41a2d2c71fdc8654)


```csharp
public const uint DarkBlue = 0x00008bFF;
```



<a id="api-56675bfe69ad3a47"></a>

### [`uint Colors.DarkCyan`](#api-56675bfe69ad3a47)


```csharp
public const uint DarkCyan = 0x008b8bFF;
```



<a id="api-fb7e7547f76ff9b4"></a>

### [`uint Colors.DarkGoldenRod`](#api-fb7e7547f76ff9b4)


```csharp
public const uint DarkGoldenRod = 0xb8860bFF;
```



<a id="api-13a2f0c18b516f10"></a>

### [`uint Colors.DarkGray`](#api-13a2f0c18b516f10)


```csharp
public const uint DarkGray = 0xa9a9a9FF;
```



<a id="api-03580a78d8ae5bb7"></a>

### [`uint Colors.DarkGreen`](#api-03580a78d8ae5bb7)


```csharp
public const uint DarkGreen = 0x006400FF;
```



<a id="api-6aff910fb1c0d90c"></a>

### [`uint Colors.DarkGrey`](#api-6aff910fb1c0d90c)


```csharp
public const uint DarkGrey = 0xa9a9a9FF;
```



<a id="api-63c1755b44abcab7"></a>

### [`uint Colors.DarkKhaki`](#api-63c1755b44abcab7)


```csharp
public const uint DarkKhaki = 0xbdb76bFF;
```



<a id="api-0fbcd9a0a1f3c647"></a>

### [`uint Colors.DarkMagenta`](#api-0fbcd9a0a1f3c647)


```csharp
public const uint DarkMagenta = 0x8b008bFF;
```



<a id="api-8e9eb7dd947c2f98"></a>

### [`uint Colors.DarkOliveGreen`](#api-8e9eb7dd947c2f98)


```csharp
public const uint DarkOliveGreen = 0x556b2fFF;
```



<a id="api-33ff84101c4ecf57"></a>

### [`uint Colors.DarkOrange`](#api-33ff84101c4ecf57)


```csharp
public const uint DarkOrange = 0xff8c00FF;
```



<a id="api-6dc9ec31a6b84396"></a>

### [`uint Colors.DarkOrchid`](#api-6dc9ec31a6b84396)


```csharp
public const uint DarkOrchid = 0x9932ccFF;
```



<a id="api-376a730f3a03fdc0"></a>

### [`uint Colors.DarkRed`](#api-376a730f3a03fdc0)


```csharp
public const uint DarkRed = 0x8b0000FF;
```



<a id="api-c3d66040bbc07bc5"></a>

### [`uint Colors.DarkSalmon`](#api-c3d66040bbc07bc5)


```csharp
public const uint DarkSalmon = 0xe9967aFF;
```



<a id="api-e56b4397914d899c"></a>

### [`uint Colors.DarkSeaGreen`](#api-e56b4397914d899c)


```csharp
public const uint DarkSeaGreen = 0x8fbc8fFF;
```



<a id="api-c59e12302a5401c4"></a>

### [`uint Colors.DarkSlateBlue`](#api-c59e12302a5401c4)


```csharp
public const uint DarkSlateBlue = 0x483d8bFF;
```



<a id="api-5bf07696eab21477"></a>

### [`uint Colors.DarkSlateGray`](#api-5bf07696eab21477)


```csharp
public const uint DarkSlateGray = 0x2f4f4fFF;
```



<a id="api-1994719e096a1fb5"></a>

### [`uint Colors.DarkSlateGrey`](#api-1994719e096a1fb5)


```csharp
public const uint DarkSlateGrey = 0x2f4f4fFF;
```



<a id="api-79b453c7e2f2ecbd"></a>

### [`uint Colors.DarkTurquoise`](#api-79b453c7e2f2ecbd)


```csharp
public const uint DarkTurquoise = 0x00ced1FF;
```



<a id="api-5fbb0a0e817feeee"></a>

### [`uint Colors.DarkViolet`](#api-5fbb0a0e817feeee)


```csharp
public const uint DarkViolet = 0x9400d3FF;
```



<a id="api-2e91ae080c89b400"></a>

### [`uint Colors.DeepPink`](#api-2e91ae080c89b400)


```csharp
public const uint DeepPink = 0xff1493FF;
```



<a id="api-ed09be4990d746e8"></a>

### [`uint Colors.DeepSkyBlue`](#api-ed09be4990d746e8)


```csharp
public const uint DeepSkyBlue = 0x00bfffFF;
```



<a id="api-c6ada9c0b4b2859a"></a>

### [`uint Colors.DimGray`](#api-c6ada9c0b4b2859a)


```csharp
public const uint DimGray = 0x696969FF;
```



<a id="api-450eb509b1a9a8fe"></a>

### [`uint Colors.DimGrey`](#api-450eb509b1a9a8fe)


```csharp
public const uint DimGrey = 0x696969FF;
```



<a id="api-70c1f9b2d1efd0aa"></a>

### [`uint Colors.DodgerBlue`](#api-70c1f9b2d1efd0aa)


```csharp
public const uint DodgerBlue = 0x1e90ffFF;
```



<a id="api-d3a594f30b0900af"></a>

### [`uint Colors.FireBrick`](#api-d3a594f30b0900af)


```csharp
public const uint FireBrick = 0xb22222FF;
```



<a id="api-5b05a0544f27252f"></a>

### [`uint Colors.FloralWhite`](#api-5b05a0544f27252f)


```csharp
public const uint FloralWhite = 0xfffaf0FF;
```



<a id="api-2270d95449476e86"></a>

### [`uint Colors.ForestGreen`](#api-2270d95449476e86)


```csharp
public const uint ForestGreen = 0x228b22FF;
```



<a id="api-d978c5b1d7722cf7"></a>

### [`uint Colors.Fuchsia`](#api-d978c5b1d7722cf7)


```csharp
public const uint Fuchsia = 0xFF00FFFF;
```



<a id="api-98c3b5546bcf2468"></a>

### [`uint Colors.Gainsboro`](#api-98c3b5546bcf2468)


```csharp
public const uint Gainsboro = 0xdcdcdcFF;
```



<a id="api-781a065729f25aae"></a>

### [`uint Colors.GhostWhite`](#api-781a065729f25aae)


```csharp
public const uint GhostWhite = 0xf8f8ffFF;
```



<a id="api-a2da95d5200bfb66"></a>

### [`uint Colors.Gold`](#api-a2da95d5200bfb66)


```csharp
public const uint Gold = 0xffd700FF;
```



<a id="api-becacb7f265ec121"></a>

### [`uint Colors.GoldenRod`](#api-becacb7f265ec121)


```csharp
public const uint GoldenRod = 0xdaa520FF;
```



<a id="api-f8b934e3c6198b80"></a>

### [`uint Colors.Gray`](#api-f8b934e3c6198b80)


```csharp
public const uint Gray = 0x808080FF;
```



<a id="api-aa4bb512989c2b39"></a>

### [`uint Colors.Green`](#api-aa4bb512989c2b39)


```csharp
public const uint Green = 0x008000FF;
```



<a id="api-99bb4668885425c5"></a>

### [`uint Colors.GreenYellow`](#api-99bb4668885425c5)


```csharp
public const uint GreenYellow = 0xadff2fFF;
```



<a id="api-6190e67ab1b38113"></a>

### [`uint Colors.Grey`](#api-6190e67ab1b38113)


```csharp
public const uint Grey = 0x808080FF;
```



<a id="api-b946dc85776e8273"></a>

### [`uint Colors.Honeydew`](#api-b946dc85776e8273)


```csharp
public const uint Honeydew = 0xf0fff0FF;
```



<a id="api-e622e11f87d834eb"></a>

### [`uint Colors.HotPink`](#api-e622e11f87d834eb)


```csharp
public const uint HotPink = 0xff69b4FF;
```



<a id="api-b2667d7780777c50"></a>

### [`uint Colors.IndianRed`](#api-b2667d7780777c50)


```csharp
public const uint IndianRed = 0xcd5c5cFF;
```



<a id="api-6fc7c4c42c9289c7"></a>

### [`uint Colors.Indigo`](#api-6fc7c4c42c9289c7)


```csharp
public const uint Indigo = 0x4b0082FF;
```



<a id="api-19a1ddefdb9a7359"></a>

### [`uint Colors.Ivory`](#api-19a1ddefdb9a7359)


```csharp
public const uint Ivory = 0xfffff0FF;
```



<a id="api-54cce31f0156bdca"></a>

### [`uint Colors.Khaki`](#api-54cce31f0156bdca)


```csharp
public const uint Khaki = 0xf0e68cFF;
```



<a id="api-475b45c0362c2430"></a>

### [`uint Colors.Lavender`](#api-475b45c0362c2430)


```csharp
public const uint Lavender = 0xe6e6faFF;
```



<a id="api-f27bdbb352fcc191"></a>

### [`uint Colors.LavenderBlush`](#api-f27bdbb352fcc191)


```csharp
public const uint LavenderBlush = 0xfff0f5FF;
```



<a id="api-9d38301727266a6f"></a>

### [`uint Colors.LawnGreen`](#api-9d38301727266a6f)


```csharp
public const uint LawnGreen = 0x7cfc00FF;
```



<a id="api-7605e44b4aee93ba"></a>

### [`uint Colors.LemonChiffon`](#api-7605e44b4aee93ba)


```csharp
public const uint LemonChiffon = 0xfffacdFF;
```



<a id="api-9936d9b0c489de0f"></a>

### [`uint Colors.LightBlue`](#api-9936d9b0c489de0f)


```csharp
public const uint LightBlue = 0xadd8e6FF;
```



<a id="api-f563ba29dd25126f"></a>

### [`uint Colors.LightCoral`](#api-f563ba29dd25126f)


```csharp
public const uint LightCoral = 0xf08080FF;
```



<a id="api-33c92338f93b92c6"></a>

### [`uint Colors.LightCyan`](#api-33c92338f93b92c6)


```csharp
public const uint LightCyan = 0xe0ffffFF;
```



<a id="api-41e87743bf3f5854"></a>

### [`uint Colors.LightGoldenRodYellow`](#api-41e87743bf3f5854)


```csharp
public const uint LightGoldenRodYellow = 0xfafad2FF;
```



<a id="api-7950560fd04432e1"></a>

### [`uint Colors.LightGray`](#api-7950560fd04432e1)


```csharp
public const uint LightGray = 0xd3d3d3FF;
```



<a id="api-08c24668a199ace3"></a>

### [`uint Colors.LightGreen`](#api-08c24668a199ace3)


```csharp
public const uint LightGreen = 0x90ee90FF;
```



<a id="api-f922fb6f7d4e007e"></a>

### [`uint Colors.LightGrey`](#api-f922fb6f7d4e007e)


```csharp
public const uint LightGrey = 0xd3d3d3FF;
```



<a id="api-90a6f110e0aa53ec"></a>

### [`uint Colors.LightPink`](#api-90a6f110e0aa53ec)


```csharp
public const uint LightPink = 0xffb6c1FF;
```



<a id="api-410a6cd28146b7d4"></a>

### [`uint Colors.LightSalmon`](#api-410a6cd28146b7d4)


```csharp
public const uint LightSalmon = 0xffa07aFF;
```



<a id="api-97f9b4645d5bda5d"></a>

### [`uint Colors.LightSeaGreen`](#api-97f9b4645d5bda5d)


```csharp
public const uint LightSeaGreen = 0x20b2aaFF;
```



<a id="api-1bce0fabad30a5e3"></a>

### [`uint Colors.LightSkyBlue`](#api-1bce0fabad30a5e3)


```csharp
public const uint LightSkyBlue = 0x87cefaFF;
```



<a id="api-871a4abb51eb0251"></a>

### [`uint Colors.LightSlateGray`](#api-871a4abb51eb0251)


```csharp
public const uint LightSlateGray = 0x778899FF;
```



<a id="api-26bce7ee246aed04"></a>

### [`uint Colors.LightSlateGrey`](#api-26bce7ee246aed04)


```csharp
public const uint LightSlateGrey = 0x778899FF;
```



<a id="api-e61365e2b175217e"></a>

### [`uint Colors.LightSteelBlue`](#api-e61365e2b175217e)


```csharp
public const uint LightSteelBlue = 0xb0c4deFF;
```



<a id="api-2bf96c41a79c0a7f"></a>

### [`uint Colors.LightYellow`](#api-2bf96c41a79c0a7f)


```csharp
public const uint LightYellow = 0xffffe0FF;
```



<a id="api-e6060a9b1fe2b899"></a>

### [`uint Colors.Lime`](#api-e6060a9b1fe2b899)


```csharp
public const uint Lime = 0x00FF00FF;
```



<a id="api-84d11d25dab794c9"></a>

### [`uint Colors.LimeGreen`](#api-84d11d25dab794c9)


```csharp
public const uint LimeGreen = 0x32cd32FF;
```



<a id="api-62585fe929e5856f"></a>

### [`uint Colors.Linen`](#api-62585fe929e5856f)


```csharp
public const uint Linen = 0xfaf0e6FF;
```



<a id="api-0a9d1e6b1d2981f7"></a>

### [`uint Colors.Magenta`](#api-0a9d1e6b1d2981f7)


```csharp
public const uint Magenta = 0xff00ffFF;
```



<a id="api-0ebb888f967f32dc"></a>

### [`uint Colors.Maroon`](#api-0ebb888f967f32dc)


```csharp
public const uint Maroon = 0x800000FF;
```



<a id="api-559394ecbca8cd5c"></a>

### [`uint Colors.MediumAquamarine`](#api-559394ecbca8cd5c)


```csharp
public const uint MediumAquamarine = 0x66cdaaFF;
```



<a id="api-1dddd79ea5ead5c7"></a>

### [`uint Colors.MediumBlue`](#api-1dddd79ea5ead5c7)


```csharp
public const uint MediumBlue = 0x0000cdFF;
```



<a id="api-d8d3507a621d96fd"></a>

### [`uint Colors.MediumOrchid`](#api-d8d3507a621d96fd)


```csharp
public const uint MediumOrchid = 0xba55d3FF;
```



<a id="api-0d108251294e398d"></a>

### [`uint Colors.MediumPurple`](#api-0d108251294e398d)


```csharp
public const uint MediumPurple = 0x9370dbFF;
```



<a id="api-4928b7d69b649b51"></a>

### [`uint Colors.MediumSeaGreen`](#api-4928b7d69b649b51)


```csharp
public const uint MediumSeaGreen = 0x3cb371FF;
```



<a id="api-0e466f4928082730"></a>

### [`uint Colors.MediumSlateBlue`](#api-0e466f4928082730)


```csharp
public const uint MediumSlateBlue = 0x7b68eeFF;
```



<a id="api-394cac3921d4cf09"></a>

### [`uint Colors.MediumSpringGreen`](#api-394cac3921d4cf09)


```csharp
public const uint MediumSpringGreen = 0x00fa9aFF;
```



<a id="api-83497c8cd7b69c7b"></a>

### [`uint Colors.MediumTurquoise`](#api-83497c8cd7b69c7b)


```csharp
public const uint MediumTurquoise = 0x48d1ccFF;
```



<a id="api-05b7fd4c91d50ef7"></a>

### [`uint Colors.MediumVioletRed`](#api-05b7fd4c91d50ef7)


```csharp
public const uint MediumVioletRed = 0xc71585FF;
```



<a id="api-f977c04fc08dbb15"></a>

### [`uint Colors.MidnightBlue`](#api-f977c04fc08dbb15)


```csharp
public const uint MidnightBlue = 0x191970FF;
```



<a id="api-93df7cc7bffe6596"></a>

### [`uint Colors.MintCream`](#api-93df7cc7bffe6596)


```csharp
public const uint MintCream = 0xf5fffaFF;
```



<a id="api-5dd9afe356a448ea"></a>

### [`uint Colors.MistyRose`](#api-5dd9afe356a448ea)


```csharp
public const uint MistyRose = 0xffe4e1FF;
```



<a id="api-78959b0a80d80668"></a>

### [`uint Colors.Moccasin`](#api-78959b0a80d80668)


```csharp
public const uint Moccasin = 0xffe4b5FF;
```



<a id="api-e983b8f78f4ff38e"></a>

### [`uint Colors.NavajoWhite`](#api-e983b8f78f4ff38e)


```csharp
public const uint NavajoWhite = 0xffdeadFF;
```



<a id="api-91c7a1f17e8a0895"></a>

### [`uint Colors.Navy`](#api-91c7a1f17e8a0895)


```csharp
public const uint Navy = 0x000080FF;
```



<a id="api-793d3d921f6391a7"></a>

### [`uint Colors.OldLace`](#api-793d3d921f6391a7)


```csharp
public const uint OldLace = 0xfdf5e6FF;
```



<a id="api-7f38a101cde6b176"></a>

### [`uint Colors.Olive`](#api-7f38a101cde6b176)


```csharp
public const uint Olive = 0x808000FF;
```



<a id="api-4823812a640b6228"></a>

### [`uint Colors.OliveDrab`](#api-4823812a640b6228)


```csharp
public const uint OliveDrab = 0x6b8e23FF;
```



<a id="api-a4286d760a91ee9a"></a>

### [`uint Colors.Orange`](#api-a4286d760a91ee9a)


```csharp
public const uint Orange = 0xffa500FF;
```



<a id="api-3300be78b91f1452"></a>

### [`uint Colors.OrangeRed`](#api-3300be78b91f1452)


```csharp
public const uint OrangeRed = 0xff4500FF;
```



<a id="api-732002146d41fd69"></a>

### [`uint Colors.Orchid`](#api-732002146d41fd69)


```csharp
public const uint Orchid = 0xda70d6FF;
```



<a id="api-e0d89a7f9ee19743"></a>

### [`uint Colors.PaleGoldenRod`](#api-e0d89a7f9ee19743)


```csharp
public const uint PaleGoldenRod = 0xeee8aaFF;
```



<a id="api-f329ec52e73fca85"></a>

### [`uint Colors.PaleGreen`](#api-f329ec52e73fca85)


```csharp
public const uint PaleGreen = 0x98fb98FF;
```



<a id="api-16b4385fb93cabe6"></a>

### [`uint Colors.PaleTurquoise`](#api-16b4385fb93cabe6)


```csharp
public const uint PaleTurquoise = 0xafeeeeFF;
```



<a id="api-a444703c8d75ce41"></a>

### [`uint Colors.PaleVioletRed`](#api-a444703c8d75ce41)


```csharp
public const uint PaleVioletRed = 0xdb7093FF;
```



<a id="api-cb984304607fe88e"></a>

### [`uint Colors.PapayaWhip`](#api-cb984304607fe88e)


```csharp
public const uint PapayaWhip = 0xffefd5FF;
```



<a id="api-6facc37b8e717265"></a>

### [`uint Colors.PeachPuff`](#api-6facc37b8e717265)


```csharp
public const uint PeachPuff = 0xffdab9FF;
```



<a id="api-3ee8339d16ecfbde"></a>

### [`uint Colors.Peru`](#api-3ee8339d16ecfbde)


```csharp
public const uint Peru = 0xcd853fFF;
```



<a id="api-672879cf771ffebb"></a>

### [`uint Colors.Pink`](#api-672879cf771ffebb)


```csharp
public const uint Pink = 0xffc0cbFF;
```



<a id="api-c5ba5d7b3646a0fa"></a>

### [`uint Colors.Plum`](#api-c5ba5d7b3646a0fa)


```csharp
public const uint Plum = 0xdda0ddFF;
```



<a id="api-320fca5c3a7569d8"></a>

### [`uint Colors.PowderBlue`](#api-320fca5c3a7569d8)


```csharp
public const uint PowderBlue = 0xb0e0e6FF;
```



<a id="api-ded90088c9b142a4"></a>

### [`uint Colors.Purple`](#api-ded90088c9b142a4)


```csharp
public const uint Purple = 0x800080FF;
```



<a id="api-c5d3bc1e811fe5ce"></a>

### [`uint Colors.RebeccaPurple`](#api-c5d3bc1e811fe5ce)


```csharp
public const uint RebeccaPurple = 0x663399FF;
```



<a id="api-0e9279b46dc54301"></a>

### [`uint Colors.Red`](#api-0e9279b46dc54301)


```csharp
public const uint Red = 0xFF0000FF;
```



<a id="api-33ed8ba2eda9bd3b"></a>

### [`uint Colors.RosyBrown`](#api-33ed8ba2eda9bd3b)


```csharp
public const uint RosyBrown = 0xbc8f8fFF;
```



<a id="api-262b89b183460df3"></a>

### [`uint Colors.RoyalBlue`](#api-262b89b183460df3)


```csharp
public const uint RoyalBlue = 0x4169e1FF;
```



<a id="api-64a58ea76e4a0e3e"></a>

### [`uint Colors.SaddleBrown`](#api-64a58ea76e4a0e3e)


```csharp
public const uint SaddleBrown = 0x8b4513FF;
```



<a id="api-86a882f7be175bf9"></a>

### [`uint Colors.Salmon`](#api-86a882f7be175bf9)


```csharp
public const uint Salmon = 0xfa8072FF;
```



<a id="api-cb10abf7e5609556"></a>

### [`uint Colors.SandyBrown`](#api-cb10abf7e5609556)


```csharp
public const uint SandyBrown = 0xf4a460FF;
```



<a id="api-53e5fce1e3fafb42"></a>

### [`uint Colors.SeaGreen`](#api-53e5fce1e3fafb42)


```csharp
public const uint SeaGreen = 0x2e8b57FF;
```



<a id="api-d61116ee51fae8b6"></a>

### [`uint Colors.Seashell`](#api-d61116ee51fae8b6)


```csharp
public const uint Seashell = 0xfff5eeFF;
```



<a id="api-65ff81537e90bae6"></a>

### [`uint Colors.Sienna`](#api-65ff81537e90bae6)


```csharp
public const uint Sienna = 0xa0522dFF;
```



<a id="api-5708a0645779e66c"></a>

### [`uint Colors.Silver`](#api-5708a0645779e66c)


```csharp
public const uint Silver = 0xC0C0C0FF;
```



<a id="api-fd5c0d7d1d51ed9e"></a>

### [`uint Colors.SkyBlue`](#api-fd5c0d7d1d51ed9e)


```csharp
public const uint SkyBlue = 0x87ceebFF;
```



<a id="api-1351b371bb184d06"></a>

### [`uint Colors.SlateBlue`](#api-1351b371bb184d06)


```csharp
public const uint SlateBlue = 0x6a5acdFF;
```



<a id="api-3626b749cdc9a615"></a>

### [`uint Colors.SlateGray`](#api-3626b749cdc9a615)


```csharp
public const uint SlateGray = 0x708090FF;
```



<a id="api-4a0689bab58bdd23"></a>

### [`uint Colors.SlateGrey`](#api-4a0689bab58bdd23)


```csharp
public const uint SlateGrey = 0x708090FF;
```



<a id="api-93387609a7975fc2"></a>

### [`uint Colors.Snow`](#api-93387609a7975fc2)


```csharp
public const uint Snow = 0xfffafaFF;
```



<a id="api-108b51bce5a2c7b5"></a>

### [`uint Colors.SpringGreen`](#api-108b51bce5a2c7b5)


```csharp
public const uint SpringGreen = 0x00ff7fFF;
```



<a id="api-43904d40a6349cf2"></a>

### [`uint Colors.SteelBlue`](#api-43904d40a6349cf2)


```csharp
public const uint SteelBlue = 0x4682b4FF;
```



<a id="api-2cb643912fe7b7a8"></a>

### [`uint Colors.Tan`](#api-2cb643912fe7b7a8)


```csharp
public const uint Tan = 0xd2b48cFF;
```



<a id="api-6763175160818008"></a>

### [`uint Colors.Teal`](#api-6763175160818008)


```csharp
public const uint Teal = 0x008080FF;
```



<a id="api-f7af612bb56562e1"></a>

### [`uint Colors.Thistle`](#api-f7af612bb56562e1)


```csharp
public const uint Thistle = 0xd8bfd8FF;
```



<a id="api-950053be8134b685"></a>

### [`uint Colors.Tomato`](#api-950053be8134b685)


```csharp
public const uint Tomato = 0xff6347FF;
```



<a id="api-4d92d6c933ec9381"></a>

### [`uint Colors.Transparent`](#api-4d92d6c933ec9381)


```csharp
public const uint Transparent = 0x00000000;
```



<a id="api-083846d9d5d01108"></a>

### [`uint Colors.Turquoise`](#api-083846d9d5d01108)


```csharp
public const uint Turquoise = 0x40e0d0FF;
```



<a id="api-c2bb1bdc220e17c7"></a>

### [`uint Colors.Violet`](#api-c2bb1bdc220e17c7)


```csharp
public const uint Violet = 0xee82eeFF;
```



<a id="api-a393976f40eb6de4"></a>

### [`uint Colors.Wheat`](#api-a393976f40eb6de4)


```csharp
public const uint Wheat = 0xf5deb3FF;
```



<a id="api-db463e3446191068"></a>

### [`uint Colors.White`](#api-db463e3446191068)


```csharp
public const uint White = 0xFFFFFFFF;
```



<a id="api-163044ccb36934aa"></a>

### [`uint Colors.WhiteSmoke`](#api-163044ccb36934aa)


```csharp
public const uint WhiteSmoke = 0xf5f5f5FF;
```



<a id="api-962a35b37e42e186"></a>

### [`uint Colors.Yellow`](#api-962a35b37e42e186)


```csharp
public const uint Yellow = 0xFFFF00FF;
```



<a id="api-4b3b7fd0b7e66f8d"></a>

### [`uint Colors.YellowGreen`](#api-4b3b7fd0b7e66f8d)


```csharp
public const uint YellowGreen = 0x9acd32FF;
```




<a id="api-3ef8eee91c42743c"></a>

## `struct CornerRadius`

Represents the radius of each corner of a rectangle, allowing for uniform or non-uniform rounding.

```csharp
public struct CornerRadius
{
    public static readonly CornerRadius Zero;
    public nfloat TopLeft;
    public nfloat TopRight;
    public nfloat BottomRight;
    public nfloat BottomLeft;
    public bool IsUniform { get; }
    public readonly bool IsZero { get; }

    [DebuggerStepThrough]
    public CornerRadius(nfloat radius);
    [DebuggerStepThrough]
    public CornerRadius(nfloat topLeft, nfloat topRight, nfloat bottomRight, nfloat bottomLeft);
    public static implicit operator CornerRadius(nfloat radius);
    public static implicit operator CornerRadius(int radius);
    public static implicit operator CornerRadius(Tuple<nfloat, nfloat, nfloat, nfloat> radii);
    [DebuggerStepThrough]
    public static CornerRadius operator +(CornerRadius lhs, CornerRadius rhs);
    [DebuggerStepThrough]
    public static CornerRadius operator -(CornerRadius lhs, CornerRadius rhs);
    [DebuggerStepThrough]
    public static CornerRadius Min(CornerRadius a, CornerRadius b);
    [DebuggerStepThrough]
    public static CornerRadius Max(CornerRadius a, CornerRadius b);
    [DebuggerStepThrough]
    public static implicit operator CornerRadius((nfloat horizontal, nfloat vertical) radii);
    [DebuggerStepThrough]
    public static implicit operator CornerRadius((nfloat topLeft, nfloat topRight, nfloat bottomRight, nfloat bottomLeft) radii);
}
```

<a id="api-4397fa0c5aa1fa3a"></a>

### [`CornerRadius.CornerRadius(NFloat radius)`](#api-4397fa0c5aa1fa3a)


```csharp
[DebuggerStepThrough]
public CornerRadius(nfloat radius);
```

Initializes a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) with the same radius applied to all four corners.

- **`radius`** — The uniform radius for all corners.

<a id="api-4d51650417c2eca3"></a>

### [`CornerRadius.CornerRadius(NFloat topLeft, NFloat topRight, NFloat bottomRight, NFloat bottomLeft)`](#api-4d51650417c2eca3)


```csharp
[DebuggerStepThrough]
public CornerRadius(nfloat topLeft, nfloat topRight, nfloat bottomRight, nfloat bottomLeft);
```

Initializes a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) with individual values for each corner.

- **`topLeft`** — Radius of the top-left corner.

- **`topRight`** — Radius of the top-right corner.

- **`bottomRight`** — Radius of the bottom-right corner.

- **`bottomLeft`** — Radius of the bottom-left corner.

<a id="api-4a5b3f4cebaa3670"></a>

### [`NFloat CornerRadius.BottomLeft`](#api-4a5b3f4cebaa3670)


```csharp
public nfloat BottomLeft;
```

Radius of the bottom-left corner.

<a id="api-c2ecbeb8645e802c"></a>

### [`NFloat CornerRadius.BottomRight`](#api-c2ecbeb8645e802c)


```csharp
public nfloat BottomRight;
```

Radius of the bottom-right corner.

<a id="api-00f28f5413475a06"></a>

### [`bool CornerRadius.IsUniform`](#api-00f28f5413475a06)


```csharp
public bool IsUniform { get; }
```

Returns true if all corners have the same radius value.

<a id="api-1627358d0cb3f2bb"></a>

### [`readonly bool CornerRadius.IsZero`](#api-1627358d0cb3f2bb)


```csharp
public readonly bool IsZero { get; }
```

Returns true if all corner radii are zero.

<a id="api-54a618a3e3cae904"></a>

### [`CornerRadius CornerRadius.Max(CornerRadius a, CornerRadius b)`](#api-54a618a3e3cae904)


```csharp
[DebuggerStepThrough]
public static CornerRadius Max(CornerRadius a, CornerRadius b);
```

Returns a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) where each corner is the maximum of the corresponding corners of the two inputs.

- **`a`** — First [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`b`** — Second [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

**Returns:** A new [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) taking the maximum value at each corner.

<a id="api-ead6360833368fa9"></a>

### [`CornerRadius CornerRadius.Min(CornerRadius a, CornerRadius b)`](#api-ead6360833368fa9)


```csharp
[DebuggerStepThrough]
public static CornerRadius Min(CornerRadius a, CornerRadius b);
```

Returns a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) where each corner is the minimum of the corresponding corners of the two inputs.

- **`a`** — First [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`b`** — Second [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

**Returns:** A new [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) taking the minimum value at each corner.

<a id="api-404e448d4146f259"></a>

### [`NFloat CornerRadius.TopLeft`](#api-404e448d4146f259)


```csharp
public nfloat TopLeft;
```

Radius of the top-left corner.

<a id="api-2b04ba669b7175a9"></a>

### [`NFloat CornerRadius.TopRight`](#api-2b04ba669b7175a9)


```csharp
public nfloat TopRight;
```

Radius of the top-right corner.

<a id="api-e05741412d69ccaf"></a>

### [`CornerRadius CornerRadius.Zero`](#api-e05741412d69ccaf)


```csharp
public static readonly CornerRadius Zero;
```

A [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) where all corners have a radius of zero.

<a id="api-5140cb2a05694462"></a>

### [`CornerRadius CornerRadius.operator +(CornerRadius lhs, CornerRadius rhs)`](#api-5140cb2a05694462)


```csharp
[DebuggerStepThrough]
public static CornerRadius operator +(CornerRadius lhs, CornerRadius rhs);
```

Adds two [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) values component-wise.

- **`lhs`** — The first [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`rhs`** — The second [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

**Returns:** A new [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) where each corner is the sum of the corresponding corners.

<a id="api-ae651fe1bd99e1b4"></a>

### [`CornerRadius.implicit operator CornerRadius(int radius)`](#api-ae651fe1bd99e1b4)


```csharp
public static implicit operator CornerRadius(int radius);
```

Implicitly converts a single integer radius value to a uniform [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`radius`** — The uniform corner radius.

<a id="api-e0539af92ddbae6f"></a>

### [`CornerRadius.implicit operator CornerRadius(NFloat radius)`](#api-e0539af92ddbae6f)


```csharp
public static implicit operator CornerRadius(nfloat radius);
```

Implicitly converts a single radius value to a uniform [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`radius`** — The uniform corner radius.

<a id="api-bc2d49aa4cac7e96"></a>

### [`CornerRadius.implicit operator CornerRadius(Tuple<NFloat, NFloat, NFloat, NFloat> radii)`](#api-bc2d49aa4cac7e96)


```csharp
public static implicit operator CornerRadius(Tuple<nfloat, nfloat, nfloat, nfloat> radii);
```

Implicitly converts a 4-tuple of radius values to a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`radii`** — Tuple representing (TopLeft, TopRight, BottomRight, BottomLeft).

<a id="api-45b84e059e7680a8"></a>

### [`CornerRadius.implicit operator CornerRadius((NFloat topLeft, NFloat topRight, NFloat bottomRight, NFloat bottomLeft) radii)`](#api-45b84e059e7680a8)


```csharp
[DebuggerStepThrough]
public static implicit operator CornerRadius((nfloat topLeft, nfloat topRight, nfloat bottomRight, nfloat bottomLeft) radii);
```

Implicitly converts a tuple (topLeft, topRight, bottomRight, bottomLeft) into a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`radii`** — Tuple of four radii representing each corner individually.

<a id="api-8ee04fa507e2d3c6"></a>

### [`CornerRadius.implicit operator CornerRadius((NFloat horizontal, NFloat vertical) radii)`](#api-8ee04fa507e2d3c6)


```csharp
[DebuggerStepThrough]
public static implicit operator CornerRadius((nfloat horizontal, nfloat vertical) radii);
```

Implicitly converts a tuple (horizontal, vertical) into a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c), where TopLeft and BottomRight use horizontal, and TopRight and BottomLeft use vertical radius.

- **`radii`** — Tuple of two radii (horizontal, vertical).

<a id="api-a8ee6eb3ff489ca6"></a>

### [`CornerRadius CornerRadius.operator -(CornerRadius lhs, CornerRadius rhs)`](#api-a8ee6eb3ff489ca6)


```csharp
[DebuggerStepThrough]
public static CornerRadius operator -(CornerRadius lhs, CornerRadius rhs);
```

Subtracts one [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) from another component-wise.

- **`lhs`** — The first [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c).

- **`rhs`** — The second [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) to subtract.

**Returns:** A new [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) where each corner is the difference of the corresponding corners.


<a id="api-45215d784cfdfdc6"></a>

## `enum FillRule`

Specifies the algorithm used to determine the &quot;insideness&quot; of a point in a path, controlling how filled shapes are rendered.

```csharp
public enum FillRule
{
    NonZero,
    EvenOdd
}
```

<a id="api-f72c4c26d99a4cc4"></a>

### [`FillRule.EvenOdd`](#api-f72c4c26d99a4cc4)


```csharp
EvenOdd
```

Uses the even-odd rule. A point is inside the path if a ray drawn from it to infinity crosses the path segments an odd number of times.

<a id="api-62f41b1aa2c5eea3"></a>

### [`FillRule.NonZero`](#api-62f41b1aa2c5eea3)


```csharp
NonZero
```

Uses the non-zero winding rule. A point is inside the path if the sum of path segment windings around it is non-zero. This is the default rule.


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

## `readonly struct Font`

Immutable description of one font face used for canvas text measurement and rendering.

Xui currently selects one named family. Font fallback and per-run font selection are not supported by this value and must bypass font-metric caches when introduced in the future.

```csharp
public partial struct Font
{
    public static readonly FontWeight Thin;
    public static readonly FontWeight ExtraLight;
    public static readonly FontWeight Light;
    public static readonly FontWeight Medium;
    public static readonly FontWeight SemiBold;
    public static readonly FontWeight Bold;
    public static readonly FontWeight ExtraBold;
    public static readonly FontWeight Black;
    public static readonly FontStretch UltraCondensed;
    public static readonly FontStretch ExtraCondensed;
    public static readonly FontStretch Condensed;
    public static readonly FontStretch SemiCondensed;
    public static readonly FontStretch SemiExpanded;
    public static readonly FontStretch Expanded;
    public static readonly FontStretch ExtraExpanded;
    public static readonly FontStretch UltraExpanded;
    public static readonly FontStyle Italic;
    public static readonly FontStyle Oblique;
}
public partial struct Font
{
    public static implicit operator Font(float size);
    public static implicit operator Font((float size, FontWeight weight) tuple);
    public static implicit operator Font((float size, FontStyle style) tuple);
    public static implicit operator Font((float size, FontWeight weight, FontStyle style) tuple);
    public static implicit operator Font((float size, FontWeight weight, FontStretch stretch) tuple);
    public static implicit operator Font((float size, FontStyle style, FontStretch stretch) tuple);
    public static implicit operator Font((float size, FontWeight weight, FontStyle style, FontStretch stretch) tuple);
    public static implicit operator Font((float size, float lineHeight) tuple);
    public static implicit operator Font((float size, FontWeight weight, float lineHeight) tuple);
    public static implicit operator Font((float size, FontStyle style, float lineHeight) tuple);
    public static implicit operator Font((float size, FontWeight weight, FontStyle style, float lineHeight) tuple);
    public static implicit operator Font((float size, FontWeight weight, FontStretch stretch, float lineHeight) tuple);
    public static implicit operator Font((float size, FontStyle style, FontStretch stretch, float lineHeight) tuple);
    public static implicit operator Font((float size, FontWeight weight, FontStyle style, FontStretch stretch, float lineHeight) tuple);
}
public readonly partial struct Font : IEquatable<Font>
{
    public Font();
    public Font(nfloat fontSize, string fontFamily, FontWeight? fontWeight = null, FontStyle? fontStyle = null, FontStretch? fontStretch = null, nfloat? lineHeight = null);
    public string FontFamily { get; init; }
    public nfloat FontSize { get; init; }
    public FontStyle FontStyle { get; init; }
    public FontWeight FontWeight { get; init; }
    public FontStretch FontStretch { get; init; }
    public nfloat LineHeight { get; init; }

    public bool Equals(Font other);
    public override bool Equals(object? obj);
    public override int GetHashCode();
    public static bool operator ==(Font left, Font right);
    public static bool operator !=(Font left, Font right);
}
```

<a id="api-1e5ac94cf1af035b"></a>

### [`Font.Font()`](#api-1e5ac94cf1af035b)


```csharp
public Font();
```

Initializes the default Inter text font.

<a id="api-95517924c135d3e9"></a>

### [`Font.Font(NFloat fontSize, string fontFamily, FontWeight? fontWeight = null, FontStyle? fontStyle = null, FontStretch? fontStretch = null, NFloat? lineHeight = null)`](#api-95517924c135d3e9)


```csharp
public Font(nfloat fontSize, string fontFamily, FontWeight? fontWeight = null, FontStyle? fontStyle = null, FontStretch? fontStretch = null, nfloat? lineHeight = null);
```

Initializes a font face.

<a id="api-b28226ec5126da42"></a>

### [`FontWeight Font.Black`](#api-b28226ec5126da42)


```csharp
public static readonly FontWeight Black;
```



<a id="api-c29638c610084260"></a>

### [`FontWeight Font.Bold`](#api-c29638c610084260)


```csharp
public static readonly FontWeight Bold;
```



<a id="api-5d5213499867c0bf"></a>

### [`FontStretch Font.Condensed`](#api-5d5213499867c0bf)


```csharp
public static readonly FontStretch Condensed;
```



<a id="api-615738d07f3c2ebc"></a>

### [`bool Font.Equals(object? obj)`](#api-615738d07f3c2ebc)


```csharp
public override bool Equals(object? obj);
```

Indicates whether this instance and a specified object are equal.

- **`obj`** — The object to compare with the current instance.

**Returns:** `true` if `obj` and this instance are the same type and represent the same value; otherwise, `false`.

<a id="api-98122d5cdfb66f1b"></a>

### [`bool Font.Equals(Font other)`](#api-98122d5cdfb66f1b)


```csharp
public bool Equals(Font other);
```

Indicates whether the current object is equal to another object of the same type.

- **`other`** — An object to compare with this object.

**Returns:** `true` if the current object is equal to the `other` parameter; otherwise, `false`.

<a id="api-77559724a2e73e18"></a>

### [`FontStretch Font.Expanded`](#api-77559724a2e73e18)


```csharp
public static readonly FontStretch Expanded;
```



<a id="api-ac326282e240a9f3"></a>

### [`FontWeight Font.ExtraBold`](#api-ac326282e240a9f3)


```csharp
public static readonly FontWeight ExtraBold;
```



<a id="api-3f1cbdd8abe446cf"></a>

### [`FontStretch Font.ExtraCondensed`](#api-3f1cbdd8abe446cf)


```csharp
public static readonly FontStretch ExtraCondensed;
```



<a id="api-4e2bccef1bf9351a"></a>

### [`FontStretch Font.ExtraExpanded`](#api-4e2bccef1bf9351a)


```csharp
public static readonly FontStretch ExtraExpanded;
```



<a id="api-8dc6ce3d304e95ed"></a>

### [`FontWeight Font.ExtraLight`](#api-8dc6ce3d304e95ed)


```csharp
public static readonly FontWeight ExtraLight;
```



<a id="api-4979df6b32993d8c"></a>

### [`string Font.FontFamily`](#api-4979df6b32993d8c)


```csharp
public string FontFamily { get; init; }
```

The one selected font family name.

<a id="api-425943c795617350"></a>

### [`NFloat Font.FontSize`](#api-425943c795617350)


```csharp
public nfloat FontSize { get; init; }
```

The font size in user-space units.

<a id="api-9ef775715a4e6702"></a>

### [`FontStretch Font.FontStretch`](#api-9ef775715a4e6702)


```csharp
public FontStretch FontStretch { get; init; }
```

The font stretch.

<a id="api-8c224e46b7c233ab"></a>

### [`FontStyle Font.FontStyle`](#api-8c224e46b7c233ab)


```csharp
public FontStyle FontStyle { get; init; }
```

The font style.

<a id="api-df5566f2c9ab8b00"></a>

### [`FontWeight Font.FontWeight`](#api-df5566f2c9ab8b00)


```csharp
public FontWeight FontWeight { get; init; }
```

The numeric font weight.

<a id="api-a554f27aad554537"></a>

### [`int Font.GetHashCode()`](#api-a554f27aad554537)


```csharp
public override int GetHashCode();
```

Returns the hash code for this instance.

**Returns:** A 32-bit signed integer that is the hash code for this instance.

<a id="api-53062354f963243c"></a>

### [`FontStyle Font.Italic`](#api-53062354f963243c)


```csharp
public static readonly FontStyle Italic;
```



<a id="api-7503058ba27c35e5"></a>

### [`FontWeight Font.Light`](#api-7503058ba27c35e5)


```csharp
public static readonly FontWeight Light;
```



<a id="api-8a4edd5e951459e3"></a>

### [`NFloat Font.LineHeight`](#api-8a4edd5e951459e3)


```csharp
public nfloat LineHeight { get; init; }
```

The requested line height. Layout will own line-spacing semantics.

<a id="api-badf90ff07b3555d"></a>

### [`FontWeight Font.Medium`](#api-badf90ff07b3555d)


```csharp
public static readonly FontWeight Medium;
```



<a id="api-f466cc8b3cbc9a3f"></a>

### [`FontStyle Font.Oblique`](#api-f466cc8b3cbc9a3f)


```csharp
public static readonly FontStyle Oblique;
```



<a id="api-ea6794b2280ccb77"></a>

### [`FontWeight Font.SemiBold`](#api-ea6794b2280ccb77)


```csharp
public static readonly FontWeight SemiBold;
```



<a id="api-beae51ef7d612c2b"></a>

### [`FontStretch Font.SemiCondensed`](#api-beae51ef7d612c2b)


```csharp
public static readonly FontStretch SemiCondensed;
```



<a id="api-db9a5e400551b71b"></a>

### [`FontStretch Font.SemiExpanded`](#api-db9a5e400551b71b)


```csharp
public static readonly FontStretch SemiExpanded;
```



<a id="api-836fd7eb92b4309a"></a>

### [`FontWeight Font.Thin`](#api-836fd7eb92b4309a)


```csharp
public static readonly FontWeight Thin;
```



<a id="api-e2ee11431608e1c7"></a>

### [`FontStretch Font.UltraCondensed`](#api-e2ee11431608e1c7)


```csharp
public static readonly FontStretch UltraCondensed;
```



<a id="api-72e0fc4e1ea78cda"></a>

### [`FontStretch Font.UltraExpanded`](#api-72e0fc4e1ea78cda)


```csharp
public static readonly FontStretch UltraExpanded;
```



<a id="api-c48f9f316a21c748"></a>

### [`bool Font.operator ==(Font left, Font right)`](#api-c48f9f316a21c748)


```csharp
public static bool operator ==(Font left, Font right);
```

Returns whether two font descriptions are equal.

<a id="api-bd30f663b540bd90"></a>

### [`Font.implicit operator Font(float size)`](#api-bd30f663b540bd90)


```csharp
public static implicit operator Font(float size);
```

Implicitly creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from a font size. Uses normal weight, normal style, normal stretch, and line height = 1.2&#215; size.

- **`size`** — The font size in user-space units (e.g., pixels).

<a id="api-27fefd7612779b11"></a>

### [`Font.implicit operator Font((float size, float lineHeight) tuple)`](#api-27fefd7612779b11)


```csharp
public static implicit operator Font((float size, float lineHeight) tuple);
```

Creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size and line height.

<a id="api-6776a98b26d2c87b"></a>

### [`Font.implicit operator Font((float size, FontStyle style, float lineHeight) tuple)`](#api-6776a98b26d2c87b)


```csharp
public static implicit operator Font((float size, FontStyle style, float lineHeight) tuple);
```

Creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, style, and line height.

<a id="api-5db983b48dff1442"></a>

### [`Font.implicit operator Font((float size, FontStyle style, FontStretch stretch, float lineHeight) tuple)`](#api-5db983b48dff1442)


```csharp
public static implicit operator Font((float size, FontStyle style, FontStretch stretch, float lineHeight) tuple);
```

Creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, style, stretch, and line height.

<a id="api-4e233061ce383834"></a>

### [`Font.implicit operator Font((float size, FontStyle style, FontStretch stretch) tuple)`](#api-4e233061ce383834)


```csharp
public static implicit operator Font((float size, FontStyle style, FontStretch stretch) tuple);
```

Implicitly creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, style, and stretch. Uses normal weight and line height = 1.2&#215; size.

- **`tuple`** — The font size, style, and stretch percentage.

<a id="api-364c5eb6befdf28c"></a>

### [`Font.implicit operator Font((float size, FontStyle style) tuple)`](#api-364c5eb6befdf28c)


```csharp
public static implicit operator Font((float size, FontStyle style) tuple);
```

Implicitly creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from a font size and style. Uses normal weight, normal stretch, and line height = 1.2&#215; size.

- **`tuple`** — The font size and font style.

<a id="api-340abae7519d69fc"></a>

### [`Font.implicit operator Font((float size, FontWeight weight, float lineHeight) tuple)`](#api-340abae7519d69fc)


```csharp
public static implicit operator Font((float size, FontWeight weight, float lineHeight) tuple);
```

Creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, weight, and line height.

<a id="api-b2e75b89d2f32732"></a>

### [`Font.implicit operator Font((float size, FontWeight weight, FontStretch stretch, float lineHeight) tuple)`](#api-b2e75b89d2f32732)


```csharp
public static implicit operator Font((float size, FontWeight weight, FontStretch stretch, float lineHeight) tuple);
```

Creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, weight, stretch, and line height.

<a id="api-e0b97a6f6356cd66"></a>

### [`Font.implicit operator Font((float size, FontWeight weight, FontStretch stretch) tuple)`](#api-e0b97a6f6356cd66)


```csharp
public static implicit operator Font((float size, FontWeight weight, FontStretch stretch) tuple);
```

Implicitly creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, weight, and stretch. Uses normal style and line height = 1.2&#215; size.

- **`tuple`** — The font size, weight, and stretch percentage.

<a id="api-2336b160e5181c8b"></a>

### [`Font.implicit operator Font((float size, FontWeight weight, FontStyle style, float lineHeight) tuple)`](#api-2336b160e5181c8b)


```csharp
public static implicit operator Font((float size, FontWeight weight, FontStyle style, float lineHeight) tuple);
```

Creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, weight, style, and line height.

<a id="api-2457756951d864c5"></a>

### [`Font.implicit operator Font((float size, FontWeight weight, FontStyle style, FontStretch stretch, float lineHeight) tuple)`](#api-2457756951d864c5)


```csharp
public static implicit operator Font((float size, FontWeight weight, FontStyle style, FontStretch stretch, float lineHeight) tuple);
```

Creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, weight, style, stretch, and line height.

<a id="api-c0c7c605aa5e293f"></a>

### [`Font.implicit operator Font((float size, FontWeight weight, FontStyle style, FontStretch stretch) tuple)`](#api-c0c7c605aa5e293f)


```csharp
public static implicit operator Font((float size, FontWeight weight, FontStyle style, FontStretch stretch) tuple);
```

Implicitly creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, weight, style, and stretch. Uses line height = 1.2&#215; size.

- **`tuple`** — The font size, weight, style, and stretch percentage.

<a id="api-97b4bd72715da215"></a>

### [`Font.implicit operator Font((float size, FontWeight weight, FontStyle style) tuple)`](#api-97b4bd72715da215)


```csharp
public static implicit operator Font((float size, FontWeight weight, FontStyle style) tuple);
```

Implicitly creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from size, weight, and style. Uses normal stretch and line height = 1.2&#215; size.

- **`tuple`** — The font size, weight, and style.

<a id="api-017334df2236b70b"></a>

### [`Font.implicit operator Font((float size, FontWeight weight) tuple)`](#api-017334df2236b70b)


```csharp
public static implicit operator Font((float size, FontWeight weight) tuple);
```

Implicitly creates a [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2) from a font size and weight. Uses normal style, normal stretch, and line height = 1.2&#215; size.

- **`tuple`** — The font size and font weight.

<a id="api-3133c27ba57839d5"></a>

### [`bool Font.operator !=(Font left, Font right)`](#api-3133c27ba57839d5)


```csharp
public static bool operator !=(Font left, Font right);
```

Returns whether two font descriptions differ.


<a id="api-1725c62aa051afc5"></a>

## `class FontCache<T>`

Fixed-capacity, allocation-free-after-construction LRU cache keyed by [`Xui.Core.Canvas.Font`](../xui-core-canvas/index.md#api-f2381092b31bf6d2).

- **`T`** — The cached value associated with a resolved font.

```csharp
public class FontCache<T>
{
    public const int DefaultCapacity = 64;
    public FontCache(int capacity = DefaultCapacity);
    public int EntryCapacity { get; }

    public bool TryGet(in Font font, out T value);
    public void Set(in Font font, T value);
    public void Clear();
    protected virtual void OnEvicted(T value);
}
```

<a id="api-b1a41df23657a8b9"></a>

### [`FontCache<T>.FontCache(int capacity = 64)`](#api-b1a41df23657a8b9)


```csharp
public FontCache(int capacity = DefaultCapacity);
```

Initializes a cache with the requested number of entries.

<a id="api-37db91841ad2db97"></a>

### [`void FontCache<T>.Clear()`](#api-37db91841ad2db97)


```csharp
public void Clear();
```

Clears every retained entry.

<a id="api-d2dc025d99a77c9d"></a>

### [`int FontCache<T>.DefaultCapacity`](#api-d2dc025d99a77c9d)


```csharp
public const int DefaultCapacity = 64;
```

The standard number of font entries retained by a context cache.

<a id="api-d6d6a0b4a6904888"></a>

### [`int FontCache<T>.EntryCapacity`](#api-d6d6a0b4a6904888)


```csharp
public int EntryCapacity { get; }
```

Gets the number of retained font entries.

<a id="api-721fc5bd617a98bd"></a>

### [`void FontCache<T>.OnEvicted(T value)`](#api-721fc5bd617a98bd)


```csharp
protected virtual void OnEvicted(T value);
```

Releases a value when its entry is replaced, evicted, or cleared.

<a id="api-30f1cfecee1b3452"></a>

### [`void FontCache<T>.Set(in Font font, T value)`](#api-30f1cfecee1b3452)


```csharp
public void Set(in Font font, T value);
```

Adds or refreshes the value for `font`.

<a id="api-f44714aacaf79113"></a>

### [`bool FontCache<T>.TryGet(in Font font, out T value)`](#api-f44714aacaf79113)


```csharp
public bool TryGet(in Font font, out T value);
```

Gets the cached value for `font` when available.


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

## `readonly struct FontFaceDescriptor`

Describes one concrete font face made available by an application.

```csharp
public readonly struct FontFaceDescriptor
{
    public string Family { get; }
    public FontWeight Weight { get; }
    public FontStyle Style { get; }
    public FontStretch Stretch { get; }

    public FontFaceDescriptor(string family, FontWeight weight, FontStyle style, FontStretch stretch);
    public bool Matches(in Font font);
}
```

<a id="api-73f34888c7f45607"></a>

### [`FontFaceDescriptor.FontFaceDescriptor(string family, FontWeight weight, FontStyle style, FontStretch stretch)`](#api-73f34888c7f45607)


```csharp
public FontFaceDescriptor(string family, FontWeight weight, FontStyle style, FontStretch stretch);
```

Initializes a concrete face descriptor.

<a id="api-ee8dc6980edee24f"></a>

### [`string FontFaceDescriptor.Family`](#api-ee8dc6980edee24f)


```csharp
public string Family { get; }
```

The case-insensitive family name.

<a id="api-5f7447afe4a39bf0"></a>

### [`bool FontFaceDescriptor.Matches(in Font font)`](#api-5f7447afe4a39bf0)


```csharp
public bool Matches(in Font font);
```

Returns whether this exact face satisfies `font`.

<a id="api-43eac225da263ee1"></a>

### [`FontStretch FontFaceDescriptor.Stretch`](#api-43eac225da263ee1)


```csharp
public FontStretch Stretch { get; }
```

The width/stretch percentage.

<a id="api-70b64ac13eb7e9de"></a>

### [`FontStyle FontFaceDescriptor.Style`](#api-70b64ac13eb7e9de)


```csharp
public FontStyle Style { get; }
```

The italic or oblique style.

<a id="api-ab3b7dd7a921be8e"></a>

### [`FontWeight FontFaceDescriptor.Weight`](#api-ab3b7dd7a921be8e)


```csharp
public FontWeight Weight { get; }
```

The numeric weight.


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

## `readonly struct FontMetrics`

Represents font-defined metrics used for vertical alignment and em box sizing. These values are constant for a given font and size.

```csharp
public readonly struct FontMetrics
{
    public readonly nfloat FontBoundingBoxAscent;
    public readonly nfloat FontBoundingBoxDescent;
    public readonly nfloat EmHeightAscent;
    public readonly nfloat EmHeightDescent;
    public readonly nfloat AlphabeticBaseline;
    public readonly nfloat HangingBaseline;
    public readonly nfloat IdeographicBaseline;
    public nfloat Height { get; }

    public FontMetrics(nfloat fontAscent, nfloat fontDescent, nfloat emAscent, nfloat emDescent, nfloat alphabeticBaseline, nfloat hangingBaseline, nfloat ideographicBaseline);
}
```

<a id="api-43344b73d9b075ef"></a>

### [`FontMetrics.FontMetrics(NFloat fontAscent, NFloat fontDescent, NFloat emAscent, NFloat emDescent, NFloat alphabeticBaseline, NFloat hangingBaseline, NFloat ideographicBaseline)`](#api-43344b73d9b075ef)


```csharp
public FontMetrics(nfloat fontAscent, nfloat fontDescent, nfloat emAscent, nfloat emDescent, nfloat alphabeticBaseline, nfloat hangingBaseline, nfloat ideographicBaseline);
```

Initializes a new [`Xui.Core.Canvas.FontMetrics`](../xui-core-canvas/index.md#api-2c715a42daf12ab9) instance.

- **`fontAscent`** — Maximum vertical extent above the baseline from the font’s bounding box.

- **`fontDescent`** — Maximum vertical extent below the baseline from the font’s bounding box.

- **`emAscent`** — Ascent to the top of the em square.

- **`emDescent`** — Descent to the bottom of the em square.

- **`alphabeticBaseline`** — Position of the alphabetic baseline (typically 0).

- **`hangingBaseline`** — Position of the hanging baseline for scripts that use it.

- **`ideographicBaseline`** — Position of the ideographic baseline for CJK layout.

<a id="api-e70cc0c317670edb"></a>

### [`NFloat FontMetrics.AlphabeticBaseline`](#api-e70cc0c317670edb)


```csharp
public readonly nfloat AlphabeticBaseline;
```

Position of the alphabetic baseline (typically 0, used for alignment).

<a id="api-e4acf700e7410fb9"></a>

### [`NFloat FontMetrics.EmHeightAscent`](#api-e4acf700e7410fb9)


```csharp
public readonly nfloat EmHeightAscent;
```

Height from baseline to top of the em square. Recommended for app layout.

<a id="api-f7b3e15312504bf4"></a>

### [`NFloat FontMetrics.EmHeightDescent`](#api-f7b3e15312504bf4)


```csharp
public readonly nfloat EmHeightDescent;
```

Height from baseline to bottom of the em square. Recommended for app layout.

<a id="api-aa7c21b8da97a811"></a>

### [`NFloat FontMetrics.FontBoundingBoxAscent`](#api-aa7c21b8da97a811)


```csharp
public readonly nfloat FontBoundingBoxAscent;
```

Maximum ascent defined by the font (not necessarily used glyphs).

<a id="api-b35798d4b0f87706"></a>

### [`NFloat FontMetrics.FontBoundingBoxDescent`](#api-b35798d4b0f87706)


```csharp
public readonly nfloat FontBoundingBoxDescent;
```

Maximum descent defined by the font.

<a id="api-a208a3a390164add"></a>

### [`NFloat FontMetrics.HangingBaseline`](#api-a208a3a390164add)


```csharp
public readonly nfloat HangingBaseline;
```

Vertical position of the hanging baseline (used in scripts like Devanagari), relative to the alphabetic baseline. Negative values are above it.

<a id="api-086cb725984e2797"></a>

### [`NFloat FontMetrics.Height`](#api-086cb725984e2797)


```csharp
public nfloat Height { get; }
```

Total height of the font bounding box.

<a id="api-e5dd923abd5af282"></a>

### [`NFloat FontMetrics.IdeographicBaseline`](#api-e5dd923abd5af282)


```csharp
public readonly nfloat IdeographicBaseline;
```

Vertical position of the ideographic baseline (used in CJK layout), relative to the alphabetic baseline. Positive values are below it.


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

## `class FontMetricsCache`

Fixed-capacity, allocation-free-after-construction LRU cache of font-wide metrics. One instance belongs to a drawing or measurement context because native font resolution is surface-specific.

```csharp
public sealed class FontMetricsCache : FontCache<FontMetrics>
{
    public const int Capacity = DefaultCapacity;
    public FontMetricsCache();
}
```

<a id="api-26ff0e24c2861f30"></a>

### [`FontMetricsCache.FontMetricsCache()`](#api-26ff0e24c2861f30)


```csharp
public FontMetricsCache();
```

Initializes the standard 64-entry metrics cache.

<a id="api-ed03844eb196a75b"></a>

### [`int FontMetricsCache.Capacity`](#api-ed03844eb196a75b)


```csharp
public const int Capacity = DefaultCapacity;
```

Maximum number of distinct font descriptions retained by this cache.


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

## `readonly struct FontResource`

Identifies one font resource without loading its data.

```csharp
public readonly struct FontResource
{
    public FontFaceDescriptor Face { get; }
    public Uri Uri { get; }

    public FontResource(FontFaceDescriptor face, Uri uri);
}
```

<a id="api-5000e899fab7aef8"></a>

### [`FontResource.FontResource(FontFaceDescriptor face, Uri uri)`](#api-5000e899fab7aef8)


```csharp
public FontResource(FontFaceDescriptor face, Uri uri);
```

Initializes a font resource.

<a id="api-912e7a28615ace44"></a>

### [`FontFaceDescriptor FontResource.Face`](#api-912e7a28615ace44)


```csharp
public FontFaceDescriptor Face { get; }
```

The concrete face represented by this resource.

<a id="api-d54b4b27cbca1a44"></a>

### [`Uri FontResource.Uri`](#api-d54b4b27cbca1a44)


```csharp
public Uri Uri { get; }
```

The source location understood by the supplying source.


<a id="api-159a7efe5ffb5f9a"></a>

## `class FontSource`

URI-backed implementation of [`Xui.Core.Canvas.IFontSource`](../xui-core-canvas/index.md#api-135fd5343e7bedc7).

```csharp
public sealed class FontSource : IFontSource
{
    public FontSource(IEnumerable<FontResource> resources, Func<Uri, ReadOnlyMemory<byte>> loader);
    public IEnumerable<FontResource> Resources { get; }

    public bool TryGet(in Font font, out FontResource resource);
    public ReadOnlyMemory<byte> Load(in FontResource resource);
    public static ReadOnlyMemory<byte> LoadEmbedded(Uri uri);
}
```

<a id="api-4134342a97309dd9"></a>

### [`FontSource.FontSource(IEnumerable<FontResource> resources, Func<Uri, ReadOnlyMemory<byte>> loader)`](#api-4134342a97309dd9)


```csharp
public FontSource(IEnumerable<FontResource> resources, Func<Uri, ReadOnlyMemory<byte>> loader);
```

Initializes a URI-backed source with its resource declarations and loader.

<a id="api-df5f049997a0ef6a"></a>

### [`ReadOnlyMemory<byte> FontSource.Load(in FontResource resource)`](#api-df5f049997a0ef6a)


```csharp
public ReadOnlyMemory<byte> Load(in FontResource resource);
```

Loads a resource&#39;s bytes when a consumer needs them.

<a id="api-fe78f4f863621b7d"></a>

### [`ReadOnlyMemory<byte> FontSource.LoadEmbedded(Uri uri)`](#api-fe78f4f863621b7d)


```csharp
public static ReadOnlyMemory<byte> LoadEmbedded(Uri uri);
```

Loads a resource addressed as `embedded://Assembly/Path/File.ttf`.

<a id="api-3502d28ebc3136ae"></a>

### [`IEnumerable<FontResource> FontSource.Resources`](#api-3502d28ebc3136ae)


```csharp
public IEnumerable<FontResource> Resources { get; }
```

Gets all declared resources without loading their data.

<a id="api-6497e029c699168d"></a>

### [`bool FontSource.TryGet(in Font font, out FontResource resource)`](#api-6497e029c699168d)


```csharp
public bool TryGet(in Font font, out FontResource resource);
```

Finds the exact application-provided face for a request.


<a id="api-313463bf68eb64a3"></a>

## `readonly struct FontStretch`

Represents the stretch or width percentage of a font, relative to its normal width (100%).

Values less than 100 represent condensed fonts; values greater than 100 are expanded. Font stretch supports comparison operators for ordering and matching.

```csharp
public readonly struct FontStretch : IComparable<FontStretch>, IEquatable<FontStretch>
{
    public readonly nfloat Value;
    public FontStretch(nfloat value);
    public static implicit operator nfloat(FontStretch stretch);
    public static implicit operator FontStretch(nfloat value);
    public static implicit operator FontStretch(float value);
    public static implicit operator FontStretch(int value);
    public static bool operator ==(FontStretch a, FontStretch b);
    public static bool operator !=(FontStretch a, FontStretch b);
    public static bool operator <(FontStretch a, FontStretch b);
    public static bool operator <=(FontStretch a, FontStretch b);
    public static bool operator>(FontStretch a, FontStretch b);
    public static bool operator >=(FontStretch a, FontStretch b);
    public int CompareTo(FontStretch other);
    public bool Equals(FontStretch other);
    public override bool Equals(object? obj);
    public override int GetHashCode();
    public static readonly FontStretch UltraCondensed;
    public static readonly FontStretch ExtraCondensed;
    public static readonly FontStretch Condensed;
    public static readonly FontStretch SemiCondensed;
    public static readonly FontStretch Normal;
    public static readonly FontStretch SemiExpanded;
    public static readonly FontStretch Expanded;
    public static readonly FontStretch ExtraExpanded;
    public static readonly FontStretch UltraExpanded;
}
```

<a id="api-e3b7953cea5c424c"></a>

### [`FontStretch.FontStretch(NFloat value)`](#api-e3b7953cea5c424c)


```csharp
public FontStretch(nfloat value);
```

Initializes a new [`Xui.Core.Canvas.FontStretch`](../xui-core-canvas/index.md#api-313463bf68eb64a3) with the specified numeric value.

- **`value`** — The numeric width percentage (e.g., 100 = normal).

<a id="api-dcabd8be6a150f1f"></a>

### [`int FontStretch.CompareTo(FontStretch other)`](#api-dcabd8be6a150f1f)


```csharp
public int CompareTo(FontStretch other);
```

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

- **`other`** — An object to compare with this instance.

**Returns:** A value that indicates the relative order of the objects being compared. The return value has these meanings: 

- **Less than zero** — This instance precedes `other` in the sort order.
- **Zero** — This instance occurs in the same position in the sort order as `other`.
- **Greater than zero** — This instance follows `other` in the sort order.

<a id="api-fbf77575f88a3e75"></a>

### [`FontStretch FontStretch.Condensed`](#api-fbf77575f88a3e75)


```csharp
public static readonly FontStretch Condensed;
```

Font stretch 75% – Condensed. Common for space-constrained text.

<a id="api-b03bd07c43b42f0b"></a>

### [`bool FontStretch.Equals(object? obj)`](#api-b03bd07c43b42f0b)


```csharp
public override bool Equals(object? obj);
```

Indicates whether this instance and a specified object are equal.

- **`obj`** — The object to compare with the current instance.

**Returns:** `true` if `obj` and this instance are the same type and represent the same value; otherwise, `false`.

<a id="api-d0be7728868f8e4b"></a>

### [`bool FontStretch.Equals(FontStretch other)`](#api-d0be7728868f8e4b)


```csharp
public bool Equals(FontStretch other);
```

Indicates whether the current object is equal to another object of the same type.

- **`other`** — An object to compare with this object.

**Returns:** `true` if the current object is equal to the `other` parameter; otherwise, `false`.

<a id="api-766aeae67f136ad0"></a>

### [`FontStretch FontStretch.Expanded`](#api-766aeae67f136ad0)


```csharp
public static readonly FontStretch Expanded;
```

Font stretch 125% – Expanded. Wider glyph appearance.

<a id="api-7a517136785d4eba"></a>

### [`FontStretch FontStretch.ExtraCondensed`](#api-7a517136785d4eba)


```csharp
public static readonly FontStretch ExtraCondensed;
```

Font stretch 62.5% – Extra Condensed. Narrower than Condensed.

<a id="api-53a932a74b66592c"></a>

### [`FontStretch FontStretch.ExtraExpanded`](#api-53a932a74b66592c)


```csharp
public static readonly FontStretch ExtraExpanded;
```

Font stretch 150% – Extra Expanded. Significantly wider.

<a id="api-c68b98e0e8609e0a"></a>

### [`int FontStretch.GetHashCode()`](#api-c68b98e0e8609e0a)


```csharp
public override int GetHashCode();
```

Returns the hash code for this instance.

**Returns:** A 32-bit signed integer that is the hash code for this instance.

<a id="api-fb6019fe29a862ed"></a>

### [`FontStretch FontStretch.Normal`](#api-fb6019fe29a862ed)


```csharp
public static readonly FontStretch Normal;
```

Font stretch 100% – Normal. Default glyph width.

<a id="api-77538bf372b794ce"></a>

### [`FontStretch FontStretch.SemiCondensed`](#api-77538bf372b794ce)


```csharp
public static readonly FontStretch SemiCondensed;
```

Font stretch 87.5% – Semi Condensed. Slightly narrower than normal.

<a id="api-ad28b09cdb8e77a6"></a>

### [`FontStretch FontStretch.SemiExpanded`](#api-ad28b09cdb8e77a6)


```csharp
public static readonly FontStretch SemiExpanded;
```

Font stretch 112.5% – Semi Expanded. Slightly wider than normal.

<a id="api-166653d408c76fe8"></a>

### [`FontStretch FontStretch.UltraCondensed`](#api-166653d408c76fe8)


```csharp
public static readonly FontStretch UltraCondensed;
```

Font stretch 50% – Ultra Condensed. Very narrow glyph width.

<a id="api-7680fa0e4c89b95b"></a>

### [`FontStretch FontStretch.UltraExpanded`](#api-7680fa0e4c89b95b)


```csharp
public static readonly FontStretch UltraExpanded;
```

Font stretch 200% – Ultra Expanded. Very wide glyphs.

<a id="api-34a4eb2fd3f1a515"></a>

### [`NFloat FontStretch.Value`](#api-34a4eb2fd3f1a515)


```csharp
public readonly nfloat Value;
```

The numeric percentage value of the font stretch.

<a id="api-98a43a375f2fdde5"></a>

### [`bool FontStretch.operator ==(FontStretch a, FontStretch b)`](#api-98a43a375f2fdde5)


```csharp
public static bool operator ==(FontStretch a, FontStretch b);
```

Returns `true` if two stretch values are equal.

<a id="api-9e2e84af6f2ad6aa"></a>

### [`bool FontStretch.operator >(FontStretch a, FontStretch b)`](#api-9e2e84af6f2ad6aa)


```csharp
public static bool operator>(FontStretch a, FontStretch b);
```

Returns `true` if the left stretch is greater than the right.

<a id="api-0fd0ef8ab07cc169"></a>

### [`bool FontStretch.operator >=(FontStretch a, FontStretch b)`](#api-0fd0ef8ab07cc169)


```csharp
public static bool operator >=(FontStretch a, FontStretch b);
```

Returns `true` if the left stretch is greater than or equal to the right.

<a id="api-3e7d086b071287a0"></a>

### [`FontStretch.implicit operator FontStretch(int value)`](#api-3e7d086b071287a0)


```csharp
public static implicit operator FontStretch(int value);
```

Implicitly converts an `System.Int32` to [`Xui.Core.Canvas.FontStretch`](../xui-core-canvas/index.md#api-313463bf68eb64a3).

<a id="api-375730358ac7d360"></a>

### [`FontStretch.implicit operator FontStretch(NFloat value)`](#api-375730358ac7d360)


```csharp
public static implicit operator FontStretch(nfloat value);
```

Implicitly converts a `System.Runtime.InteropServices.NFloat` to [`Xui.Core.Canvas.FontStretch`](../xui-core-canvas/index.md#api-313463bf68eb64a3).

<a id="api-0f043c3c4ebb870e"></a>

### [`FontStretch.implicit operator FontStretch(float value)`](#api-0f043c3c4ebb870e)


```csharp
public static implicit operator FontStretch(float value);
```

Implicitly converts a `System.Single` to [`Xui.Core.Canvas.FontStretch`](../xui-core-canvas/index.md#api-313463bf68eb64a3).

<a id="api-c538fc7c48cd45ab"></a>

### [`FontStretch.implicit operator NFloat(FontStretch stretch)`](#api-c538fc7c48cd45ab)


```csharp
public static implicit operator nfloat(FontStretch stretch);
```

Implicitly converts a [`Xui.Core.Canvas.FontStretch`](../xui-core-canvas/index.md#api-313463bf68eb64a3) to `System.Runtime.InteropServices.NFloat`.

<a id="api-7219f2915ecf0156"></a>

### [`bool FontStretch.operator !=(FontStretch a, FontStretch b)`](#api-7219f2915ecf0156)


```csharp
public static bool operator !=(FontStretch a, FontStretch b);
```

Returns `true` if two stretch values are not equal.

<a id="api-2bb5390b8aa0d19b"></a>

### [`bool FontStretch.operator <(FontStretch a, FontStretch b)`](#api-2bb5390b8aa0d19b)


```csharp
public static bool operator <(FontStretch a, FontStretch b);
```

Returns `true` if the left stretch is less than the right.

<a id="api-3120b7916c590dc5"></a>

### [`bool FontStretch.operator <=(FontStretch a, FontStretch b)`](#api-3120b7916c590dc5)


```csharp
public static bool operator <=(FontStretch a, FontStretch b);
```

Returns `true` if the left stretch is less than or equal to the right.


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

## `struct FontStyle`

Represents a web-like font style, supporting `normal`, `italic`, and `oblique` variations. Global CSS styles like `inherit`, `unset`, and `initial` are not supported. Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/font-style

```csharp
public struct FontStyle
{
    [DebuggerStepThrough]
    public FontStyle(bool italic, bool oblique, nfloat obliqueAngle);
    public bool IsItalic { get; }
    public bool IsOblique { get; }
    public nfloat ObliqueAngle { get; }
    public static FontStyle Normal { get; }
    public static FontStyle Italic { get; }
    public static FontStyle Oblique { get; }

    [DebuggerStepThrough]
    public static FontStyle CustomOblique(nfloat obliqueAngle);
}
```

<a id="api-8df0e746267422b6"></a>

### [`FontStyle.FontStyle(bool italic, bool oblique, NFloat obliqueAngle)`](#api-8df0e746267422b6)


```csharp
[DebuggerStepThrough]
public FontStyle(bool italic, bool oblique, nfloat obliqueAngle);
```

Initializes a new [`Xui.Core.Canvas.FontStyle`](../xui-core-canvas/index.md#api-b5c60993885d5dd6) with explicit flags for italic or oblique styling.

- **`italic`** — Whether the font is italic.

- **`oblique`** — Whether the font is oblique (slanted).

- **`obliqueAngle`** — Angle for oblique style, in degrees.

<a id="api-528de75d566c38a5"></a>

### [`FontStyle FontStyle.CustomOblique(NFloat obliqueAngle)`](#api-528de75d566c38a5)


```csharp
[DebuggerStepThrough]
public static FontStyle CustomOblique(nfloat obliqueAngle);
```

Creates a custom oblique font style with a specific slant angle.

- **`obliqueAngle`** — The angle of the slant, in degrees. Should be between -90 and 90.

**Returns:** A [`Xui.Core.Canvas.FontStyle`](../xui-core-canvas/index.md#api-b5c60993885d5dd6) representing the custom oblique angle.

<a id="api-3dd19681e919a79a"></a>

### [`bool FontStyle.IsItalic`](#api-3dd19681e919a79a)


```csharp
public bool IsItalic { get; }
```

Gets a value indicating whether the font style is italic.

<a id="api-dc336aeed6a8e705"></a>

### [`bool FontStyle.IsOblique`](#api-dc336aeed6a8e705)


```csharp
public bool IsOblique { get; }
```

Gets a value indicating whether the font style is oblique (slanted).

<a id="api-4a2561f82a5bcdb9"></a>

### [`FontStyle FontStyle.Italic`](#api-4a2561f82a5bcdb9)


```csharp
public static FontStyle Italic { get; }
```

Italic font style.

<a id="api-31b30397e18adff9"></a>

### [`FontStyle FontStyle.Normal`](#api-31b30397e18adff9)


```csharp
public static FontStyle Normal { get; }
```

Normal (upright) font style.

<a id="api-f8386d585ee9de84"></a>

### [`FontStyle FontStyle.Oblique`](#api-f8386d585ee9de84)


```csharp
public static FontStyle Oblique { get; }
```

Oblique font style using the default slant angle (14&#176;).

<a id="api-fa67e14cb8184541"></a>

### [`NFloat FontStyle.ObliqueAngle`](#api-fa67e14cb8184541)


```csharp
public nfloat ObliqueAngle { get; }
```

Gets the oblique slant angle, in degrees. Only meaningful if [`Xui.Core.Canvas.FontStyle.IsOblique`](../xui-core-canvas/index.md#api-dc336aeed6a8e705) is true. Range is typically from -90&#176; to 90&#176;.


<a id="api-78b732a63c79b9c9"></a>

## `readonly struct FontWeight`

Represents the numeric weight of a font, corresponding to CSS font weights (100–900).

Font weights are numeric and allow comparison using operators like `<`, `>=`, etc.

```csharp
public readonly struct FontWeight : IComparable<FontWeight>, IEquatable<FontWeight>
{
    public readonly nfloat Value;
    public FontWeight(nfloat value);
    public static implicit operator nfloat(FontWeight weight);
    public static implicit operator uint (FontWeight weight);
    public static implicit operator FontWeight(nfloat value);
    public static implicit operator FontWeight(float value);
    public static implicit operator FontWeight(int value);
    public static bool operator ==(FontWeight a, FontWeight b);
    public static bool operator !=(FontWeight a, FontWeight b);
    public static bool operator <(FontWeight a, FontWeight b);
    public static bool operator <=(FontWeight a, FontWeight b);
    public static bool operator>(FontWeight a, FontWeight b);
    public static bool operator >=(FontWeight a, FontWeight b);
    public int CompareTo(FontWeight other);
    public bool Equals(FontWeight other);
    public override bool Equals(object? obj);
    public override int GetHashCode();
    public static readonly FontWeight Thin;
    public static readonly FontWeight ExtraLight;
    public static readonly FontWeight Light;
    public static readonly FontWeight Normal;
    public static readonly FontWeight Medium;
    public static readonly FontWeight SemiBold;
    public static readonly FontWeight Bold;
    public static readonly FontWeight ExtraBold;
    public static readonly FontWeight Black;
}
```

<a id="api-c5a598735eb0b1b1"></a>

### [`FontWeight.FontWeight(NFloat value)`](#api-c5a598735eb0b1b1)


```csharp
public FontWeight(nfloat value);
```

Creates a new [`Xui.Core.Canvas.FontWeight`](../xui-core-canvas/index.md#api-78b732a63c79b9c9) with the specified numeric value.

- **`value`** — The numeric font weight value.

<a id="api-fc2f3785f7d4c194"></a>

### [`FontWeight FontWeight.Black`](#api-fc2f3785f7d4c194)


```csharp
public static readonly FontWeight Black;
```

Font weight 900 – Black. The heaviest available weight.

<a id="api-4e1307f4e05d7ea1"></a>

### [`FontWeight FontWeight.Bold`](#api-4e1307f4e05d7ea1)


```csharp
public static readonly FontWeight Bold;
```

Font weight 700 – Bold. Common for emphasis and headings.

<a id="api-f5cfb505d95ba363"></a>

### [`int FontWeight.CompareTo(FontWeight other)`](#api-f5cfb505d95ba363)


```csharp
public int CompareTo(FontWeight other);
```

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

- **`other`** — An object to compare with this instance.

**Returns:** A value that indicates the relative order of the objects being compared. The return value has these meanings: 

- **Less than zero** — This instance precedes `other` in the sort order.
- **Zero** — This instance occurs in the same position in the sort order as `other`.
- **Greater than zero** — This instance follows `other` in the sort order.

<a id="api-d7a5bf9da36375ad"></a>

### [`bool FontWeight.Equals(object? obj)`](#api-d7a5bf9da36375ad)


```csharp
public override bool Equals(object? obj);
```

Indicates whether this instance and a specified object are equal.

- **`obj`** — The object to compare with the current instance.

**Returns:** `true` if `obj` and this instance are the same type and represent the same value; otherwise, `false`.

<a id="api-0036d4e11fc2be2a"></a>

### [`bool FontWeight.Equals(FontWeight other)`](#api-0036d4e11fc2be2a)


```csharp
public bool Equals(FontWeight other);
```

Indicates whether the current object is equal to another object of the same type.

- **`other`** — An object to compare with this object.

**Returns:** `true` if the current object is equal to the `other` parameter; otherwise, `false`.

<a id="api-3d8f13acb3034b00"></a>

### [`FontWeight FontWeight.ExtraBold`](#api-3d8f13acb3034b00)


```csharp
public static readonly FontWeight ExtraBold;
```

Font weight 800 – Extra Bold. Heavier than Bold.

<a id="api-f59293afbe76f394"></a>

### [`FontWeight FontWeight.ExtraLight`](#api-f59293afbe76f394)


```csharp
public static readonly FontWeight ExtraLight;
```

Font weight 200 – Extra Light. Slightly heavier than Thin.

<a id="api-cf0a0602f5777ddd"></a>

### [`int FontWeight.GetHashCode()`](#api-cf0a0602f5777ddd)


```csharp
public override int GetHashCode();
```

Returns the hash code for this instance.

**Returns:** A 32-bit signed integer that is the hash code for this instance.

<a id="api-78a61df7ab2ff037"></a>

### [`FontWeight FontWeight.Light`](#api-78a61df7ab2ff037)


```csharp
public static readonly FontWeight Light;
```

Font weight 300 – Light. Common for minimalist design.

<a id="api-f313677f4d0fdf8b"></a>

### [`FontWeight FontWeight.Medium`](#api-f313677f4d0fdf8b)


```csharp
public static readonly FontWeight Medium;
```

Font weight 500 – Medium. Slightly heavier than normal.

<a id="api-9c0240b183f3a11e"></a>

### [`FontWeight FontWeight.Normal`](#api-9c0240b183f3a11e)


```csharp
public static readonly FontWeight Normal;
```

Font weight 400 – Normal. Standard weight for body text.

<a id="api-90c63d7ba170ce74"></a>

### [`FontWeight FontWeight.SemiBold`](#api-90c63d7ba170ce74)


```csharp
public static readonly FontWeight SemiBold;
```

Font weight 600 – Semi Bold. Between medium and bold.

<a id="api-c5742fd25aaa8614"></a>

### [`FontWeight FontWeight.Thin`](#api-c5742fd25aaa8614)


```csharp
public static readonly FontWeight Thin;
```

Font weight 100 – Thin. The lightest possible weight.

<a id="api-edcf5d8bcdea9952"></a>

### [`NFloat FontWeight.Value`](#api-edcf5d8bcdea9952)


```csharp
public readonly nfloat Value;
```

The numeric value of the font weight.

<a id="api-78d013d5a99b4531"></a>

### [`bool FontWeight.operator ==(FontWeight a, FontWeight b)`](#api-78d013d5a99b4531)


```csharp
public static bool operator ==(FontWeight a, FontWeight b);
```

Returns `true` if two font weights are equal.

<a id="api-97a9e9fc61f9fe64"></a>

### [`bool FontWeight.operator >(FontWeight a, FontWeight b)`](#api-97a9e9fc61f9fe64)


```csharp
public static bool operator>(FontWeight a, FontWeight b);
```

Returns `true` if the left font weight is greater than the right.

<a id="api-2a46b64b1a3694c8"></a>

### [`bool FontWeight.operator >=(FontWeight a, FontWeight b)`](#api-2a46b64b1a3694c8)


```csharp
public static bool operator >=(FontWeight a, FontWeight b);
```

Returns `true` if the left font weight is greater than or equal to the right.

<a id="api-a422dd3d13652d2d"></a>

### [`FontWeight.implicit operator FontWeight(int value)`](#api-a422dd3d13652d2d)


```csharp
public static implicit operator FontWeight(int value);
```

Implicitly converts an `System.Int32` to [`Xui.Core.Canvas.FontWeight`](../xui-core-canvas/index.md#api-78b732a63c79b9c9).

<a id="api-b0c5eada670f3f08"></a>

### [`FontWeight.implicit operator FontWeight(NFloat value)`](#api-b0c5eada670f3f08)


```csharp
public static implicit operator FontWeight(nfloat value);
```

Implicitly converts a `System.Runtime.InteropServices.NFloat` to [`Xui.Core.Canvas.FontWeight`](../xui-core-canvas/index.md#api-78b732a63c79b9c9).

<a id="api-71fe32181753ac82"></a>

### [`FontWeight.implicit operator FontWeight(float value)`](#api-71fe32181753ac82)


```csharp
public static implicit operator FontWeight(float value);
```

Implicitly converts a `System.Single` to [`Xui.Core.Canvas.FontWeight`](../xui-core-canvas/index.md#api-78b732a63c79b9c9).

<a id="api-93dd53bdbd5c5bf2"></a>

### [`FontWeight.implicit operator NFloat(FontWeight weight)`](#api-93dd53bdbd5c5bf2)


```csharp
public static implicit operator nfloat(FontWeight weight);
```

Implicitly converts a [`Xui.Core.Canvas.FontWeight`](../xui-core-canvas/index.md#api-78b732a63c79b9c9) to `System.Runtime.InteropServices.NFloat`.

<a id="api-557003cc39619b2a"></a>

### [`FontWeight.implicit operator uint(FontWeight weight)`](#api-557003cc39619b2a)


```csharp
public static implicit operator uint (FontWeight weight);
```

Implicitly converts a [`Xui.Core.Canvas.FontWeight`](../xui-core-canvas/index.md#api-78b732a63c79b9c9) to `System.Runtime.InteropServices.NFloat`.

<a id="api-3ab2a5fbe9de3442"></a>

### [`bool FontWeight.operator !=(FontWeight a, FontWeight b)`](#api-3ab2a5fbe9de3442)


```csharp
public static bool operator !=(FontWeight a, FontWeight b);
```

Returns `true` if two font weights are not equal.

<a id="api-61b6e97336496989"></a>

### [`bool FontWeight.operator <(FontWeight a, FontWeight b)`](#api-61b6e97336496989)


```csharp
public static bool operator <(FontWeight a, FontWeight b);
```

Returns `true` if the left font weight is less than the right.

<a id="api-39be75bbeddbef30"></a>

### [`bool FontWeight.operator <=(FontWeight a, FontWeight b)`](#api-39be75bbeddbef30)


```csharp
public static bool operator <=(FontWeight a, FontWeight b);
```

Returns `true` if the left font weight is less than or equal to the right.


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

## `struct GradientStop`

Represents a single color stop in a gradient, defined by an offset and a color. Used for both linear and radial gradients.

```csharp
public struct GradientStop
{
    public nfloat Offset;
    public Color Color;
    public GradientStop(nfloat offset, Color color);
    public GradientStop(nfloat offset, uint color);
    public static implicit operator GradientStop((nfloat Offset, Color Color) pair);
    public static implicit operator GradientStop((nfloat Offset, uint Color) pair);
}
```

<a id="api-5db3b7da3a56be51"></a>

### [`GradientStop.GradientStop(NFloat offset, uint color)`](#api-5db3b7da3a56be51)


```csharp
public GradientStop(nfloat offset, uint color);
```

Initializes a new [`Xui.Core.Canvas.GradientStop`](../xui-core-canvas/index.md#api-b4b31723d70a4475) with a specified offset and packed RGBA color.

- **`offset`** — Position of the color stop, usually from 0 to 1.

- **`color`** — Color in packed 0xRRGGBBAA format.

<a id="api-1cb82489118a96db"></a>

### [`GradientStop.GradientStop(NFloat offset, Color color)`](#api-1cb82489118a96db)


```csharp
public GradientStop(nfloat offset, Color color);
```

Initializes a new [`Xui.Core.Canvas.GradientStop`](../xui-core-canvas/index.md#api-b4b31723d70a4475) with a specified offset and color.

- **`offset`** — Position of the color stop, usually from 0 to 1.

- **`color`** — Color at the given offset.

<a id="api-6c6ead6326932f3b"></a>

### [`Color GradientStop.Color`](#api-6c6ead6326932f3b)


```csharp
public Color Color;
```

The color at the specified offset.

<a id="api-47a9d6c7c1a69eaf"></a>

### [`NFloat GradientStop.Offset`](#api-47a9d6c7c1a69eaf)


```csharp
public nfloat Offset;
```

The position of the stop within the gradient, typically in the range [0, 1].

<a id="api-4f054a2405220d9c"></a>

### [`GradientStop.implicit operator GradientStop((NFloat Offset, uint Color) pair)`](#api-4f054a2405220d9c)


```csharp
public static implicit operator GradientStop((nfloat Offset, uint Color) pair);
```

Implicitly converts a tuple of `System.Runtime.InteropServices.NFloat` and `uint` (0xRRGGBBAA) to a [`Xui.Core.Canvas.GradientStop`](../xui-core-canvas/index.md#api-b4b31723d70a4475).

- **`pair`** — A tuple containing offset and packed RGBA color.

<a id="api-296124256b651cd6"></a>

### [`GradientStop.implicit operator GradientStop((NFloat Offset, Color Color) pair)`](#api-296124256b651cd6)


```csharp
public static implicit operator GradientStop((nfloat Offset, Color Color) pair);
```

Implicitly converts a tuple of `System.Runtime.InteropServices.NFloat` and [`Xui.Core.Canvas.GradientStop.Color`](../xui-core-canvas/index.md#api-6c6ead6326932f3b) to a [`Xui.Core.Canvas.GradientStop`](../xui-core-canvas/index.md#api-b4b31723d70a4475).

- **`pair`** — A tuple containing offset and color.


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

## `interface ICompositionContext`

Declares explicit groups in the drawing order of a canvas.

```csharp
public interface ICompositionContext
{
    CompositionGroup Group(scoped in GroupOptions options);
    bool GpuSurface(scoped in GroupOptions options);
    bool GpuSurface(scoped in GroupOptions options, out GpuSurfaceFailure failure);
    static void ValidateGpuSurface(scoped in GroupOptions options);
    void EndGroup();
}
```

<a id="api-8452f6d3e6022c85"></a>

### [`void ICompositionContext.EndGroup()`](#api-8452f6d3e6022c85)


```csharp
void EndGroup();
```

Closes the innermost group. Called by [`Xui.Core.Canvas.Composition.Graphics.CompositionGroup.Dispose`](../xui-core-canvas-composition-graphics/index.md#api-4da1045a19688500); prefer disposing the returned scope over calling this directly.

<a id="api-2721434cda6046b2"></a>

### [`bool ICompositionContext.GpuSurface(scoped in GroupOptions options)`](#api-2721434cda6046b2)


```csharp
bool GpuSurface(scoped in GroupOptions options);
```

Declares a native GPU leaf in drawing order. Key must be a stable class implementing IGpuSurfaceContent; Bounds is required. Rendering is deferred until native placement, and requested when HasUpdates is true or the retained surface needs fresh content. Available from a Window render context as well as a View render context.

**Returns:** True when native presentation is supported here; false requests an explicit application fallback (for example an offscreen image for SVG export). A false return does not change composition state. Arbitrary inherited canvas clips are unsupported; use group bounds clipping. Native GPU content does not inherit canvas paint/filter.

**Example**

A Window can declare the surface directly from its RenderEventRef.Context: 

```csharp
context.GpuSurface(new GroupOptions
{
    Key = cube, // cube implements IGpuSurfaceContent
    Bounds = displayArea,
    HasUpdates = cubeChanged
});
```

 Check the returned bool and render a portable fallback when false.

<a id="api-eb6c4e816159ab48"></a>

### [`bool ICompositionContext.GpuSurface(scoped in GroupOptions options, out GpuSurfaceFailure failure)`](#api-eb6c4e816159ab48)


```csharp
bool GpuSurface(scoped in GroupOptions options, out GpuSurfaceFailure failure);
```

Attempts native GPU presentation and reports why it could not be accepted. Use [`Xui.Core.Canvas.Composition.GPU.GpuSurfaceFailure.NotSupported`](../xui-core-canvas-composition-gpu/index.md#api-85defc4a4bf54ba1) to display an unavailable message; [`Xui.Core.Canvas.Composition.GPU.GpuSurfaceFailure.PortableFallbackRequired`](../xui-core-canvas-composition-gpu/index.md#api-dcfab80fd2fe3ff5) permits an explicit export or offscreen fallback. Invalid options and rendering/shader errors still throw.

Older contexts preserve their existing portable-fallback behavior.

<a id="api-3fb51d1083d5a53f"></a>

### [`CompositionGroup ICompositionContext.Group(scoped in GroupOptions options)`](#api-3fb51d1083d5a53f)


```csharp
CompositionGroup Group(scoped in GroupOptions options);
```

Opens a group and applies its presentation properties. Draw through the same context only when the returned scope&#39;s [`Xui.Core.Canvas.Composition.Graphics.CompositionGroup.NeedsRedraw`](../xui-core-canvas-composition-graphics/index.md#api-580b9f5e0be91388) is true. Dispose the scope before drawing subsequent siblings.

Keys identify siblings by reference, not value equality. Use a stable reference, not a boxed value or a newly allocated key each frame. HasUpdates=false permits reuse; it never guarantees it. Export and immediate contexts always request drawing. A retained backend must also redraw when it lacks valid content. Reusing a group reuses its entire subtree, so HasUpdates must include relevant descendant changes. Presentation changes are processed even when content can be reused. HasUpdates=true must request drawing; it is also used by capture middleware to force both the display and export branches to accept the same drawing commands. Groups inherit drawing state and restore it on disposal, with the same path and state semantics as Save/Restore. Bounds do not change the coordinate origin. In a view-backed group, issue direct drawing before declaring child surfaces. To draw above those children, declare a separate overlay group. Retained backends reject drawing that violates this ordering instead of silently changing its depth. An inherited arbitrary canvas clip may require flattening a surface into its parent; that fallback requests drawing on every frame. Prefer group bounds clipping when native composition and content reuse are needed.

**Example**

```csharp
using var group = context.Group(new GroupOptions
{
    Key = this,
    HasUpdates = HasRenderUpdates,
    Bounds = Frame
});
if (group.NeedsRedraw)
    DrawContent(context);
```

<a id="api-e17e23edd395cbf5"></a>

### [`void ICompositionContext.ValidateGpuSurface(scoped in GroupOptions options)`](#api-e17e23edd395cbf5)


```csharp
static void ValidateGpuSurface(scoped in GroupOptions options);
```

Validates GPU identity and bounds before a backend changes state.


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

## `interface IContext`

Represents a 2D drawing context for the Xui Canvas, modeled after the HTML5 Canvas 2D context API. This interface aggregates all sub-contexts responsible for different aspects of 2D rendering, including state, drawing primitives, text, images, transformations, and resource management.

```csharp
public interface IContext : IMeasureContext, IStateContext, ISymbolContext, ICompositionContext, IFilterContext, IPenContext, IPathDrawingContext, IRectDrawingContext, ITextDrawingContext, IImageDrawingContext, ITransformContext, IDisposable
{
}
```


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

## `interface IFilterContext`

Controls source-color adjustment when selecting canvas paints.

Set the filter before SetFill or SetStroke. It transforms solid colors and gradient stop colors as the paint is selected, including paints used for text. Existing paints and images are unchanged. The filter replaces the previous adjustment and participates in Save/Restore.

```csharp
public interface IFilterContext
{
    void SetFilter();
    void SetFilter(Brightness brightness);
}
```

<a id="api-b8b9fb248bc0b8a8"></a>

### [`void IFilterContext.SetFilter()`](#api-b8b9fb248bc0b8a8)


```csharp
void SetFilter();
```

Disables adjustment for subsequently selected paints.

<a id="api-666241e02b6495e3"></a>

### [`void IFilterContext.SetFilter(Brightness brightness)`](#api-666241e02b6495e3)


```csharp
void SetFilter(Brightness brightness);
```

Sets the brightness of subsequently selected paints.


<a id="api-135fd5343e7bedc7"></a>

## `interface IFontSource`

Supplies declared application fonts and loads their bytes on demand. A platform must fall back to its installed font catalogue when no resource exactly matches a request.

```csharp
public interface IFontSource
{
    IEnumerable<FontResource> Resources { get; }

    bool TryGet(in Font font, out FontResource resource);
    ReadOnlyMemory<byte> Load(in FontResource resource);
}
```

<a id="api-75b6480eb344102a"></a>

### [`ReadOnlyMemory<byte> IFontSource.Load(in FontResource resource)`](#api-75b6480eb344102a)


```csharp
ReadOnlyMemory<byte> Load(in FontResource resource);
```

Loads a resource&#39;s bytes when a consumer needs them.

<a id="api-83a26ff72bc9b069"></a>

### [`IEnumerable<FontResource> IFontSource.Resources`](#api-83a26ff72bc9b069)


```csharp
IEnumerable<FontResource> Resources { get; }
```

Gets all declared resources without loading their data.

<a id="api-fe77681a1ccad2d5"></a>

### [`bool IFontSource.TryGet(in Font font, out FontResource resource)`](#api-fe77681a1ccad2d5)


```csharp
bool TryGet(in Font font, out FontResource resource);
```

Finds the exact application-provided face for a request.


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

## `interface IGlyphPathBuilder`

A lightweight interface for constructing TrueType glyph paths using move, line, curve, and close commands.

Glyphs in TrueType fonts use quadratic B&#233;zier curves with optional off-curve control points. This interface is intended for glyph outlines and font rendering engines.

```csharp
public interface IGlyphPathBuilder
{
    void MoveTo(Point to);
    void LineTo(Point to);
    void CurveTo(Point control, Point to);
    void ClosePath();
}
```

<a id="api-714f25e165439910"></a>

### [`void IGlyphPathBuilder.ClosePath()`](#api-714f25e165439910)


```csharp
void ClosePath();
```

Closes the current path contour.

<a id="api-2b6c0e39768ec434"></a>

### [`void IGlyphPathBuilder.CurveTo(Point control, Point to)`](#api-2b6c0e39768ec434)


```csharp
void CurveTo(Point control, Point to);
```

Draws a quadratic B&#233;zier curve using a control point and end point.

<a id="api-9b71d6af4664312d"></a>

### [`void IGlyphPathBuilder.LineTo(Point to)`](#api-9b71d6af4664312d)


```csharp
void LineTo(Point to);
```

Draws a straight line to the specified point.

<a id="api-df2027c988ec041c"></a>

### [`void IGlyphPathBuilder.MoveTo(Point to)`](#api-df2027c988ec041c)


```csharp
void MoveTo(Point to);
```

Begins a new sub-path at the specified point.


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

## `interface IImage`

Represents a decoded, GPU-resident image. Acts as a self-loading resource handle — analogous to `HTMLImageElement` in the browser. 

Acquire instances via `GetService(typeof(IImage))` on any [`Xui.Core.UI.View`](../xui-core-ui/index.md#api-0389f82d4babca03). Then set the source with [`Xui.Core.Canvas.IImage.Load(System.String)`](../xui-core-canvas/index.md#api-9abad04c49debcf0) (sync-if-cached) or [`Xui.Core.Canvas.IImage.LoadAsync(System.String)`](../xui-core-canvas/index.md#api-5a791840f9ac7ca4) for first-time remote or large assets.

```csharp
public interface IImage
{
    Size Size { get; }

    void Load(string uri);
    Task LoadAsync(string uri);
    void LoadPixels(int width, int height, ReadOnlySpan<byte> bgra32Data);
}
```

<a id="api-9abad04c49debcf0"></a>

### [`void IImage.Load(string uri)`](#api-9abad04c49debcf0)


```csharp
void Load(string uri);
```

Loads the image from `uri`. Returns immediately if the image is already in the platform catalog. For local packaged assets this may block on first call; prefer [`Xui.Core.Canvas.IImage.LoadAsync(System.String)`](../xui-core-canvas/index.md#api-5a791840f9ac7ca4) for anything that could be slow.

<a id="api-5a791840f9ac7ca4"></a>

### [`Task IImage.LoadAsync(string uri)`](#api-5a791840f9ac7ca4)


```csharp
Task LoadAsync(string uri);
```

Loads the image from `uri` on a background thread. The returned task completes once the image is decoded and GPU-resident. Subsequent [`Xui.Core.Canvas.IImage.Load(System.String)`](../xui-core-canvas/index.md#api-9abad04c49debcf0) calls with the same URI return instantly from cache.

<a id="api-295ea6c6f34e0ce5"></a>

### [`void IImage.LoadPixels(int width, int height, ReadOnlySpan<byte> bgra32Data)`](#api-295ea6c6f34e0ce5)


```csharp
void LoadPixels(int width, int height, ReadOnlySpan<byte> bgra32Data);
```

Uploads raw CPU pixel data into this image, replacing any previously loaded content. `bgra32Data` must contain `width * height * 4` bytes in BGRA order (B at the lowest address), matching `DXGI_FORMAT_B8G8R8A8_UNORM`. Default implementation is a no-op on platforms that do not support pixel upload.

<a id="api-e2424bd491ba8158"></a>

### [`Size IImage.Size`](#api-e2424bd491ba8158)


```csharp
Size Size { get; }
```

Intrinsic size of the image in points. Returns [`Xui.Core.Math2D.Size.Empty`](../xui-core-math2d/index.md#api-89bf9ed1f6720fde) until loaded.


<a id="api-4c654853e0c036ef"></a>

## `interface IImageDrawingContext`

Defines methods for drawing images onto the canvas. Mirrors the `drawImage` API from the HTML5 Canvas 2D context. https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage

```csharp
public interface IImageDrawingContext
{
    void DrawImage(IImage image, Rect dest);
    void DrawImage(IImage image, Rect dest, nfloat opacity);
    void DrawImage(IImage image, Rect source, Rect dest, nfloat opacity);
}
```

<a id="api-cc5302a1b265886b"></a>

### [`void IImageDrawingContext.DrawImage(IImage image, Rect dest)`](#api-cc5302a1b265886b)


```csharp
void DrawImage(IImage image, Rect dest);
```

Draws the entire `image` scaled to fit `dest` at full opacity.

<a id="api-7b26d6b8a0b4c43d"></a>

### [`void IImageDrawingContext.DrawImage(IImage image, Rect dest, NFloat opacity)`](#api-7b26d6b8a0b4c43d)


```csharp
void DrawImage(IImage image, Rect dest, nfloat opacity);
```

Draws the entire `image` scaled to fit `dest` at the given `opacity`.

<a id="api-b2aef3bb1f526e1c"></a>

### [`void IImageDrawingContext.DrawImage(IImage image, Rect source, Rect dest, NFloat opacity)`](#api-b2aef3bb1f526e1c)


```csharp
void DrawImage(IImage image, Rect source, Rect dest, nfloat opacity);
```

Draws the sub-region `source` of `image` scaled to fit `dest` at the given `opacity`. Mirrors the 9-argument form of `drawImage` in the HTML5 Canvas API.


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

## `interface IMeasureContext`

Defines a measurement context that provides access to platform-specific text metrics, supports subpixel snapping for layout precision, and enables accurate text size calculations using the underlying rendering engine&#39;s font rasterization and shaping systems.

```csharp
public interface IMeasureContext : ITextMeasureContext
{
}
```


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

## `interface IPathBuilder`

Defines methods for constructing paths, following the HTML5 Canvas path API model. Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

```csharp
public interface IPathBuilder : IGlyphPathBuilder
{
    void BeginPath();
    void CurveTo(Point cp1, Point cp2, Point to);
    void Arc(Point center, nfloat radius, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
    void ArcTo(Point cp1, Point cp2, nfloat radius);
    void Ellipse(Point center, nfloat radiusX, nfloat radiusY, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
    void Rect(Rect rect);
    void RoundRect(Rect rect, nfloat radius);
    void RoundRect(Rect rect, CornerRadius radius);
}
```

<a id="api-7ed0feae1e255fbd"></a>

### [`void IPathBuilder.Arc(Point center, NFloat radius, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)`](#api-7ed0feae1e255fbd)


```csharp
void Arc(Point center, nfloat radius, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
```

Adds an arc to the path centered at the specified point.

- **`center`** — Center of the arc.

- **`radius`** — Radius of the arc.

- **`startAngle`** — Start angle in radians.

- **`endAngle`** — End angle in radians.

- **`winding`** — Direction in which the arc is drawn.

<a id="api-5ae047b0138d5860"></a>

### [`void IPathBuilder.ArcTo(Point cp1, Point cp2, NFloat radius)`](#api-5ae047b0138d5860)


```csharp
void ArcTo(Point cp1, Point cp2, nfloat radius);
```

Adds an arc to the path, connecting two tangents defined by control points.

- **`cp1`** — First control point.

- **`cp2`** — Second control point.

- **`radius`** — Arc radius.

<a id="api-660735930323f648"></a>

### [`void IPathBuilder.BeginPath()`](#api-660735930323f648)


```csharp
void BeginPath();
```

Begins a new path by resetting the current path list.

<a id="api-b0e0ac6f8e116dd9"></a>

### [`void IPathBuilder.CurveTo(Point cp1, Point cp2, Point to)`](#api-b0e0ac6f8e116dd9)


```csharp
void CurveTo(Point cp1, Point cp2, Point to);
```

Draws a cubic B&#233;zier curve from the current point to the specified point, using two control points.

- **`cp1`** — First control point.

- **`cp2`** — Second control point.

- **`to`** — End point.

<a id="api-fb1b6e25fa536324"></a>

### [`void IPathBuilder.Ellipse(Point center, NFloat radiusX, NFloat radiusY, NFloat rotation, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)`](#api-fb1b6e25fa536324)


```csharp
void Ellipse(Point center, nfloat radiusX, nfloat radiusY, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
```

Adds an elliptical arc to the path.

- **`center`** — Center of the ellipse.

- **`radiusX`** — Horizontal radius.

- **`radiusY`** — Vertical radius.

- **`rotation`** — Rotation of the ellipse, in radians.

- **`startAngle`** — Start angle in radians.

- **`endAngle`** — End angle in radians.

- **`winding`** — Direction in which the arc is drawn.

<a id="api-ad5e80f5d23771ad"></a>

### [`void IPathBuilder.Rect(Rect rect)`](#api-ad5e80f5d23771ad)


```csharp
void Rect(Rect rect);
```

Adds a rectangle path to the current path.

- **`rect`** — The rectangle to add.

<a id="api-36e78a57404ddbbc"></a>

### [`void IPathBuilder.RoundRect(Rect rect, NFloat radius)`](#api-36e78a57404ddbbc)


```csharp
void RoundRect(Rect rect, nfloat radius);
```

Adds a rounded rectangle path with a uniform radius.

- **`rect`** — The rectangle to round.

- **`radius`** — Corner radius.

<a id="api-c66c3df7341fdc67"></a>

### [`void IPathBuilder.RoundRect(Rect rect, CornerRadius radius)`](#api-c66c3df7341fdc67)


```csharp
void RoundRect(Rect rect, CornerRadius radius);
```

Adds a rounded rectangle path with per-corner radii.

- **`rect`** — The rectangle to round.

- **`radius`** — Corner radius object defining each corner.


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

## `interface IPathClipping`

Defines methods for clipping using a path, following the HTML5 Canvas path API model. Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

```csharp
public interface IPathClipping
{
    void Clip();
}
```

<a id="api-0487ea46be8b124f"></a>

### [`void IPathClipping.Clip()`](#api-0487ea46be8b124f)


```csharp
void Clip();
```

Sets the current clipping region to the current path. Subsequent drawing operations are clipped to this region.


<a id="api-39751b77a3823e32"></a>

## `interface IPathDrawing`

Defines methods for drawing a constructed path, following the HTML5 Canvas path API model. Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

```csharp
public interface IPathDrawing
{
    void Fill(FillRule rule = FillRule.NonZero);
    void Stroke();
}
```

<a id="api-073e6fc770b081f5"></a>

### [`void IPathDrawing.Fill(FillRule rule = FillRule.NonZero)`](#api-073e6fc770b081f5)


```csharp
void Fill(FillRule rule = FillRule.NonZero);
```

Fills the current path using the specified fill rule.

- **`rule`** — The fill rule to use (NonZero or EvenOdd).

<a id="api-3476cbce7b8dfc52"></a>

### [`void IPathDrawing.Stroke()`](#api-3476cbce7b8dfc52)


```csharp
void Stroke();
```

Strokes the current path using the current stroke style.


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

## `interface IPathDrawingContext`

Defines methods for constructing and rendering 2D paths, following the HTML5 Canvas path API model. Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

```csharp
public interface IPathDrawingContext : IPathBuilder, IPathDrawing, IPathClipping
{
}
```


<a id="api-30d0f5d993a1fc75"></a>

## `interface IPenContext`

Defines properties and methods for controlling stroke and fill styles in a 2D drawing context, including line caps, joins, width, dashes, and brush settings for fill and stroke.

```csharp
public interface IPenContext
{
    nfloat GlobalAlpha { set; }

    LineCap LineCap { set; }

    LineJoin LineJoin { set; }

    nfloat LineWidth { set; }

    nfloat MiterLimit { set; }

    nfloat LineDashOffset { set; }

    void SetLineDash(ReadOnlySpan<nfloat> segments);
    void SetStroke(Color color);
    void SetStroke(LinearGradient linearGradient);
    void SetStroke(RadialGradient radialGradient);
    void SetFill(Color color);
    void SetFill(LinearGradient linearGradient);
    void SetFill(RadialGradient radialGradient);
    void SetFill(ImagePattern pattern);
    void SetStroke(ImagePattern pattern);
}
```

<a id="api-9b937c21370fdf9e"></a>

### [`NFloat IPenContext.GlobalAlpha`](#api-9b937c21370fdf9e)


```csharp
nfloat GlobalAlpha { set; }
```

Sets the global alpha value for all drawing operations. Range: 0.0 (fully transparent) to 1.0 (fully opaque).

<a id="api-feeb2fdc6059a9b5"></a>

### [`LineCap IPenContext.LineCap`](#api-feeb2fdc6059a9b5)


```csharp
LineCap LineCap { set; }
```

Sets the style of line caps used for strokes.

<a id="api-aac748d53ba3a85e"></a>

### [`NFloat IPenContext.LineDashOffset`](#api-aac748d53ba3a85e)


```csharp
nfloat LineDashOffset { set; }
```

Sets the phase offset for the start of the dash pattern.

<a id="api-98e121ef88c28d77"></a>

### [`LineJoin IPenContext.LineJoin`](#api-98e121ef88c28d77)


```csharp
LineJoin LineJoin { set; }
```

Sets the style of line joins between segments.

<a id="api-2fb494d2d3350077"></a>

### [`NFloat IPenContext.LineWidth`](#api-2fb494d2d3350077)


```csharp
nfloat LineWidth { set; }
```

Sets the width of stroked lines, in user space units.

<a id="api-18021113270e9d2c"></a>

### [`NFloat IPenContext.MiterLimit`](#api-18021113270e9d2c)


```csharp
nfloat MiterLimit { set; }
```

Sets the miter limit ratio for miter joins. If the ratio of miter length to line width exceeds this value, a bevel join is used instead.

<a id="api-5eea1b4270411ff1"></a>

### [`void IPenContext.SetFill(Color color)`](#api-5eea1b4270411ff1)


```csharp
void SetFill(Color color);
```

Sets the fill style to a solid color.

- **`color`** — The fill color.

<a id="api-932c0cb783ae9606"></a>

### [`void IPenContext.SetFill(ImagePattern pattern)`](#api-932c0cb783ae9606)


```csharp
void SetFill(ImagePattern pattern);
```

Sets the fill style to a tiled image pattern, equivalent to `ctx.fillStyle = ctx.createPattern(image, repetition)` in the browser.

<a id="api-922aeebbcc8f9f30"></a>

### [`void IPenContext.SetFill(LinearGradient linearGradient)`](#api-922aeebbcc8f9f30)


```csharp
void SetFill(LinearGradient linearGradient);
```

Sets the fill style to a linear gradient.

- **`linearGradient`** — The gradient to use for filling shapes.

<a id="api-d3339b0dff5d720e"></a>

### [`void IPenContext.SetFill(RadialGradient radialGradient)`](#api-d3339b0dff5d720e)


```csharp
void SetFill(RadialGradient radialGradient);
```

Sets the fill style to a radial gradient.

- **`radialGradient`** — The gradient to use for filling shapes.

<a id="api-cb4d754647f52b06"></a>

### [`void IPenContext.SetLineDash(ReadOnlySpan<NFloat> segments)`](#api-cb4d754647f52b06)


```csharp
void SetLineDash(ReadOnlySpan<nfloat> segments);
```

Sets the dash pattern used for stroking lines. Each element in the span represents a dash or gap length, alternating.

- **`segments`** — A sequence of dash and gap lengths.

<a id="api-899bea395d80fe88"></a>

### [`void IPenContext.SetStroke(Color color)`](#api-899bea395d80fe88)


```csharp
void SetStroke(Color color);
```

Sets the stroke style to a solid color.

- **`color`** — The stroke color.

<a id="api-5edde7ffb8ff8ec8"></a>

### [`void IPenContext.SetStroke(ImagePattern pattern)`](#api-5edde7ffb8ff8ec8)


```csharp
void SetStroke(ImagePattern pattern);
```

Sets the stroke style to a tiled image pattern.

<a id="api-c0c9a3ef5abc62e4"></a>

### [`void IPenContext.SetStroke(LinearGradient linearGradient)`](#api-c0c9a3ef5abc62e4)


```csharp
void SetStroke(LinearGradient linearGradient);
```

Sets the stroke style to a linear gradient.

- **`linearGradient`** — The gradient to use for stroking paths.

<a id="api-0582e55077c04e4a"></a>

### [`void IPenContext.SetStroke(RadialGradient radialGradient)`](#api-0582e55077c04e4a)


```csharp
void SetStroke(RadialGradient radialGradient);
```

Sets the stroke style to a radial gradient.

- **`radialGradient`** — The gradient to use for stroking paths.


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

## `interface IRectDrawingContext`

Provides convenience methods for drawing filled and stroked rectangles, similar to the `fillRect()` and `strokeRect()` functions in the HTML5 Canvas API.

```csharp
public interface IRectDrawingContext
{
    void StrokeRect(Rect rect);
    void FillRect(Rect rect);
}
```

<a id="api-f53ea79316d2d53c"></a>

### [`void IRectDrawingContext.FillRect(Rect rect)`](#api-f53ea79316d2d53c)


```csharp
void FillRect(Rect rect);
```

Fills the specified rectangle using the current fill style.

- **`rect`** — The rectangle to fill.

<a id="api-4e3d0eca9d448a8a"></a>

### [`void IRectDrawingContext.StrokeRect(Rect rect)`](#api-4e3d0eca9d448a8a)


```csharp
void StrokeRect(Rect rect);
```

Draws the outline of the specified rectangle using the current stroke style.

- **`rect`** — The rectangle to stroke.


<a id="api-3b3119fe132bf38c"></a>

## `interface IStateContext`

Provides methods to save and restore the current drawing state, including styles, transforms, and clipping paths. Mirrors the behavior of the HTML5 Canvas `save()` and `restore()` methods.

```csharp
public interface IStateContext
{
    void Save();
    void Restore();
}
```

<a id="api-55ce8c40b013746e"></a>

### [`void IStateContext.Restore()`](#api-55ce8c40b013746e)


```csharp
void Restore();
```

Pops the top state off the state stack and restores it. Any modifications made since the last [`Xui.Core.Canvas.IStateContext.Save`](../xui-core-canvas/index.md#api-0bf5530bbfababb7) are discarded.

<a id="api-0bf5530bbfababb7"></a>

### [`void IStateContext.Save()`](#api-0bf5530bbfababb7)


```csharp
void Save();
```

Pushes the current drawing state onto the state stack. This includes styles, transformations, clipping paths, etc.


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

## `interface ISymbolContext`

Defines reusable vector drawings independently of their placements.

**Example**

```csharp
using (var symbol = context.Symbol(new SymbolOptions { Key = chair, Bounds = (0, 0, 40, 40) }))
{
    if (symbol.NeedsDrawing)
    {
        symbol.Context.SetFill(Colors.Gray);
        symbol.Context.FillRect((4, 4, 32, 32));
    }
}
context.Save();
context.Translate((100, 50));
context.UseSymbol(chair);
context.Restore();
```

Definitions start with default pen, alpha and text state. Placements inherit the current transform, clip and brightness, and restore enclosing paint/text state afterwards. Use relative transforms inside definitions. Native view groups, GPU surfaces, absolute SetTransform and nested symbols are not supported inside a symbol. On recording failure, call the scope&#39;s Cancel method before disposing it. Cache storage follows reference lifetime; ReleaseSymbol drops a key without invalidating already-recorded placements.

```csharp
public interface ISymbolContext
{
    SymbolScope Symbol(scoped in SymbolOptions options);
    void UseSymbol(object key);
    void ReleaseSymbol(object key);
    void DrawSymbol(SymbolContent content);
}
```

<a id="api-c089030cf88389be"></a>

### [`void ISymbolContext.DrawSymbol(SymbolContent content)`](#api-c089030cf88389be)


```csharp
void DrawSymbol(SymbolContent content);
```

Backend playback entry point. Retained contexts record a reference; native contexts may compile it. The default implements vector command replay for any IContext.

<a id="api-d925fbc5a86dc579"></a>

### [`void ISymbolContext.ReleaseSymbol(object key)`](#api-d925fbc5a86dc579)


```csharp
void ReleaseSymbol(object key);
```

Forgets a definition. Previously recorded placements retain their immutable content.

<a id="api-5c9da42dfb30266a"></a>

### [`SymbolScope ISymbolContext.Symbol(scoped in SymbolOptions options)`](#api-5c9da42dfb30266a)


```csharp
SymbolScope Symbol(scoped in SymbolOptions options);
```

Opens a definition without drawing it. When NeedsDrawing is true, draw into the returned scope&#39;s Context, then dispose the scope before calling UseSymbol. Keys use reference identity. A new context may request the definition again.

<a id="api-c94fecb9f1ecb3fe"></a>

### [`void ISymbolContext.UseSymbol(object key)`](#api-c94fecb9f1ecb3fe)


```csharp
void UseSymbol(object key);
```

Draws a completed definition under the current transform and clip.


<a id="api-01483d29d383a917"></a>

## `interface ITextDrawingContext`

Defines methods for drawing text onto the canvas, including alignment and baseline options. Mirrors the HTML5 Canvas 2D text API for `fillText()`. Also provides access to text measurement via [`Xui.Core.Canvas.ITextMeasureContext`](../xui-core-canvas/index.md#api-c5fb015c0990d9ad).

```csharp
public interface ITextDrawingContext : ITextMeasureContext
{
    TextAlign TextAlign { set; }

    TextBaseline TextBaseline { set; }

    void FillText(string text, Point pos);
    void FillText(ReadOnlySpan<char> text, Point pos);
    void FillText(FillTextInterpolatedStringHandler handler, Point pos);
}
```

<a id="api-eddb9b12babfdfea"></a>

### [`void ITextDrawingContext.FillText(ReadOnlySpan<char> text, Point pos)`](#api-eddb9b12babfdfea)


```csharp
void FillText(ReadOnlySpan<char> text, Point pos);
```

Draws filled text at the specified position without allocating a string. Use with `stackalloc` and `System.ISpanFormattable.TryFormat(System.Span{System.Char},System.Int32@,System.ReadOnlySpan{System.Char},System.IFormatProvider)` for zero-allocation rendering.

- **`text`** — The text characters to render.

- **`pos`** — The position at which to start rendering the text.

<a id="api-72687ff95f75c424"></a>

### [`void ITextDrawingContext.FillText(string text, Point pos)`](#api-72687ff95f75c424)


```csharp
void FillText(string text, Point pos);
```

Draws filled text at the specified position using the current fill style and font settings.

- **`text`** — The text string to render.

- **`pos`** — The position at which to start rendering the text.

<a id="api-6b6bf0c58a6129d5"></a>

### [`void ITextDrawingContext.FillText(FillTextInterpolatedStringHandler handler, Point pos)`](#api-6b6bf0c58a6129d5)


```csharp
void FillText(FillTextInterpolatedStringHandler handler, Point pos);
```

Draws filled text from an interpolated string without heap-allocating the string. The compiler automatically prefers this overload for interpolated string arguments.

- **`handler`** — The interpolated string handler that formats into a stack buffer.

- **`pos`** — The position at which to start rendering the text.

<a id="api-8ab7e16189c02599"></a>

### [`TextAlign ITextDrawingContext.TextAlign`](#api-8ab7e16189c02599)


```csharp
TextAlign TextAlign { set; }
```

Sets the horizontal alignment of the text relative to the given position.

<a id="api-fd70dc1ee9f370c3"></a>

### [`TextBaseline ITextDrawingContext.TextBaseline`](#api-fd70dc1ee9f370c3)


```csharp
TextBaseline TextBaseline { set; }
```

Sets the vertical alignment of the text relative to the given baseline.


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

## `interface ITextMeasureContext`

Provides functionality for measuring text and setting font properties. Mirrors the measurement behavior of the HTML5 Canvas 2D context, but returns a full [`Xui.Core.Canvas.TextMetrics`](../xui-core-canvas/index.md#api-bcb94869139203e5) structure for advanced layout.

```csharp
public interface ITextMeasureContext
{
    TextMetrics MeasureText(string text);
    TextMetrics MeasureText(ReadOnlySpan<char> text);
    void SetFont(Font font);
    int HitTestTextPosition(string text, nfloat x);
    int HitTestTextPosition(ReadOnlySpan<char> text, nfloat x);
}
```

<a id="api-9b68e983f266dd73"></a>

### [`int ITextMeasureContext.HitTestTextPosition(ReadOnlySpan<char> text, NFloat x)`](#api-9b68e983f266dd73)


```csharp
int HitTestTextPosition(ReadOnlySpan<char> text, nfloat x);
```

Returns the character index (caret position) in `text` closest to the given `x` coordinate, using the current font. The result ranges from 0 (before the first character) to text.Length (after the last character). The position snaps to whichever side of a character&#39;s midpoint `x` falls on.

- **`text`** — The text to hit-test against.

- **`x`** — The horizontal offset to test, relative to the text origin.

**Returns:** The nearest caret position (0 to text.Length).

<a id="api-fc7aef5f12fafc24"></a>

### [`int ITextMeasureContext.HitTestTextPosition(string text, NFloat x)`](#api-fc7aef5f12fafc24)


```csharp
int HitTestTextPosition(string text, nfloat x);
```

Returns the character index (caret position) in `text` closest to the given `x` coordinate, using the current font. The result ranges from 0 (before the first character) to text.Length (after the last character). The position snaps to whichever side of a character&#39;s midpoint `x` falls on.

- **`text`** — The text to hit-test against.

- **`x`** — The horizontal offset to test, relative to the text origin.

**Returns:** The nearest caret position (0 to text.Length).

<a id="api-421b1f6e20e29b2a"></a>

### [`TextMetrics ITextMeasureContext.MeasureText(ReadOnlySpan<char> text)`](#api-421b1f6e20e29b2a)


```csharp
TextMetrics MeasureText(ReadOnlySpan<char> text);
```

Measures the layout and bounding box metrics of the specified text without allocating a string.

- **`text`** — The text characters to measure.

**Returns:** A [`Xui.Core.Canvas.TextMetrics`](../xui-core-canvas/index.md#api-bcb94869139203e5) structure containing both string-specific and font-wide metrics.

<a id="api-80fd5b042c733dc5"></a>

### [`TextMetrics ITextMeasureContext.MeasureText(string text)`](#api-80fd5b042c733dc5)


```csharp
TextMetrics MeasureText(string text);
```

Measures the layout and bounding box metrics of the specified text string using the current font.

- **`text`** — The text string to measure.

**Returns:** A [`Xui.Core.Canvas.TextMetrics`](../xui-core-canvas/index.md#api-bcb94869139203e5) structure containing both string-specific and font-wide metrics.

<a id="api-78dc6066109645e1"></a>

### [`void ITextMeasureContext.SetFont(Font font)`](#api-78dc6066109645e1)


```csharp
void SetFont(Font font);
```

Sets the font used for all subsequent text drawing and measurement operations.

- **`font`** — The font definition to apply.


<a id="api-215b76139b0e238d"></a>

## `interface ITransformContext`

Provides methods for manipulating the current transformation matrix of the drawing context. This includes translation, scaling, rotation, and applying affine transformations. Mirrors the transformation API of the HTML5 Canvas 2D context.

```csharp
public interface ITransformContext
{
    void Translate(Vector vector);
    void Rotate(nfloat angle);
    void Scale(Vector vector);
    void SetTransform(AffineTransform transform);
    void Transform(AffineTransform matrix);
}
```

<a id="api-7abcb741ec8a3c20"></a>

### [`void ITransformContext.Rotate(NFloat angle)`](#api-7abcb741ec8a3c20)


```csharp
void Rotate(nfloat angle);
```

Applies a clockwise rotation to the current transform.

- **`angle`** — The rotation angle in radians.

<a id="api-431b809e14af1265"></a>

### [`void ITransformContext.Scale(Vector vector)`](#api-431b809e14af1265)


```csharp
void Scale(Vector vector);
```

Applies a scaling transformation using the specified scaling factors.

- **`vector`** — The scaling vector (sx, sy).

<a id="api-e6d404e54b651b55"></a>

### [`void ITransformContext.SetTransform(AffineTransform transform)`](#api-e6d404e54b651b55)


```csharp
void SetTransform(AffineTransform transform);
```

Resets the current transformation matrix to the identity matrix, then replaces it with the specified transform. Equivalent to `ctx.setTransform(...)` in HTML5 Canvas.

- **`transform`** — The new transformation matrix to apply.

<a id="api-552e22dd85e6ad0c"></a>

### [`void ITransformContext.Transform(AffineTransform matrix)`](#api-552e22dd85e6ad0c)


```csharp
void Transform(AffineTransform matrix);
```

Multiplies the current transformation matrix by the specified matrix. This is equivalent to applying an additional transformation on top of the existing one.

- **`matrix`** — The matrix to multiply with the current transform.

<a id="api-e1f298ec4f9cd2a9"></a>

### [`void ITransformContext.Translate(Vector vector)`](#api-e1f298ec4f9cd2a9)


```csharp
void Translate(Vector vector);
```

Applies a translation by the specified vector. This offsets all subsequent drawing operations by the given amount.

- **`vector`** — The translation vector (dx, dy).


<a id="api-884be54e6e22aca1"></a>

## `ref struct ImagePattern`

Describes an image-based fill or stroke pattern — the Canvas API equivalent of a `CanvasPattern` returned by `createPattern(image, repetition)`. 

Pass to [`Xui.Core.Canvas.IPenContext.SetFill(Xui.Core.Canvas.ImagePattern)`](../xui-core-canvas/index.md#api-932c0cb783ae9606) or [`Xui.Core.Canvas.IPenContext.SetStroke(Xui.Core.Canvas.ImagePattern)`](../xui-core-canvas/index.md#api-5edde7ffb8ff8ec8) to paint paths with a tiled image.

```csharp
public ref struct ImagePattern
{
    public IImage Image;
    public PatternRepeat Repetition;
    public ImagePattern(IImage image, PatternRepeat repetition = PatternRepeat.Repeat);
}
```

<a id="api-12522e182d4d3d71"></a>

### [`ImagePattern.ImagePattern(IImage image, PatternRepeat repetition = PatternRepeat.Repeat)`](#api-12522e182d4d3d71)


```csharp
public ImagePattern(IImage image, PatternRepeat repetition = PatternRepeat.Repeat);
```

- **`image`** — The source image (must be loaded before drawing).

- **`repetition`** — Tiling mode; defaults to [`Xui.Core.Canvas.PatternRepeat.Repeat`](../xui-core-canvas/index.md#api-43ca3270b7822b4d).

<a id="api-c990d5655a1c3af8"></a>

### [`IImage ImagePattern.Image`](#api-c990d5655a1c3af8)


```csharp
public IImage Image;
```

The image to tile.

<a id="api-3408fb004e94b56a"></a>

### [`PatternRepeat ImagePattern.Repetition`](#api-3408fb004e94b56a)


```csharp
public PatternRepeat Repetition;
```

How the image repeats beyond its natural bounds.


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

## `enum LineCap`

Specifies the shape used at the ends of lines when stroking paths. Mirrors the `lineCap` property in the HTML5 Canvas API.

```csharp
public enum LineCap
{
    Butt = 0,
    Round = 1,
    Square = 2
}
```

<a id="api-03d108fa0c1ac0a5"></a>

### [`LineCap.Butt`](#api-03d108fa0c1ac0a5)


```csharp
Butt = 0
```

The line ends exactly at the endpoint with no additional extension. This is the default.

<a id="api-46ba7755477d2854"></a>

### [`LineCap.Round`](#api-46ba7755477d2854)


```csharp
Round = 1
```

The line ends with a semicircular extension, centered on the endpoint.

<a id="api-9659f706db9925ca"></a>

### [`LineCap.Square`](#api-9659f706db9925ca)


```csharp
Square = 2
```

The line ends with a square extension equal to half the line width, extending beyond the endpoint.


<a id="api-79536e207e75c624"></a>

## `enum LineJoin`

Specifies how two connected lines are joined when stroking a path. Mirrors the `lineJoin` property in the HTML5 Canvas API.

```csharp
public enum LineJoin
{
    Miter = 0,
    Round = 1,
    Bevel = 2
}
```

<a id="api-678c35864bf1bc47"></a>

### [`LineJoin.Bevel`](#api-678c35864bf1bc47)


```csharp
Bevel = 2
```

Lines are joined with a beveled corner by connecting the outer corners of the strokes.

<a id="api-a528ff2690a28c56"></a>

### [`LineJoin.Miter`](#api-a528ff2690a28c56)


```csharp
Miter = 0
```

Lines are joined with a sharp corner or extended miter, depending on the miter limit.

<a id="api-896b8d9104d504ca"></a>

### [`LineJoin.Round`](#api-896b8d9104d504ca)


```csharp
Round = 1
```

Lines are joined with a circular arc, creating a rounded corner.


<a id="api-1b1a359f36daf333"></a>

## `readonly struct LineMetrics`

Represents text layout metrics that depend on the specific string being measured. Includes actual bounding box and visual advance width.

```csharp
public readonly struct LineMetrics
{
    public readonly nfloat Width;
    public readonly nfloat ActualBoundingBoxLeft;
    public readonly nfloat ActualBoundingBoxRight;
    public readonly nfloat ActualBoundingBoxAscent;
    public readonly nfloat ActualBoundingBoxDescent;
    public nfloat ActualHeight { get; }

    public LineMetrics(nfloat width, nfloat left, nfloat right, nfloat ascent, nfloat descent);
}
```

<a id="api-bc9682f517594ae6"></a>

### [`LineMetrics.LineMetrics(NFloat width, NFloat left, NFloat right, NFloat ascent, NFloat descent)`](#api-bc9682f517594ae6)


```csharp
public LineMetrics(nfloat width, nfloat left, nfloat right, nfloat ascent, nfloat descent);
```

Initializes a new [`Xui.Core.Canvas.LineMetrics`](../xui-core-canvas/index.md#api-1b1a359f36daf333) instance.

- **`width`** — Advance width of the rendered text.

- **`left`** — Furthest left pixel offset relative to the origin.

- **`right`** — Furthest right pixel offset relative to the origin.

- **`ascent`** — Maximum pixel height above the baseline.

- **`descent`** — Maximum pixel depth below the baseline.

<a id="api-64d52e12691379f0"></a>

### [`NFloat LineMetrics.ActualBoundingBoxAscent`](#api-64d52e12691379f0)


```csharp
public readonly nfloat ActualBoundingBoxAscent;
```

Distance from the baseline to the topmost pixel of any glyph.

<a id="api-54a52f0bd90e027e"></a>

### [`NFloat LineMetrics.ActualBoundingBoxDescent`](#api-54a52f0bd90e027e)


```csharp
public readonly nfloat ActualBoundingBoxDescent;
```

Distance from the baseline to the bottommost pixel of any glyph.

<a id="api-c225aad8dada9691"></a>

### [`NFloat LineMetrics.ActualBoundingBoxLeft`](#api-c225aad8dada9691)


```csharp
public readonly nfloat ActualBoundingBoxLeft;
```

Distance from the text origin to the furthest left pixel of any glyph. May be negative for italic or overhanging glyphs.

<a id="api-505a5059a91c4f27"></a>

### [`NFloat LineMetrics.ActualBoundingBoxRight`](#api-505a5059a91c4f27)


```csharp
public readonly nfloat ActualBoundingBoxRight;
```

Distance from the text origin to the furthest right pixel of any glyph.

<a id="api-4991e18333b4da93"></a>

### [`NFloat LineMetrics.ActualHeight`](#api-4991e18333b4da93)


```csharp
public nfloat ActualHeight { get; }
```

Full height of the visual bounding box (ascent + descent).

<a id="api-1fe4e6427513e2df"></a>

### [`NFloat LineMetrics.Width`](#api-1fe4e6427513e2df)


```csharp
public readonly nfloat Width;
```

Advance width of the string, including kerning and shaping. This is how far the cursor should advance after drawing the text.


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

## `ref struct LinearGradient`

Represents a linear gradient brush that transitions between colors along a straight line, following the same behavior as the HTML5 Canvas `createLinearGradient()`.

```csharp
public ref struct LinearGradient
{
    public Point StartPoint;
    public Point EndPoint;
    public ReadOnlySpan<GradientStop> GradientStops;
    public LinearGradient(Point start, Point end, ReadOnlySpan<GradientStop> gradient);
}
```

<a id="api-17b56fe78b650bd9"></a>

### [`LinearGradient.LinearGradient(Point start, Point end, ReadOnlySpan<GradientStop> gradient)`](#api-17b56fe78b650bd9)


```csharp
public LinearGradient(Point start, Point end, ReadOnlySpan<GradientStop> gradient);
```

Creates a new [`Xui.Core.Canvas.LinearGradient`](../xui-core-canvas/index.md#api-c530f58efbab1696) with the given start and end points and gradient stops.

- **`start`** — The start point of the gradient.

- **`end`** — The end point of the gradient.

- **`gradient`** — A span of gradient stops sorted by offset.

<a id="api-84272bf6451c658d"></a>

### [`Point LinearGradient.EndPoint`](#api-84272bf6451c658d)


```csharp
public Point EndPoint;
```

The ending point of the gradient, in user space coordinates.

<a id="api-f69736941d90a6d8"></a>

### [`ReadOnlySpan<GradientStop> LinearGradient.GradientStops`](#api-f69736941d90a6d8)


```csharp
public ReadOnlySpan<GradientStop> GradientStops;
```

The sequence of gradient stops that define color transitions along the line. Offsets are typically in the range [0, 1].

<a id="api-2159a932d9e38db0"></a>

### [`Point LinearGradient.StartPoint`](#api-2159a932d9e38db0)


```csharp
public Point StartPoint;
```

The starting point of the gradient, in user space coordinates.


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

## `enum PaintStyle`

Specifies the type of brush or fill style used for painting shapes or strokes. Helps distinguish between solid colors and gradient fills.

```csharp
public enum PaintStyle
{
    SolidColor = 0,
    LinearGradient = 1,
    RadialGradient = 2,
    BitmapBrush = 3
}
```

<a id="api-29ae9062b76c3c2d"></a>

### [`PaintStyle.BitmapBrush`](#api-29ae9062b76c3c2d)


```csharp
BitmapBrush = 3
```

A repeating bitmap pattern (equivalent to `createPattern(image, "repeat")`).

<a id="api-df0003fdadd0975f"></a>

### [`PaintStyle.LinearGradient`](#api-df0003fdadd0975f)


```csharp
LinearGradient = 1
```

A linear gradient that transitions colors along a straight line.

<a id="api-5f561f36dac598b6"></a>

### [`PaintStyle.RadialGradient`](#api-5f561f36dac598b6)


```csharp
RadialGradient = 2
```

A radial gradient that transitions colors outward in a circular or elliptical shape.

<a id="api-1432089a8fd20d0d"></a>

### [`PaintStyle.SolidColor`](#api-1432089a8fd20d0d)


```csharp
SolidColor = 0
```

A single, uniform color.


<a id="api-8d75729507390f6c"></a>

## `class Path2D`

A serialized path that stores drawing commands in a compact byte buffer and replays them into any [`Xui.Core.Canvas.IPathBuilder`](../xui-core-canvas/index.md#api-d13fe2d4e3437459). Use [`Xui.Core.Canvas.Path2D.Visit``1(``0)`](../xui-core-canvas/index.md#api-fe92a70596ac6125) to replay recorded commands.

```csharp
public class Path2D : IPathBuilder
{
    public Path2D(int initialCapacity = 256);
    public void BeginPath();
    public void MoveTo(Point to);
    public void LineTo(Point to);
    public void ClosePath();
    public void CurveTo(Point cp1, Point to);
    public void CurveTo(Point cp1, Point cp2, Point to);
    public void Arc(Point center, nfloat radius, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
    public void ArcTo(Point cp1, Point cp2, nfloat radius);
    public void Ellipse(Point center, nfloat radiusX, nfloat radiusY, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
    public void Rect(Rect rect);
    public void RoundRect(Rect rect, nfloat radius);
    public void RoundRect(Rect rect, CornerRadius radius);
    public void Visit<T>(T sink)
        where T : IPathBuilder;
}
```

<a id="api-f294e6cb634947d7"></a>

### [`Path2D.Path2D(int initialCapacity = 256)`](#api-f294e6cb634947d7)


```csharp
public Path2D(int initialCapacity = 256);
```

Initializes a new [`Xui.Core.Canvas.Path2D`](../xui-core-canvas/index.md#api-8d75729507390f6c) with the specified initial byte-buffer capacity.

- **`initialCapacity`** — Initial buffer size in bytes. Grows automatically as needed.

<a id="api-7121be59976c8f22"></a>

### [`void Path2D.Arc(Point center, NFloat radius, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)`](#api-7121be59976c8f22)


```csharp
public void Arc(Point center, nfloat radius, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
```

Adds an arc to the path centered at the specified point.

- **`center`** — Center of the arc.

- **`radius`** — Radius of the arc.

- **`startAngle`** — Start angle in radians.

- **`endAngle`** — End angle in radians.

- **`winding`** — Direction in which the arc is drawn.

<a id="api-5dfbe4f5f7655d26"></a>

### [`void Path2D.ArcTo(Point cp1, Point cp2, NFloat radius)`](#api-5dfbe4f5f7655d26)


```csharp
public void ArcTo(Point cp1, Point cp2, nfloat radius);
```

Adds an arc to the path, connecting two tangents defined by control points.

- **`cp1`** — First control point.

- **`cp2`** — Second control point.

- **`radius`** — Arc radius.

<a id="api-9c058758fac37019"></a>

### [`void Path2D.BeginPath()`](#api-9c058758fac37019)


```csharp
public void BeginPath();
```

Clears all recorded path commands, resetting the path to empty.

<a id="api-4cae09b23a5b3dcd"></a>

### [`void Path2D.ClosePath()`](#api-4cae09b23a5b3dcd)


```csharp
public void ClosePath();
```

Closes the current path contour.

<a id="api-387c9653f3b540b8"></a>

### [`void Path2D.CurveTo(Point cp1, Point to)`](#api-387c9653f3b540b8)


```csharp
public void CurveTo(Point cp1, Point to);
```

Draws a quadratic B&#233;zier curve using a control point and end point.

<a id="api-3be66c91a9d675b7"></a>

### [`void Path2D.CurveTo(Point cp1, Point cp2, Point to)`](#api-3be66c91a9d675b7)


```csharp
public void CurveTo(Point cp1, Point cp2, Point to);
```

Draws a cubic B&#233;zier curve from the current point to the specified point, using two control points.

- **`cp1`** — First control point.

- **`cp2`** — Second control point.

- **`to`** — End point.

<a id="api-9a9b2059c3468737"></a>

### [`void Path2D.Ellipse(Point center, NFloat radiusX, NFloat radiusY, NFloat rotation, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)`](#api-9a9b2059c3468737)


```csharp
public void Ellipse(Point center, nfloat radiusX, nfloat radiusY, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
```

Adds an elliptical arc to the path.

- **`center`** — Center of the ellipse.

- **`radiusX`** — Horizontal radius.

- **`radiusY`** — Vertical radius.

- **`rotation`** — Rotation of the ellipse, in radians.

- **`startAngle`** — Start angle in radians.

- **`endAngle`** — End angle in radians.

- **`winding`** — Direction in which the arc is drawn.

<a id="api-c7d47b520682bd28"></a>

### [`void Path2D.LineTo(Point to)`](#api-c7d47b520682bd28)


```csharp
public void LineTo(Point to);
```

Draws a straight line to the specified point.

<a id="api-f49d40630de5e77b"></a>

### [`void Path2D.MoveTo(Point to)`](#api-f49d40630de5e77b)


```csharp
public void MoveTo(Point to);
```

Begins a new sub-path at the specified point.

<a id="api-6c6835464b627562"></a>

### [`void Path2D.Rect(Rect rect)`](#api-6c6835464b627562)


```csharp
public void Rect(Rect rect);
```

Adds a rectangle path to the current path.

- **`rect`** — The rectangle to add.

<a id="api-564deec464d46bd3"></a>

### [`void Path2D.RoundRect(Rect rect, NFloat radius)`](#api-564deec464d46bd3)


```csharp
public void RoundRect(Rect rect, nfloat radius);
```

Adds a rounded rectangle path with a uniform radius.

- **`rect`** — The rectangle to round.

- **`radius`** — Corner radius.

<a id="api-51a60133e4c616b6"></a>

### [`void Path2D.RoundRect(Rect rect, CornerRadius radius)`](#api-51a60133e4c616b6)


```csharp
public void RoundRect(Rect rect, CornerRadius radius);
```

Adds a rounded rectangle path with per-corner radii.

- **`rect`** — The rectangle to round.

- **`radius`** — Corner radius object defining each corner.

<a id="api-fe92a70596ac6125"></a>

### [`void Path2D.Visit<T>(T sink)`](#api-fe92a70596ac6125)


```csharp
public void Visit<T>(T sink)
    where T : IPathBuilder;
```

Replays all recorded path commands into the given [`Xui.Core.Canvas.IPathBuilder`](../xui-core-canvas/index.md#api-d13fe2d4e3437459).

- **`sink`** — The path builder to receive the commands.


<a id="api-830343375a982f72"></a>

## `enum PatternRepeat`

Controls how an image pattern tiles, following the same values as the `repetition` argument to the browser&#39;s `createPattern(image, repetition)`.

```csharp
public enum PatternRepeat
{
    Repeat,
    RepeatX,
    RepeatY,
    NoRepeat,
}
```

<a id="api-ed443c53283ffcab"></a>

### [`PatternRepeat.NoRepeat`](#api-ed443c53283ffcab)


```csharp
NoRepeat
```

Drawn once — no tiling in either direction.

<a id="api-43ca3270b7822b4d"></a>

### [`PatternRepeat.Repeat`](#api-43ca3270b7822b4d)


```csharp
Repeat
```

Tiles in both directions.

<a id="api-583c4f5ed0750b55"></a>

### [`PatternRepeat.RepeatX`](#api-583c4f5ed0750b55)


```csharp
RepeatX
```

Tiles horizontally only; clamped vertically.

<a id="api-2f4b6a45cedf38a0"></a>

### [`PatternRepeat.RepeatY`](#api-2f4b6a45cedf38a0)


```csharp
RepeatY
```

Tiles vertically only; clamped horizontally.


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

## `ref struct RadialGradient`

Represents a radial gradient brush that transitions colors outward from one circle to another, similar to `createRadialGradient()` in the HTML5 Canvas API.

```csharp
public ref struct RadialGradient
{
    public Point StartCenter;
    public nfloat StartRadius;
    public Point EndCenter;
    public nfloat EndRadius;
    public ReadOnlySpan<GradientStop> GradientStops;
    public RadialGradient(Point startCenter, nfloat startRadius, Point endCenter, nfloat endRadius, ReadOnlySpan<GradientStop> gradientStops);
    public RadialGradient(Point center, nfloat radius, ReadOnlySpan<GradientStop> gradientStops);
}
```

<a id="api-b544e1724040afdb"></a>

### [`RadialGradient.RadialGradient(Point center, NFloat radius, ReadOnlySpan<GradientStop> gradientStops)`](#api-b544e1724040afdb)


```csharp
public RadialGradient(Point center, nfloat radius, ReadOnlySpan<GradientStop> gradientStops);
```

Initializes a radial gradient from a single point and radius, fading outward from a solid center. This is equivalent to setting the start radius to zero and both centers to the same point.

- **`center`** — Center point of the gradient.

- **`radius`** — Radius of the gradient spread.

- **`gradientStops`** — Span of color stops defining the gradient transition.

<a id="api-e46c8d5c269ecb72"></a>

### [`RadialGradient.RadialGradient(Point startCenter, NFloat startRadius, Point endCenter, NFloat endRadius, ReadOnlySpan<GradientStop> gradientStops)`](#api-e46c8d5c269ecb72)


```csharp
public RadialGradient(Point startCenter, nfloat startRadius, Point endCenter, nfloat endRadius, ReadOnlySpan<GradientStop> gradientStops);
```

Initializes a radial gradient that transitions between two circles.

- **`startCenter`** — Center of the inner circle.

- **`startRadius`** — Radius of the inner circle.

- **`endCenter`** — Center of the outer circle.

- **`endRadius`** — Radius of the outer circle.

- **`gradientStops`** — Span of color stops defining the gradient transition.

<a id="api-d0c2b2c968f11a32"></a>

### [`Point RadialGradient.EndCenter`](#api-d0c2b2c968f11a32)


```csharp
public Point EndCenter;
```

The center point of the ending circle (outer circle).

<a id="api-4d3a105c709150b0"></a>

### [`NFloat RadialGradient.EndRadius`](#api-4d3a105c709150b0)


```csharp
public nfloat EndRadius;
```

The radius of the ending circle (outer circle), defining the spread of the gradient.

<a id="api-dc77e3b4d1bd863e"></a>

### [`ReadOnlySpan<GradientStop> RadialGradient.GradientStops`](#api-dc77e3b4d1bd863e)


```csharp
public ReadOnlySpan<GradientStop> GradientStops;
```

A sequence of color stops defining how colors are interpolated from the inner to the outer circle. Offsets are typically in the range [0, 1].

<a id="api-6476c317d52854bb"></a>

### [`Point RadialGradient.StartCenter`](#api-6476c317d52854bb)


```csharp
public Point StartCenter;
```

The center point of the starting circle (inner circle).

<a id="api-0a40e8f46a85129b"></a>

### [`NFloat RadialGradient.StartRadius`](#api-0a40e8f46a85129b)


```csharp
public nfloat StartRadius;
```

The radius of the starting circle (inner circle), usually 0 for solid centers.


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

## `class RoundedRect`

Utility for clamping corner radii to fit within a rectangle, following the CSS Backgrounds and Borders Module Level 3, Section 5.5 &quot;Overlapping Curves&quot;. When the sum of adjacent radii exceeds a side&#39;s length, all radii are scaled down proportionally so that curves never overlap.

```csharp
public static class RoundedRect
{
    public static CornerRadius Clamp(Size size, CornerRadius radius);
    public static nfloat Clamp(Size size, nfloat radius);
}
```

<a id="api-3338b108456db30b"></a>

### [`NFloat RoundedRect.Clamp(Size size, NFloat radius)`](#api-3338b108456db30b)


```csharp
public static nfloat Clamp(Size size, nfloat radius);
```

Returns a uniform radius clamped to fit within the given `size`. Equivalent to `min(radius, width / 2, height / 2)`.

- **`size`** — The dimensions of the rectangle.

- **`radius`** — The desired uniform corner radius.

**Returns:** The clamped radius value.

<a id="api-aa963c0c9d960f04"></a>

### [`CornerRadius RoundedRect.Clamp(Size size, CornerRadius radius)`](#api-aa963c0c9d960f04)


```csharp
public static CornerRadius Clamp(Size size, CornerRadius radius);
```

Returns a [`Xui.Core.Canvas.CornerRadius`](../xui-core-canvas/index.md#api-3ef8eee91c42743c) whose values are clamped so that adjacent corners do not overlap on any side of a rectangle of the given `size`. 

Algorithm: compute `f = min(1, L_i / S_i)` over all four sides, where `L_i` is the side length and `S_i` is the sum of the two corner radii on that side. Then multiply every radius by `f`.

- **`size`** — The dimensions of the rectangle.

- **`radius`** — The desired corner radii.

**Returns:** Corner radii scaled to fit within the rectangle.


<a id="api-94646577818f5d60"></a>

## `enum TextAlign`

Specifies the horizontal alignment of text relative to the drawing position. Mirrors the `textAlign` property in the HTML5 Canvas 2D API.

```csharp
public enum TextAlign
{
    Start,
    End,
    Left,
    Right,
    Center
}
```

<a id="api-35c92c82af789305"></a>

### [`TextAlign.Center`](#api-35c92c82af789305)


```csharp
Center
```

Centers the text horizontally around the drawing position.

<a id="api-8611b25c6d5355d0"></a>

### [`TextAlign.End`](#api-8611b25c6d5355d0)


```csharp
End
```

Aligns text to the end of the writing direction (right for LTR, left for RTL).

<a id="api-f28a4ebe63d37b28"></a>

### [`TextAlign.Left`](#api-f28a4ebe63d37b28)


```csharp
Left
```

Aligns text to the left, regardless of writing direction.

<a id="api-c53bf4b68ecf966a"></a>

### [`TextAlign.Right`](#api-c53bf4b68ecf966a)


```csharp
Right
```

Aligns text to the right, regardless of writing direction.

<a id="api-e49f4d0fef6a159b"></a>

### [`TextAlign.Start`](#api-e49f4d0fef6a159b)


```csharp
Start
```

Aligns text to the start of the writing direction (left for LTR, right for RTL).


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

## `enum TextBaseline`

Specifies the vertical alignment of text relative to the drawing position. Mirrors the `textBaseline` property in the HTML5 Canvas 2D API.

```csharp
public enum TextBaseline
{
    Top,
    Hanging,
    Middle,
    Alphabetic,
    Ideographic,
    Bottom
}
```

<a id="api-8053ad1a52cc6f00"></a>

### [`TextBaseline.Alphabetic`](#api-8053ad1a52cc6f00)


```csharp
Alphabetic
```

The alphabetic baseline (default for Latin scripts) is aligned with the drawing position.

<a id="api-1ff2c97590597957"></a>

### [`TextBaseline.Bottom`](#api-1ff2c97590597957)


```csharp
Bottom
```

The bottom of the em box is aligned with the drawing position.

<a id="api-5c4807aa65369d18"></a>

### [`TextBaseline.Hanging`](#api-5c4807aa65369d18)


```csharp
Hanging
```

The hanging baseline is aligned with the drawing position (used in some scripts like Devanagari).

<a id="api-58c5438242e4f05a"></a>

### [`TextBaseline.Ideographic`](#api-58c5438242e4f05a)


```csharp
Ideographic
```

The ideographic baseline is aligned with the drawing position (used in scripts like Chinese or Japanese).

<a id="api-4881312827e76c92"></a>

### [`TextBaseline.Middle`](#api-4881312827e76c92)


```csharp
Middle
```

The middle of the text (roughly half the em height) is aligned with the drawing position.

<a id="api-9868cb56b100ba82"></a>

### [`TextBaseline.Top`](#api-9868cb56b100ba82)


```csharp
Top
```

The top of the em box is aligned with the drawing position.


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

## `readonly struct TextMetrics`

Composite structure combining string-specific and font-specific text metrics. Used for precise layout, alignment, and rendering across all platforms.

```csharp
public readonly struct TextMetrics
{
    public readonly LineMetrics Line;
    public readonly FontMetrics Font;
    public TextMetrics(LineMetrics line, FontMetrics font);
    public Rect BoundingBox { get; }
    public Size Size { get; }

    public static implicit operator Size(TextMetrics metrics);
}
```

<a id="api-f2d9b3cbe86b9d7e"></a>

### [`TextMetrics.TextMetrics(LineMetrics line, FontMetrics font)`](#api-f2d9b3cbe86b9d7e)


```csharp
public TextMetrics(LineMetrics line, FontMetrics font);
```

Creates a new composite text metrics structure.

<a id="api-02cc25b9ea1c0430"></a>

### [`Rect TextMetrics.BoundingBox`](#api-02cc25b9ea1c0430)


```csharp
public Rect BoundingBox { get; }
```

Returns the visual bounding box of the text string, relative to the origin. X may be negative for glyphs that extend left of the starting point.

<a id="api-3f46bea171e5580d"></a>

### [`FontMetrics TextMetrics.Font`](#api-3f46bea171e5580d)


```csharp
public readonly FontMetrics Font;
```

Metrics derived from the current font and size, independent of input string.

<a id="api-9b110f6f1b9136b4"></a>

### [`LineMetrics TextMetrics.Line`](#api-9b110f6f1b9136b4)


```csharp
public readonly LineMetrics Line;
```

Metrics specific to the given text string (shaping, kerning, bounding box).

<a id="api-1533439b823f93b2"></a>

### [`Size TextMetrics.Size`](#api-1533439b823f93b2)


```csharp
public Size Size { get; }
```

The measured size of the text.

<a id="api-f5e5f53d2ab27f87"></a>

### [`TextMetrics.implicit operator Size(TextMetrics metrics)`](#api-f5e5f53d2ab27f87)


```csharp
public static implicit operator Size(TextMetrics metrics);
```

Implicitly converts the text metrics to a [`Xui.Core.Canvas.TextMetrics.Size`](../xui-core-canvas/index.md#api-1533439b823f93b2), using the advance width and total height of the string. The width corresponds to how far the cursor should advance, not the visual width.


<a id="api-261ac7459f97a1b3"></a>

## `class TextMetricsCache`

Bounded LRU of string measurements. Text keys use object identity, so stable labels never need character hashing or comparison. All storage is allocated once; misses and eviction do not allocate cache entries. Each measurement context owns its cache; clear it if native font resolution changes.

```csharp
public sealed class TextMetricsCache
{
    public const int DefaultCapacity = 128;
    public TextMetricsCache(int capacity = DefaultCapacity);
    public bool TryGet(string text, in Font font, TextAlign align, TextBaseline baseline, out TextMetrics metrics);
    public void Set(string text, in Font font, TextAlign align, TextBaseline baseline, in TextMetrics metrics);
    public void Clear();
}
```

<a id="api-2cdf6a1f211fb8ba"></a>

### [`TextMetricsCache.TextMetricsCache(int capacity = 128)`](#api-2cdf6a1f211fb8ba)


```csharp
public TextMetricsCache(int capacity = DefaultCapacity);
```

Creates a context-owned cache with fixed storage.

<a id="api-0f656da44bd7bc3f"></a>

### [`void TextMetricsCache.Clear()`](#api-0f656da44bd7bc3f)


```csharp
public void Clear();
```

Clears measurements and releases all retained string and font references.

<a id="api-f2e53b00f7b3af1d"></a>

### [`int TextMetricsCache.DefaultCapacity`](#api-f2e53b00f7b3af1d)


```csharp
public const int DefaultCapacity = 128;
```

The standard maximum number of retained string measurements.

<a id="api-a5b19cba15605abe"></a>

### [`void TextMetricsCache.Set(string text, in Font font, TextAlign align, TextBaseline baseline, in TextMetrics metrics)`](#api-a5b19cba15605abe)


```csharp
public void Set(string text, in Font font, TextAlign align, TextBaseline baseline, in TextMetrics metrics);
```

Stores metrics, replacing the least recently used entry when full.

<a id="api-d7e92eed22b99309"></a>

### [`bool TextMetricsCache.TryGet(string text, in Font font, TextAlign align, TextBaseline baseline, out TextMetrics metrics)`](#api-d7e92eed22b99309)


```csharp
public bool TryGet(string text, in Font font, TextAlign align, TextBaseline baseline, out TextMetrics metrics);
```

Looks up the same string instance and measurement settings, updating its recency.


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

## `enum Winding`

Specifies the direction in which arcs or elliptical curves are drawn, affecting fill and stroke behavior in path-based rendering.

```csharp
public enum Winding : int
{
    ClockWise = 1,
    CounterClockWise = 0
}
```

<a id="api-81a9c32800768669"></a>

### [`Winding.ClockWise`](#api-81a9c32800768669)


```csharp
ClockWise = 1
```

The path is drawn in a clockwise direction. This is the default in most canvas and geometry operations.

<a id="api-385709efbc836c93"></a>

### [`Winding.CounterClockWise`](#api-385709efbc836c93)


```csharp
CounterClockWise = 0
```

The path is drawn in a counter-clockwise direction.

