Class AvaloniaControlCapture
- Assembly
- EncDotNet.S100.Renderers.Mapsui.Avalonia.dll
Captures an Avalonia control as PNG bytes while coordinating with live Mapsui painting.
public static class AvaloniaControlCapture
- Inheritance
-
AvaloniaControlCapture
- Inherited Members
Methods
CapturePngAsync(Control, double, CancellationToken)
Renders target to PNG-encoded bytes on Avalonia's UI
thread at scale device pixels per logical pixel.
public static Task<byte[]?> CapturePngAsync(Control target, double scale, CancellationToken cancellationToken = default)
Parameters
targetControlThe control to capture.
scaledoubleDevice pixels per logical pixel:
1renders at 96 dpi,2matches a Retina / HiDPI display.cancellationTokenCancellationTokenOptional cancellation token.
Returns
Exceptions
- ArgumentNullException
targetis null.- ArgumentOutOfRangeException
scaleis not a positive, finite number.- OperationCanceledException
cancellationTokenis canceled.- InvalidOperationException
The target contains a Mapsui control that does not derive from CaptureSynchronizedMapControl.
CapturePngAsync(Control, CancellationToken)
Renders target to PNG-encoded bytes on Avalonia's UI
thread.
public static Task<byte[]?> CapturePngAsync(Control target, CancellationToken cancellationToken = default)
Parameters
targetControlThe control to capture.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
Exceptions
- ArgumentNullException
targetis null.- OperationCanceledException
cancellationTokenis canceled.- InvalidOperationException
The target contains a Mapsui control that does not derive from CaptureSynchronizedMapControl.