Add SKImageFilter.CreateCrop() - Fixes #3938#4229
Merged
Merged
Conversation
Contributor
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4229PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4229"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4229/packages --name skiasharp-pr-4229More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4229 |
Contributor
|
📖 Documentation Preview The documentation for this PR has been deployed and is available at: 🔗 View Staging Site This preview will be updated automatically when you push new commits to this PR. This comment is automatically updated by the documentation staging workflow. |
bc420ec to
9dd4017
Compare
Wraps Skia's modern SkImageFilters::Crop(rect, tileMode, input), the replacement for the deprecated cropRect parameter pattern on individual filters. Crop restricts an image filter's output to a rectangle using a tile mode for the area outside the rect. Changes: - C API: sk_imagefilter_new_crop in the skia submodule (mono/skia#261), rebased onto main's skia which includes CreateEmpty (#260) + m150 fixes. - C# wrapper: three CreateCrop overloads (no default parameters) - (rect), (rect, tileMode), (rect, tileMode, input) - with GC.KeepAlive. - Regenerated SkiaApi.generated.cs P/Invoke binding. - Tests validating non-null, null input, blur composition, pixel-level Decal crop rendering, and Decal-vs-Clamp behavioral differences. - ImageFilterCropSample gallery demo with enable toggle, crop sliders, tile mode picker, blur composition, and an aligned crop-rect outline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9dd4017 to
72904bf
Compare
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.
Implements SKImageFilter.CreateCrop(SKRect, SKShaderTileMode, SKImageFilter?) to wrap the modern Skia SkImageFilters::Crop API.
This is the modern replacement for the deprecated cropRect parameter pattern on individual filters. From Skia's header comment:
Closes #3938
Dependencies
Changes
C API (externals/skia submodule - mono/skia#261)
C# Wrapper
Gallery Sample
Added
ImageFilterCropSample.csdemonstrating:Tests
Added 6 comprehensive tests in SKImageFilterTest.cs that validate:
Testing
All 5712 tests passed:
Native build completed successfully on macOS ARM64.
Merge commit message