feat: Support for GetAlphaMask#22985
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Skia support for GetAlphaMask() by introducing a Skia-backed composition surface that can render an element’s visual content into an alpha-mask surface brush, enabling CompositionMaskBrush/DropShadow.Mask scenarios.
Changes:
- Implement
GetAlphaMask()for SkiaShape,TextBlock, andImageby returning aCompositionSurfaceBrushover a new alpha-mask surface. - Add
AlphaMaskSurface(Skia) implementingICompositionSurface/ISkiaSurfaceto render a visual as an alpha mask. - Add runtime coverage + a manual SamplesApp page demonstrating
GetAlphaMask()usage.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Shapes/Shape.skia.cs | Adds Skia Shape.GetAlphaMask() returning a surface brush backed by AlphaMaskSurface. |
| src/Uno.UI/UI/Xaml/Controls/TextBlock/TextBlock.skia.cs | Adds Skia TextBlock.GetAlphaMask() returning a surface brush backed by AlphaMaskSurface. |
| src/Uno.UI/UI/Xaml/Controls/Image/Image.skia.cs | Adds Skia Image.GetAlphaMask() returning a surface brush backed by AlphaMaskSurface. |
| src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Shapes/Shape.cs | Adjusts generated GetAlphaMask() NotImplemented stubs to exclude Skia. |
| src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/TextBlock.cs | Adjusts generated GetAlphaMask() NotImplemented stubs to exclude Skia. |
| src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/Image.cs | Adjusts generated GetAlphaMask() NotImplemented stubs to exclude Skia. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Composition/Given_AlphaMask.cs | Adds runtime tests validating returned brush and masking behavior via screenshots. |
| src/Uno.UI.Composition/Composition/AlphaMaskSurface.skia.cs | New Skia surface implementation that renders visuals as an alpha mask. |
| src/SamplesApp/UITests.Shared/Windows_UI_Composition/AlphaMaskTests.xaml.cs | Adds a manual sample wiring GetAlphaMask() into CompositionMaskBrush. |
| src/SamplesApp/UITests.Shared/Windows_UI_Composition/AlphaMaskTests.xaml | XAML UI for the manual alpha-mask sample. |
| src/SamplesApp/UITests.Shared/UITests.Shared.projitems | Includes the new sample XAML and code-behind in the shared project items. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22985/wasm-skia-net9/index.html |
|
The build 206059 found UI Test snapshots differences: Details
|
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22985/wasm-skia-net9/index.html |
|
@copilot fix xamlstyler issue |
Agent-Logs-Url: https://github.com/unoplatform/uno/sessions/71752ea6-4ccc-4b3c-8cde-e04c509d3a9f Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22985/wasm-skia-net9/index.html |
GitHub Issue: closes #4858
PR Type: ✨ Feature
What is the current behavior? 🤔
Not supported
What is the new behavior? 🚀
Supported on Skia
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.