feat(skiasharp): add a Skia bitmap loader package - #1674
Merged
Conversation
- Add Splat.SkiaSharp, an opt-in IBitmapLoader and IBitmap over SkiaSharp for net8.0 through net11.0, where BitmapLoader.Current has nothing to resolve today. - Take an explicit Linux native asset dependency: SkiaSharp itself only carries the macOS and Win32 assets on these target frameworks, so without it the package restores and then fails to load at run time on the hosts it exists to serve. - Preserve the aspect ratio when a decode size is requested, matching the desktop loader: both dimensions fit inside the box, one derives the other. - Apply the orientation the source recorded, and report it, so an image stored on its side decodes upright. - Add ToNative and FromNative that return the Skia bitmap rather than pretending to be a platform type, a Save overload for the formats the shared enumeration has no name for, and a choice of resampler. - Register through a module and a resolver extension, with no scanning. - Keep the native symbol files out of build and publish output, which they otherwise dominate.
- Drop the Linux native asset reference from the library. It flowed into every consumer's output regardless of what they target, and clashed with the one an application had already chosen for itself. - Name it in the test project instead, and only when building on Linux, since the base package already carries the Windows and macOS natives.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1674 +/- ##
==========================================
- Coverage 98.06% 98.05% -0.02%
==========================================
Files 128 133 +5
Lines 6965 7081 +116
Branches 1082 1105 +23
==========================================
+ Hits 6830 6943 +113
- Misses 63 65 +2
- Partials 72 73 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ChrisPulman
approved these changes
Aug 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What kind of change does this PR introduce?
Feature: a new opt-in package.
What is the new behavior?
Splat.SkiaSharpprovides a bitmap loader for the plain .NET targets, which have had no loader at all. A consumer callsUseSkiaSharpBitmapLoader(), or applies the module through the builder, andBitmapLoader.Currentworks on server, console, container and Linux.ToNative()returns the Skia bitmap honestly rather than pretending to be a platform type, and the richer capabilities the library offers sit on an additive surface: the encoded orientation, sampling options, and saving to the formats the core enum does not name.What is the current behavior?
BitmapLoader.Currentthrows. Those targets compile the registration away entirely.What might this PR break?
Checklist
mainbranchAdditional information
This is deliberately not sold on speed. Measured against the desktop decoder already shipped, Skia tied on a small image, won on one with transparency, and lost on a large photograph. The reason to have it is reach and capability, not throughput, and no performance claim appears in the code or the docs.
The package takes an explicit dependency on the Linux native assets. Without it the restore succeeds and the first decode throws, because the base package declares only the macOS and Windows natives for these targets, which is precisely the platform this package exists to serve. The variant chosen needs no system font libraries, so it works in the slim container images; a consumer who wants font-backed text rendering should swap in the other one, which the project file notes.
The Windows native assets ship roughly 90 MB of debugging symbols per architecture that nothing loads. The package removes them from the consumer's output and offers a property to keep them, which takes a build from 493 MB to 238 MB, and 186 MB for a package consumer.
Every file is at 100% of lines and branches with no exclusions and no suppressions. Where the orientation branch could not be reached because no encoder writes that tag, the test fixture writes the metadata by hand rather than the code being reshaped around the gap. 384 tests in the new project, and the full solution passes at 20,072.