# Xui.Core.Canvas.SVG

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

## Types

- [`enum ArcFlag`](#api-4fa0684ccf7b027a)
- [`class Extensions`](#api-d079307d7141f7cc)
- [`ref struct PathDataBuilder`](#api-d634a95fd3677344)

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

## `enum ArcFlag`

Specifies the size of the arc to be drawn when interpreting an SVG arc command. Used in conjunction with the sweep flag to determine the final arc segment. This corresponds to the &quot;large-arc-flag&quot; in the SVG path specification.

```csharp
public enum ArcFlag
{
    Small = 0,
    Large = 1
}
```

<a id="api-ddc6963ff7395275"></a>

### [`ArcFlag.Large`](#api-ddc6963ff7395275)


```csharp
Large = 1
```

Draw the larger of the two possible arc sweeps (greater than 180 degrees).

<a id="api-5e697bed2b676887"></a>

### [`ArcFlag.Small`](#api-5e697bed2b676887)


```csharp
Small = 0
```

Draw the smaller of the two possible arc sweeps (less than or equal to 180 degrees).


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

## `class Extensions`

Provides SVG-related extension methods for the [`Xui.Core.Canvas.IPathDrawingContext`](../xui-core-canvas/index.md#api-a2acd68a80a4a746) interface.

```csharp
public static class Extensions
{
    public static PathDataBuilder PathData(this IPathDrawingContext @this);
}
```

<a id="api-b796361773f1ba73"></a>

### [`PathDataBuilder Extensions.PathData(IPathDrawingContext @this)`](#api-b796361773f1ba73)


```csharp
public static PathDataBuilder PathData(this IPathDrawingContext @this);
```

Creates a [`Xui.Core.Canvas.SVG.PathDataBuilder`](../xui-core-canvas-svg/index.md#api-d634a95fd3677344) for the given path drawing context. This enables fluent parsing or construction of SVG path commands targeting the current canvas context.

- **`this`** — The path drawing context (e.g., a canvas or drawing surface).

**Returns:** A [`Xui.Core.Canvas.SVG.PathDataBuilder`](../xui-core-canvas-svg/index.md#api-d634a95fd3677344) instance for building or parsing SVG paths.


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

## `ref struct PathDataBuilder`

A utility for converting parsed SVG path commands into drawing operations on an [`Xui.Core.Canvas.IPathDrawingContext`](../xui-core-canvas/index.md#api-a2acd68a80a4a746) target. This builder supports both absolute (e.g., `M`, `L`, `C`) and relative (e.g., `m`, `l`, `c`) SVG commands, and tracks the current drawing point and control points for smooth curves.

```csharp
public ref struct PathDataBuilder
{
    public readonly IPathDrawingContext Sink;
    public Point? StartPoint;
    public Point CurrentPoint;
    public Point NextCubicControlPoint;
    public Point NextQuadraticControlPoint;
    public PathDataBuilder(IPathDrawingContext sink);
    public PathDataBuilder Begin();
    public PathDataBuilder M(Point point);
    public PathDataBuilder m(Vector vector);
    public PathDataBuilder L(Point point);
    public PathDataBuilder l(Vector vector);
    public PathDataBuilder H(nfloat h);
    public PathDataBuilder h(nfloat h);
    public PathDataBuilder V(nfloat v);
    public PathDataBuilder v(nfloat v);
    public PathDataBuilder C(Point cp1, Point cp2, Point to);
    public PathDataBuilder c(Vector cv1, Vector cv2, Vector to);
    public PathDataBuilder S(Point cp, Point to);
    public PathDataBuilder s(Vector cv, Vector to);
    public PathDataBuilder Q(Point cp, Point to);
    public PathDataBuilder q(Vector cv, Vector to);
    public PathDataBuilder T(Point to);
    public PathDataBuilder t(Vector to);
    public PathDataBuilder A(Vector sr, nfloat xAxisRotationDeg, ArcFlag largeArcFlag, Winding sweepDirection, Point p2);
    public PathDataBuilder a(Vector v2, nfloat xAxisRotationDeg, ArcFlag largeArcFlag, Winding sweepDirection, Vector sr);
    public PathDataBuilder Z();
    public PathDataBuilder z();
}
```

<a id="api-94f7af7e9329a667"></a>

### [`PathDataBuilder.PathDataBuilder(IPathDrawingContext sink)`](#api-94f7af7e9329a667)


```csharp
public PathDataBuilder(IPathDrawingContext sink);
```

Initializes a new [`Xui.Core.Canvas.SVG.PathDataBuilder`](../xui-core-canvas-svg/index.md#api-d634a95fd3677344) targeting the specified drawing context.

- **`sink`** — The drawing context that will receive the path instructions.

<a id="api-0188a38ffbe1540e"></a>

### [`PathDataBuilder PathDataBuilder.A(Vector sr, NFloat xAxisRotationDeg, ArcFlag largeArcFlag, Winding sweepDirection, Point p2)`](#api-0188a38ffbe1540e)


```csharp
public PathDataBuilder A(Vector sr, nfloat xAxisRotationDeg, ArcFlag largeArcFlag, Winding sweepDirection, Point p2);
```



<a id="api-2f2fd99d9127bb03"></a>

### [`PathDataBuilder PathDataBuilder.Begin()`](#api-2f2fd99d9127bb03)


```csharp
public PathDataBuilder Begin();
```

Begins a new path on the drawing context.

<a id="api-bb9a9b7b6d11902d"></a>

### [`PathDataBuilder PathDataBuilder.C(Point cp1, Point cp2, Point to)`](#api-bb9a9b7b6d11902d)


```csharp
public PathDataBuilder C(Point cp1, Point cp2, Point to);
```



<a id="api-ce19683c84ec46c2"></a>

### [`Point PathDataBuilder.CurrentPoint`](#api-ce19683c84ec46c2)


```csharp
public Point CurrentPoint;
```

The current position of the pen after the last command.

<a id="api-2f6171ea4c793d08"></a>

### [`PathDataBuilder PathDataBuilder.H(NFloat h)`](#api-2f6171ea4c793d08)


```csharp
public PathDataBuilder H(nfloat h);
```



<a id="api-3e328d48a19c8c36"></a>

### [`PathDataBuilder PathDataBuilder.L(Point point)`](#api-3e328d48a19c8c36)


```csharp
public PathDataBuilder L(Point point);
```



<a id="api-a37b0ece8731f9f7"></a>

### [`PathDataBuilder PathDataBuilder.M(Point point)`](#api-a37b0ece8731f9f7)


```csharp
public PathDataBuilder M(Point point);
```



<a id="api-8a780e9cb5a9b171"></a>

### [`Point PathDataBuilder.NextCubicControlPoint`](#api-8a780e9cb5a9b171)


```csharp
public Point NextCubicControlPoint;
```

The reflected control point for the next cubic B&#233;zier curve (used in `S`, `s`).

<a id="api-49e43731a279d69e"></a>

### [`Point PathDataBuilder.NextQuadraticControlPoint`](#api-49e43731a279d69e)


```csharp
public Point NextQuadraticControlPoint;
```

The reflected control point for the next quadratic B&#233;zier curve (used in `T`, `t`).

<a id="api-deb79e43807859c1"></a>

### [`PathDataBuilder PathDataBuilder.Q(Point cp, Point to)`](#api-deb79e43807859c1)


```csharp
public PathDataBuilder Q(Point cp, Point to);
```



<a id="api-e5a2b19332513ed6"></a>

### [`PathDataBuilder PathDataBuilder.S(Point cp, Point to)`](#api-e5a2b19332513ed6)


```csharp
public PathDataBuilder S(Point cp, Point to);
```



<a id="api-f9363674fdf6cede"></a>

### [`IPathDrawingContext PathDataBuilder.Sink`](#api-f9363674fdf6cede)


```csharp
public readonly IPathDrawingContext Sink;
```

The target drawing context that receives path commands.

<a id="api-18916a3b6c1bbcb0"></a>

### [`Point? PathDataBuilder.StartPoint`](#api-18916a3b6c1bbcb0)


```csharp
public Point? StartPoint;
```

The starting point of the current subpath (used for `Z` command).

<a id="api-bb9b05dde23d4230"></a>

### [`PathDataBuilder PathDataBuilder.T(Point to)`](#api-bb9b05dde23d4230)


```csharp
public PathDataBuilder T(Point to);
```



<a id="api-0cc275633f63b0e3"></a>

### [`PathDataBuilder PathDataBuilder.V(NFloat v)`](#api-0cc275633f63b0e3)


```csharp
public PathDataBuilder V(nfloat v);
```



<a id="api-5de3dc01cd63b871"></a>

### [`PathDataBuilder PathDataBuilder.Z()`](#api-5de3dc01cd63b871)


```csharp
public PathDataBuilder Z();
```



<a id="api-4550528d6c92a2c5"></a>

### [`PathDataBuilder PathDataBuilder.a(Vector v2, NFloat xAxisRotationDeg, ArcFlag largeArcFlag, Winding sweepDirection, Vector sr)`](#api-4550528d6c92a2c5)


```csharp
public PathDataBuilder a(Vector v2, nfloat xAxisRotationDeg, ArcFlag largeArcFlag, Winding sweepDirection, Vector sr);
```



<a id="api-77ae688004e7f9c0"></a>

### [`PathDataBuilder PathDataBuilder.c(Vector cv1, Vector cv2, Vector to)`](#api-77ae688004e7f9c0)


```csharp
public PathDataBuilder c(Vector cv1, Vector cv2, Vector to);
```



<a id="api-760a56081e4807a7"></a>

### [`PathDataBuilder PathDataBuilder.h(NFloat h)`](#api-760a56081e4807a7)


```csharp
public PathDataBuilder h(nfloat h);
```



<a id="api-954ac1062b299101"></a>

### [`PathDataBuilder PathDataBuilder.l(Vector vector)`](#api-954ac1062b299101)


```csharp
public PathDataBuilder l(Vector vector);
```



<a id="api-94fe3fb11e8e45c2"></a>

### [`PathDataBuilder PathDataBuilder.m(Vector vector)`](#api-94fe3fb11e8e45c2)


```csharp
public PathDataBuilder m(Vector vector);
```



<a id="api-5d32adb7918ec204"></a>

### [`PathDataBuilder PathDataBuilder.q(Vector cv, Vector to)`](#api-5d32adb7918ec204)


```csharp
public PathDataBuilder q(Vector cv, Vector to);
```



<a id="api-045db20205943712"></a>

### [`PathDataBuilder PathDataBuilder.s(Vector cv, Vector to)`](#api-045db20205943712)


```csharp
public PathDataBuilder s(Vector cv, Vector to);
```



<a id="api-aea9357aac664571"></a>

### [`PathDataBuilder PathDataBuilder.t(Vector to)`](#api-aea9357aac664571)


```csharp
public PathDataBuilder t(Vector to);
```



<a id="api-a532f5aa32b0a502"></a>

### [`PathDataBuilder PathDataBuilder.v(NFloat v)`](#api-a532f5aa32b0a502)


```csharp
public PathDataBuilder v(nfloat v);
```



<a id="api-6195623855a0651d"></a>

### [`PathDataBuilder PathDataBuilder.z()`](#api-6195623855a0651d)


```csharp
public PathDataBuilder z();
```



