# Xui.Runtime.Software.Actual

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

## Types

- [`class SoftwareImage`](#api-0b9250e47df1d6d9)
- [`class SoftwareImagePipeline`](#api-3a391952073cfb20)
- [`class SoftwareTextMeasureContext`](#api-c1fd76e6a9605eb9)
- [`class SvgDrawingContext`](#api-04318d6d050f8464)
- [`class SvgDrawingContext.NumericFormat`](#api-b2aaf5e016df708b)
- [`record struct SvgDrawingContext.Resolved`](#api-079559febc4a6431)
- [`enum SvgDrawingContext.SvgFontMode`](#api-b00e5763e15e9c76)
- [`class SvgDrawingContext.SvgFontResolver`](#api-d61ec931d4a07ee7)

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

## `class SoftwareImage`

An image handle retaining the original PNG bytes for SVG embedding.

```csharp
public sealed class SoftwareImage : IImage
{
    public Size Size { get; }

    public void Load(string uri);
    public async Task LoadAsync(string uri);
    public void LoadPixels(int width, int height, ReadOnlySpan<byte> bgra32Data);
}
```

<a id="api-7a103cc4fe839dda"></a>

### [`void SoftwareImage.Load(string uri)`](#api-7a103cc4fe839dda)


```csharp
public void Load(string uri);
```



<a id="api-8e91fd02608bc8be"></a>

### [`Task SoftwareImage.LoadAsync(string uri)`](#api-8e91fd02608bc8be)


```csharp
public async Task LoadAsync(string uri);
```



<a id="api-df583aa1edf54d40"></a>

### [`void SoftwareImage.LoadPixels(int width, int height, ReadOnlySpan<byte> bgra32Data)`](#api-df583aa1edf54d40)


```csharp
public void LoadPixels(int width, int height, ReadOnlySpan<byte> bgra32Data);
```



<a id="api-cb26760178ccfc53"></a>

### [`Size SoftwareImage.Size`](#api-cb26760178ccfc53)


```csharp
public Size Size { get; }
```




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

## `class SoftwareImagePipeline`

Cached packaged PNG resources for deterministic, self-contained SVG rendering.

```csharp
public sealed class SoftwareImagePipeline : IImagePipeline
{
    public SoftwareImagePipeline(string? baseDirectory = null);
    public IImage CreateImage();
}
```

<a id="api-6b4344d7344956e0"></a>

### [`SoftwareImagePipeline.SoftwareImagePipeline(string? baseDirectory = null)`](#api-6b4344d7344956e0)


```csharp
public SoftwareImagePipeline(string? baseDirectory = null);
```



<a id="api-be907cb100e3f7aa"></a>

### [`IImage SoftwareImagePipeline.CreateImage()`](#api-be907cb100e3f7aa)


```csharp
public IImage CreateImage();
```




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

## `class SoftwareTextMeasureContext`

A lightweight `Xui.Core.Canvas.ITextMeasureContext` backed by the software font [`Xui.Runtime.Software.Font.Catalog`](../xui-runtime-software-font/index.md#api-bc5d7341b8b0b25d). Used to provide text hit-testing for pointer events without needing a full drawing context.

```csharp
public sealed class SoftwareTextMeasureContext : ITextMeasureContext
{
    public SoftwareTextMeasureContext(Catalog catalog);
    public TextMetrics MeasureText(string text);
    public void SetFont(Xui.Core.Canvas.Font font);
}
```

<a id="api-ee373dc251022520"></a>

### [`SoftwareTextMeasureContext.SoftwareTextMeasureContext(Catalog catalog)`](#api-ee373dc251022520)


```csharp
public SoftwareTextMeasureContext(Catalog catalog);
```



<a id="api-245c77b0a2f761f2"></a>

### [`TextMetrics SoftwareTextMeasureContext.MeasureText(string text)`](#api-245c77b0a2f761f2)


```csharp
public TextMetrics MeasureText(string text);
```



<a id="api-33e24254c1f73243"></a>

### [`void SoftwareTextMeasureContext.SetFont(Font font)`](#api-33e24254c1f73243)


```csharp
public void SetFont(Xui.Core.Canvas.Font font);
```




<a id="api-04318d6d050f8464"></a>

## `class SvgDrawingContext`



```csharp
public sealed partial class SvgDrawingContext
{
    public CompositionGroup Group(scoped in GroupOptions options);
    public void EndGroup();
}
public sealed partial class SvgDrawingContext
{
}
public sealed partial class SvgDrawingContext
{
    public void DrawSymbol(SymbolContent content);
}
public sealed partial class SvgDrawingContext : IContext, IDisposable
{
    public void SetFilter();
    public void SetFilter(Brightness brightness);
    public nfloat GlobalAlpha { get; set; }
    public LineCap LineCap { get; set; }
    public LineJoin LineJoin { get; set; }
    public nfloat LineWidth { get; set; }
    public nfloat MiterLimit { get; set; }
    public nfloat LineDashOffset { get; set; }
    public TextAlign TextAlign { get; set; }
    public TextBaseline TextBaseline { get; set; }
    public IReadOnlyDictionary<FontFace, FontUsage> FontUsage { get; }

    public SvgDrawingContext(Size canvasSize, Stream output, IEnumerable<Uri> fontUris, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false);
    public SvgDrawingContext(Size canvasSize, Stream output, IFontSource fontSource, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false);
    public SvgDrawingContext(Size canvasSize, Stream output, bool keepOpen = false);
    public SvgDrawingContext(Size canvasSize, Stream output, Catalog? catalog, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false);
    public void Dispose();
    public abstract class NumericFormat
    {
        public abstract string Format(nfloat number);
        public static NumericFormat Default { get; }
    }

    public class SvgFontResolver
    {
        public static readonly SvgFontResolver Default;
        public static readonly SvgFontResolver Embedded;
        public virtual Resolved Resolve(FontFace face, Uri? uri);
    }

    public record struct Resolved(SvgFontMode Mode, Uri? WebUri);
    public enum SvgFontMode
    {
        System,
        WebLink,
        Embedded
    }
}
```

<a id="api-458aab6de0a6bc55"></a>

### [`SvgDrawingContext.SvgDrawingContext(Size canvasSize, Stream output, bool keepOpen = false)`](#api-458aab6de0a6bc55)


```csharp
public SvgDrawingContext(Size canvasSize, Stream output, bool keepOpen = false);
```



<a id="api-5de53d8491c40553"></a>

### [`SvgDrawingContext.SvgDrawingContext(Size canvasSize, Stream output, IEnumerable<Uri> fontUris, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false)`](#api-5de53d8491c40553)


```csharp
public SvgDrawingContext(Size canvasSize, Stream output, IEnumerable<Uri> fontUris, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false);
```



<a id="api-a97b128e33f360dc"></a>

### [`SvgDrawingContext.SvgDrawingContext(Size canvasSize, Stream output, IFontSource fontSource, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false)`](#api-a97b128e33f360dc)


```csharp
public SvgDrawingContext(Size canvasSize, Stream output, IFontSource fontSource, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false);
```

Creates an SVG context with lazily loaded application font resources.

<a id="api-f52bf55443f1ab91"></a>

### [`SvgDrawingContext.SvgDrawingContext(Size canvasSize, Stream output, Catalog? catalog, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false)`](#api-f52bf55443f1ab91)


```csharp
public SvgDrawingContext(Size canvasSize, Stream output, Catalog? catalog, SvgFontResolver? resolver = null, NumericFormat? numericFormat = null, bool keepOpen = false);
```



<a id="api-578bbeeb098f49b1"></a>

### [`void SvgDrawingContext.Dispose()`](#api-578bbeeb098f49b1)


```csharp
public void Dispose();
```



<a id="api-868bbc140b710d40"></a>

### [`void SvgDrawingContext.DrawSymbol(SymbolContent content)`](#api-868bbc140b710d40)


```csharp
public void DrawSymbol(SymbolContent content);
```

Writes one vector definition and a use element for each placement.

<a id="api-44e8933142dbac45"></a>

### [`void SvgDrawingContext.EndGroup()`](#api-44e8933142dbac45)


```csharp
public void EndGroup();
```

Closes the innermost group. Called by `Xui.Core.Canvas.Composition.Graphics.CompositionGroup.Dispose`; prefer disposing the returned scope over calling this directly.

<a id="api-93b3c3ea56631f3b"></a>

### [`IReadOnlyDictionary<FontFace, FontUsage> SvgDrawingContext.FontUsage`](#api-93b3c3ea56631f3b)


```csharp
public IReadOnlyDictionary<FontFace, FontUsage> FontUsage { get; }
```

Characters and adjacent pairs rendered for each resolved font face.

<a id="api-9e2b8db53e5d8db6"></a>

### [`NFloat SvgDrawingContext.GlobalAlpha`](#api-9e2b8db53e5d8db6)


```csharp
public nfloat GlobalAlpha { get; set; }
```



<a id="api-569fb42b345e3f21"></a>

### [`CompositionGroup SvgDrawingContext.Group(scoped in GroupOptions options)`](#api-569fb42b345e3f21)


```csharp
public CompositionGroup Group(scoped in GroupOptions options);
```

Emits an explicit SVG group, even with no transform or drawing. A new export always needs content, independently of HasUpdates and any other context&#39;s native cache.

<a id="api-a37efc24706f1c72"></a>

### [`LineCap SvgDrawingContext.LineCap`](#api-a37efc24706f1c72)


```csharp
public LineCap LineCap { get; set; }
```



<a id="api-7c7cbf49fd59db8b"></a>

### [`NFloat SvgDrawingContext.LineDashOffset`](#api-7c7cbf49fd59db8b)


```csharp
public nfloat LineDashOffset { get; set; }
```



<a id="api-d6245aa94e368d58"></a>

### [`LineJoin SvgDrawingContext.LineJoin`](#api-d6245aa94e368d58)


```csharp
public LineJoin LineJoin { get; set; }
```



<a id="api-dc4dc5f4134a6177"></a>

### [`NFloat SvgDrawingContext.LineWidth`](#api-dc4dc5f4134a6177)


```csharp
public nfloat LineWidth { get; set; }
```



<a id="api-73bcc79a0a9b3e5e"></a>

### [`NFloat SvgDrawingContext.MiterLimit`](#api-73bcc79a0a9b3e5e)


```csharp
public nfloat MiterLimit { get; set; }
```



<a id="api-8da335147e7bb2a8"></a>

### [`void SvgDrawingContext.SetFilter()`](#api-8da335147e7bb2a8)


```csharp
public void SetFilter();
```



<a id="api-c7a8065e7465ee0e"></a>

### [`void SvgDrawingContext.SetFilter(Brightness brightness)`](#api-c7a8065e7465ee0e)


```csharp
public void SetFilter(Brightness brightness);
```



<a id="api-d2d4412218f3b16c"></a>

### [`TextAlign SvgDrawingContext.TextAlign`](#api-d2d4412218f3b16c)


```csharp
public TextAlign TextAlign { get; set; }
```



<a id="api-ea640ad603938a0a"></a>

### [`TextBaseline SvgDrawingContext.TextBaseline`](#api-ea640ad603938a0a)


```csharp
public TextBaseline TextBaseline { get; set; }
```




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

## `class SvgDrawingContext.NumericFormat`



```csharp
public abstract class NumericFormat
{
    public abstract string Format(nfloat number);
    public static NumericFormat Default { get; }
}
```

<a id="api-73cc55f3bf656c6a"></a>

### [`NumericFormat NumericFormat.Default`](#api-73cc55f3bf656c6a)


```csharp
public static NumericFormat Default { get; }
```



<a id="api-c15d1ded7b92c9e9"></a>

### [`string NumericFormat.Format(NFloat number)`](#api-c15d1ded7b92c9e9)


```csharp
public abstract string Format(nfloat number);
```




<a id="api-079559febc4a6431"></a>

## `record struct SvgDrawingContext.Resolved`



```csharp
public record struct Resolved(SvgFontMode Mode, Uri? WebUri);
```

<a id="api-2cd7b51bb8ce48dc"></a>

### [`Resolved.Resolved(SvgFontMode Mode, Uri? WebUri)`](#api-2cd7b51bb8ce48dc)


```csharp
public Resolved(SvgFontMode Mode, Uri? WebUri);
```



<a id="api-4a4ff58ae4916bc4"></a>

### [`SvgFontMode Resolved.Mode`](#api-4a4ff58ae4916bc4)


```csharp
public SvgFontMode Mode { get; set; }
```



<a id="api-4a1e92476f0ad878"></a>

### [`Uri? Resolved.WebUri`](#api-4a1e92476f0ad878)


```csharp
public Uri? WebUri { get; set; }
```




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

## `enum SvgDrawingContext.SvgFontMode`

Determines how to emit fonts inside an SVG.

```csharp
public enum SvgFontMode
{
    System,
    WebLink,
    Embedded
}
```

<a id="api-554ebe6607065dd4"></a>

### [`SvgFontMode.Embedded`](#api-554ebe6607065dd4)


```csharp
Embedded
```

Embed the font data as base64 using a data URI inside @font-face.

<a id="api-d65fa3774c669b3e"></a>

### [`SvgFontMode.System`](#api-d65fa3774c669b3e)


```csharp
System
```

Assume the font is installed in the system; only use font-family=&quot;...&quot;.

<a id="api-ef3f22c074259040"></a>

### [`SvgFontMode.WebLink`](#api-ef3f22c074259040)


```csharp
WebLink
```

Emit a link to an external font using @font-face with a resolved URI.


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

## `class SvgDrawingContext.SvgFontResolver`

Delegate-based resolver that provides how a specific font should be handled in an SVG.

```csharp
public class SvgFontResolver
{
    public static readonly SvgFontResolver Default;
    public static readonly SvgFontResolver Embedded;
    public virtual Resolved Resolve(FontFace face, Uri? uri);
}
```

<a id="api-4dee6f42fbb0d621"></a>

### [`SvgFontResolver SvgFontResolver.Default`](#api-4dee6f42fbb0d621)


```csharp
public static readonly SvgFontResolver Default;
```



<a id="api-0e9b052918aaf350"></a>

### [`SvgFontResolver SvgFontResolver.Embedded`](#api-0e9b052918aaf350)


```csharp
public static readonly SvgFontResolver Embedded;
```

Embed only used glyphs and kerning pairs from each resolved font face.

<a id="api-bcfa2c6675598e3b"></a>

### [`Resolved SvgFontResolver.Resolve(FontFace face, Uri? uri)`](#api-bcfa2c6675598e3b)


```csharp
public virtual Resolved Resolve(FontFace face, Uri? uri);
```



