Skip to content

Migrate raster rendering backend from SkiaSharp to CanvasNet - #67

Merged
Malcolmnixon merged 3 commits into
mainfrom
feature/canvasnet-rendering-migration
Sep 27, 2026
Merged

Malcolmnixon merged 3 commits into
mainfrom
feature/canvasnet-rendering-migration

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

Summary

Migrates the raster rendering backend from DemaConsulting.Rendering.Skia
(SkiaSharp) to DemaConsulting.Rendering.CanvasNet, following the
DemaConsulting.Rendering 0.3.0-beta.1
release, which fully replaces SkiaSharp with the new pure-managed
DemaConsulting.CanvasNet drawing library (no native/P-Invoke
dependency).

Result: DemaConsulting.SysML2Tools.Tool is now a fully managed
.NET tool with zero native runtime dependencies
, able to run on any
supported .NET target/platform without RID-specific native asset
packaging.

Changes

  • Bump DemaConsulting.Rendering.CanvasNet / .Svg / .Layout to
    0.3.0-beta.1
  • Remove SkiaSharp.NativeAssets.* package references
  • Remove the SupportedNativeAssetRids property group and
    TrimPublishedNativeAssets MSBuild target (no longer needed —
    CanvasNet ships no native runtime assets to trim)
  • Swap using DemaConsulting.Rendering.Skia; for
    using DemaConsulting.Rendering.CanvasNet; in RenderCommand.cs
    and Validation.cs
  • Remove the NativeLibrary.TryLoad("libSkiaSharp", ...)
    graceful-skip guards from the PNG self-tests — they now run
    unconditionally
  • Update design/verification/reqstream docs, README, AGENTS.md,
    ROADMAP.md, and the user guide to reflect the CanvasNet backend
  • Add CanvasNet to the .cspell.yaml dictionary

Verification

  • Full solution build/test: 0 warnings/errors, 2125/2125 tests
    passed
  • pwsh ./lint.ps1: clean (markdownlint-cli2, cspell, yamllint,
    dotnet format, reqstream, versionmark, reviewmark)
  • Formal review of all 26 affected review-sets: all passing, zero
    blocking findings
  • dotnet list package --include-transitive confirms zero
    SkiaSharp packages
    ; a scratch dotnet publish shows no
    runtimes/ folder and no *Skia* files

Notes

  • WEBP support was dropped upstream with this release (CanvasNet has
    no WEBP codec); this project never used the WebpRenderer, so it's
    a non-issue here.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Replaces DemaConsulting.Rendering.Skia + SkiaSharp native assets with
DemaConsulting.Rendering.CanvasNet 0.3.0-beta.1, a pure-managed .NET
raster renderer with no native/P-Invoke dependency. This makes
DemaConsulting.SysML2Tools.Tool a fully managed .NET tool with zero
native runtime dependencies, able to run on any supported .NET
target/platform without RID-specific native asset packaging.

- Bump DemaConsulting.Rendering.CanvasNet/Svg/Layout to 0.3.0-beta.1
- Remove SkiaSharp.NativeAssets.* package references
- Remove SupportedNativeAssetRids/TrimPublishedNativeAssets MSBuild
  target (no longer needed; CanvasNet ships no native assets)
- Swap `using DemaConsulting.Rendering.Skia;` for
  `using DemaConsulting.Rendering.CanvasNet;` in RenderCommand.cs and
  Validation.cs
- Remove NativeLibrary.TryLoad("libSkiaSharp", ...) graceful-skip
  guards from PNG self-tests, which now run unconditionally
- Update design/verification/reqstream docs, README, AGENTS.md,
  ROADMAP.md, and user guide to reflect the CanvasNet backend
- Add CanvasNet to .cspell.yaml dictionary

Verified via full build/test (2125/2125 passing), lint.ps1, and a
formal review of all 26 affected review-sets (all passing, zero
blocking findings). Confirmed via `dotnet list package
--include-transitive` and a scratch publish that the tool no longer
carries any SkiaSharp/native runtime assets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 27, 2026 04:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Update .fileassert.yaml to remove stale SkiaSharp packaging expectations and validate the no-native-assets contract.

Review effort: Lite
Findings: None

What changed in this PR

Migrates PNG rendering from SkiaSharp to the managed CanvasNet backend.

Changes:

  • Updates rendering dependencies and namespaces.
  • Removes SkiaSharp native assets and guards.
  • Updates tests, documentation, requirements, and project metadata.

Review note: Update .fileassert.yaml to reflect the CanvasNet packaging contract and absence of native runtime assets.

