LeXtudio.Win2D.UnoCompat 0.2.1

Prefix Reserved
dotnet add package LeXtudio.Win2D.UnoCompat --version 0.2.1
                    
NuGet\Install-Package LeXtudio.Win2D.UnoCompat -Version 0.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LeXtudio.Win2D.UnoCompat" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LeXtudio.Win2D.UnoCompat" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="LeXtudio.Win2D.UnoCompat" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LeXtudio.Win2D.UnoCompat --version 0.2.1
                    
#r "nuget: LeXtudio.Win2D.UnoCompat, 0.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LeXtudio.Win2D.UnoCompat@0.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LeXtudio.Win2D.UnoCompat&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=LeXtudio.Win2D.UnoCompat&version=0.2.1
                    
Install as a Cake Tool

Win2D.UnoCompat

Win2D.UnoCompat is a desktop-first compatibility shim that provides a subset of the Win2D API surface for Uno Platform apps.

It translates Microsoft.Graphics.Canvas drawing and text APIs into SkiaSharp operations so Uno projects can compile and run without the native Win2D package on non-Windows targets.

Current scope:

  • 124 public types covering ~100% of the Win2D public API surface (~601 / ~600 members)
  • Full drawing session with shapes, geometry, text, layers, transforms, and blend modes
  • Bitmap load/save/create/copy with pixel-level access
  • Effects pipeline: blur, shadow, color matrix, composite, blend, crop, transform, color management, and custom PixelShaderEffect with HLSL compilation
  • Brushes: solid color, image, linear/radial gradient
  • Geometry: shape factories, combine, stroke, hit-testing, path builder
  • Text: format, layout, cluster metrics, font face
  • Controls: CanvasControl, CanvasAnimatedControl
  • Image sources: CanvasImageSource, CanvasVirtualImageSource
  • Sprite batching, printing, SVG, ink, typography
  • Keep public namespaces close to Win2D so existing source code needs fewer changes
  • Track parity explicitly and avoid pretending unsupported Win2D APIs are complete

Compatibility

Win2D.UnoCompat includes a dedicated compatibility test suite that links Win2D's official C# test files and runs them against the Uno2D implementation.

Current status: 46 / 46 tests passing across all major API areas:

Area Tests Status
CanvasDevice 3 ✅
CanvasRenderTarget 3 ✅
CanvasBitmap (load/save/pixels) 10 ✅
CanvasDrawingSession (DrawImage) 3 ✅
Effects (blur, shadow, color matrix, composite, etc.) 5 ✅
PixelShaderEffect (HLSL compilation, properties, validation) 15 ✅
CanvasCommandList 2 ✅
CanvasImageSource 1 ✅
CanvasSpriteBatch 1 ✅
CanvasAnimatedControl 1 ✅
CanvasGeometry 1 ✅
CanvasPrintDocument 1 ✅

Code Coverage

Metric Value
Sequence points 83.0%
Branch coverage 56.3%
Excluding auto-generated code 85.9%
Win2D API parity ~100% (~601/~600 members)

Supported Platforms

  • Windows 11 (Windows 10 may work but is not a primary target)
  • macOS, 3 most recent versions from 2023-2025
  • Ubuntu latest LTS (other Linux distributions may work but are not primary targets)

If you are looking for support of a specific platform, business sponsorship is the way to accelerate that work. Please reach out to us at homepage.

Get Started

One NuGet package is available:

  • NuGet Win2D-compatible drawing and text primitives backed by SkiaSharp.

Default usage

dotnet add package LeXtudio.Win2D.UnoCompat
xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"

<canvas:CanvasControl Draw="Canvas_Draw" />
using Microsoft.Graphics.Canvas.UI.Xaml;
using Microsoft.Graphics.Canvas.Text;
using Windows.UI;

private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
    var ds = args.DrawingSession;
    ds.DrawLine(12, 12, 240, 12, Colors.DeepSkyBlue, 2);
    ds.DrawRectangle(12, 32, 180, 72, Colors.OrangeRed, 1);
    ds.DrawText("Hello from Win2D.UnoCompat", 16, 56, Colors.White, new CanvasTextFormat
    {
        FontFamily = "Segoe UI",
        FontSize = 18
    });
}

Current Status

Stable preview (v0.x.y) releases are available on NuGet.

This package is a compatibility shim that covers ~100% of the Win2D public API surface (~601 / ~600 public members across 124 types), achieving full API parity.

TODO Items Before v1.0.0

  • Drawing session parity (shapes, geometry, text, layers, transform, blend)
  • Bitmap load/save/create/copy with pixel-level access
  • Effects pipeline (blur, shadow, color matrix, composite, crop, transform, color management, custom PixelShaderEffect)
  • Brushes (solid, image, linear/radial gradient)
  • Geometry operations (combine, stroke, hit-test, path builder)
  • Controls (CanvasControl, CanvasAnimatedControl)
  • Image sources (CanvasImageSource, CanvasVirtualImageSource)
  • Sprite batching, printing, SVG, ink, typography
  • Win2D official C# test suite: 46/46 passing
  • Full Win2D API parity (~100%)
  • Add visual regression samples
  • Publish v1.0.0 stable release

License

Win2D.UnoCompat is licensed under the MIT License. See LICENSE for details.

Copyright (c) 2026 LeXtudio, Inc. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on LeXtudio.Win2D.UnoCompat:

Package Downloads
LeXtudio.Windows

Uno Platform-friendly shims for System.Windows.*, System.Windows.Media.*, and System.Windows.Documents.* — the WPF namespace surface needed to port WPF code to Uno without modifying source files.

LeXtudio.UnoEdit

UnoEdit — a cross-platform text editor component (AvalonEdit) for Uno Platform and WinUI 3.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.1 277 7/26/2026
0.2.0 312 7/21/2026
0.1.2 347 6/22/2026
0.1.1 200 6/21/2026
0.1.0 149 5/27/2026