File Summary
test/​DemaConsulting.SysML2Tools.Tool.Tests/​SelfTest/​ValidationTests.cs Updates PNG self-tests.
test/​DemaConsulting.SysML2Tools.Tool.Tests/​Render/​RenderSubsystemTests.cs Removes native-library guard.
test/​DemaConsulting.SysML2Tools.Tests/​Rendering/​RenderIntegrationTests.cs Uses CanvasNet namespaces.
test/​DemaConsulting.SysML2Tools.Tests/​Rendering/​RenderingTests.cs Uses CanvasNet namespaces.
test/​DemaConsulting.SysML2Tools.Tests/​DemaConsulting.SysML2Tools.Tests.csproj Updates rendering dependencies.
src/​DemaConsulting.SysML2Tools.Tool/​SelfTest/​Validation.cs Uses CanvasNet and unconditional PNG tests.
src/​DemaConsulting.SysML2Tools.Tool/​Render/​RenderCommand.cs Selects the CanvasNet renderer.
src/​DemaConsulting.SysML2Tools.Tool/​DemaConsulting.SysML2Tools.Tool.csproj Removes native asset handling and updates packages.
src/​DemaConsulting.SysML2Tools.Core/​Rendering/​NamespaceDoc.cs Documents CanvasNet usage.
src/​DemaConsulting.SysML2Tools.Core/​DemaConsulting.SysML2Tools.Core.csproj Updates the layout dependency.
ROADMAP.md Updates rendering roadmap references.
README.md Updates PNG backend documentation.
docs/​verification/​sysml2-tools-tool/​self-test/​validation.md Updates validation evidence.
docs/​verification/​sysml2-tools-core/​rendering.md Updates rendering evidence.
docs/​verification/​ots/​dema-rendering.md Updates renderer verification.
docs/​user_guide/​introduction.md Updates user-facing backend documentation.
docs/​reqstream/​sysml2-tools-tool/​self-test/​validation.yaml Updates validation traceability.
docs/​reqstream/​ots/​dema-rendering.yaml Updates rendering requirements.
docs/​design/​sysml2-tools-tool/​self-test/​validation.md Updates self-test design.
docs/​design/​sysml2-tools-tool/​render.md Updates tool rendering design.
docs/​design/​sysml2-tools-core/​rendering.md Updates rendering design.
docs/​design/​introduction.md Documents the managed rendering architecture.
AGENTS.md Updates rendering technology references.
.cspell.yaml Adds CanvasNet terminology.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Removes the stale ~435 MB SkiaSharp packaging comment/check and
replaces it with a stricter assertion that the packed Tool NuGet
contains no 
untimes/ folder at all (native or otherwise), matching
the pure-managed CanvasNet backend. Tightens the package size budget
from 70 MiB to 10 MiB to reflect the actual packed size (~3.84 MB).

Addresses PR review feedback on #67.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 27, 2026 04:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Add rendered-content assertions and remove the unused import before approval.

Review effort: Lite
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Low severity Remove unused System.Runtime.InteropServices import

src/​DemaConsulting.SysML2Tools.Tool/​SelfTest/​Validation.cs:24

The PNG guard was the only use of System.Runtime.InteropServices, so after removing both NativeLibrary calls this import is now dead in Validation.cs. Remove it as part of this migration to keep the file free of unused-using diagnostics.

Reruns 'sysml2tools render' for all 10 gallery models (18 views) in
both PNG and SVG formats after the SkiaSharp->CanvasNet migration:

- All 18 PNGs regenerated with the new CanvasNet raster backend;
  visually spot-checked and confirmed pixel-correct against the
  documented design.
- 5 SVGs also changed - not from a renderer swap (SVG renderer is
  unchanged) but from the DemaConsulting.Rendering.Layout bump to
  0.3.0-beta.1, which includes PR#34's port-label vertical-clearance
  fix (taller boxes where port labels previously risked overlapping
  connector lines).

Also fixes a YAML auto-fixer regression in .fileassert.yaml where the
bare word 'no' in a comment was mangled to 'false'; reworded the
comment to avoid the ambiguous YAML 1.1 boolean-alias token.

Verified with a full 'build.ps1' run (2125/2125 tests passing, 0
warnings/errors) and 'lint.ps1' (clean).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 27, 2026 04:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad backend and packaging migration warrants final human review despite passing verification.

Review effort: Lite
Findings: 1 Low severity

Open (1)

Comment thread src/DemaConsulting.SysML2Tools.Tool/SelfTest/Validation.cs
@Malcolmnixon
Malcolmnixon merged commit 77b1bd4 into main Sep 27, 2026
10 checks passed
@Malcolmnixon
Malcolmnixon deleted the feature/canvasnet-rendering-migration branch September 27, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants