Skip to content

feat: Support for GetAlphaMask#22985

Merged
MartinZikmund merged 5 commits intomasterfrom
dev/mazi/alphamask
Apr 11, 2026
Merged

feat: Support for GetAlphaMask#22985
MartinZikmund merged 5 commits intomasterfrom
dev/mazi/alphamask

Conversation

@MartinZikmund
Copy link
Copy Markdown
Member

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:

@github-actions github-actions bot added area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/automation Categorizes an issue or PR as relevant to project automation labels Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Skia Shape, TextBlock, and Image by returning a CompositionSurfaceBrush over a new alpha-mask surface.
  • Add AlphaMaskSurface (Skia) implementing ICompositionSurface/ISkiaSurface to 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.

Comment thread src/Uno.UI.Composition/Composition/AlphaMaskSurface.skia.cs
Comment thread src/Uno.UI.Composition/Composition/AlphaMaskSurface.skia.cs
Comment thread src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Shapes/Shape.cs
Comment thread src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/Image.cs
@unodevops
Copy link
Copy Markdown
Contributor

🤖 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

@nventive-devops
Copy link
Copy Markdown
Contributor

The build 206059 found UI Test snapshots differences: android-28-net9: 17, android-28-net9-Snap: 24, ios: 5, ios-Snap: 45, skia-linux-screenshots: 71, skia-windows-screenshots: 177, wasm: 109, wasm-automated-net10.0-WinUI-Benchmarks-automated: 0, wasm-automated-net10.0-WinUI-Default-automated: 11, wasm-automated-net10.0-WinUI-RuntimeTests-0: 0, wasm-automated-net10.0-WinUI-RuntimeTests-1: 0, wasm-automated-net10.0-WinUI-RuntimeTests-2: 0

Details
  • android-28-net9: 17 changed over 758

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_NoSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_NoSelection_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_Parent_PointerMoved_After_drag_on_non-scrolling_ScrollViewer
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • Detereminate_ProgressRing_Validation75_[#FF0000_#008000_#008000_#008000]_Progress-Ring-Value-75
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • ListView_ListViewWithHeader_InitializesTest_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListViewGrouped
    • Detereminate_ProgressRing_Validation50_[#FF0000_#008000_#008000_#FF0000]_Progress-Ring-Value-50
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Detereminate_ProgressRing_Validation25_[#FF0000_#008000_#FF0000_#FF0000]_Progress-Ring-Value-25
    • WebView_NavigateToAnchor_Initial
    • WebView_NavigateToAnchor_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • WebView_NavigateToLongString_AfterSuccess
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
  • android-28-net9-Snap: 24 changed over 1069

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Image_UniformToFill100x100_Uno_UI_Samples_UITests_ImageTestsControl_UniformToFill100x100
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • ListView_ListView_With_ListViews_Count_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • CommandBar_Examples_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Examples
    • Gesture_Recognizer_Pointer_Events_test_bench_UITests_Shared_Windows_UI_Input_GestureRecognizer_PointersEvents
    • TabView_MUXControlsTestApp_TabViewPage_MUXControlsTestApp_TabViewPage
    • RatingControl_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavPage_MUXControlsTestApp_NavigationViewTopNavPage
    • Transform_Basics_UITests_Shared_Windows_UI_Xaml_Media_Transform_Basics
    • Scrolling_MUXControlsTestApp_ScrollViewWithScrollControllersPage_MUXControlsTestApp_ScrollViewWithScrollControllersPage
    • CommandBarFlyout_MUXControlsTestApp_CommandBarFlyoutPage_MUXControlsTestApp_CommandBarFlyoutPage
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
    • ListView_HorizontalListView_Padding_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListView_Padding
    • MUX_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage
    • WebView_UITests_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_NavigationProperties_UITests_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_NavigationProperties
    • UIElement_TransformToVisual_Simple_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_Simple
    • Default_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Uno_UI_Samples_UITests_Image_Image_Stretch
    • Scrolling_MUXControlsTestApp_ScrollViewDynamicPage_MUXControlsTestApp_ScrollViewDynamicPage
  • ios: 5 changed over 213

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • TextBox_UpdatedBinding_On_OneWay_Mode_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_Bindings
  • ios-Snap: 45 changed over 988

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPicker_ColorPickerSample_UITests_Microsoft_UI_Xaml_Controls_ColorPickerTests_ColorPickerSample
    • ColorPicker_WinUIColorPickerPage_UITests_Shared_Microsoft_UI_Xaml_Controls_ColorPickerTests_WinUIColorPickerPage
    • Icons_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground
    • Microsoft_UI_Xaml_Media_UITests_Windows_UI_Xaml_Media_ThemeShadowTests_ThemeShadow_Overlap_UITests_Windows_UI_Xaml_Media_ThemeShadowTests_ThemeShadow_Overlap
    • Grid_CenteredGridinGridwiththreefixedsizechildren_Uno_UI_Samples_Content_UITests_GridTestsControl_CenteredGridinGridwiththreefixedsizechildren
    • Pointers_UITests_Windows_UI_Input_PointersTests_HitTest_Control_UITests_Windows_UI_Input_PointersTests_HitTest_Control
    • Image_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Alignment_SizeOnControl_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Alignment_SizeOnControl
    • NavigationView_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage
    • Default_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected
    • Image_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Algmnt_Inf_Horizontal_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Algmnt_Inf_Horizontal
    • Brushes_BorderImageBrush_Uno_UI_Samples_UITests_ImageBrushTestControl_BorderImageBrush
    • Brushes_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList
    • SwipeControl_MUXControlsTestApp_SwipeControlPage2_MUXControlsTestApp_SwipeControlPage2
    • TextBlock_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_JustifiedText_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_JustifiedText
    • Brushes_PanelImageBrush_Uno_UI_Samples_UITests_ImageBrushTestControl_PanelImageBrush
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats
    • MenuBar_SimpleMenuBar_UITests_Shared_Windows_UI_Xaml_Controls_MenuBarTests_SimpleMenuBar
    • Microsoft_UI_Composition_UITests_Shared_Windows_UI_Composition_SKCanvasElement_Simple_UITests_Shared_Windows_UI_Composition_SKCanvasElement_Simple
    • Microsoft_UI_Composition_UITests_Windows_UI_Composition_InteractionTrackerAndExpressionAnimationSample_UITests_Windows_UI_Composition_InteractionTrackerAndExpressionAnimationSample
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
  • skia-linux-screenshots: 71 changed over 2322

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • DropDownButtonPage.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png
    • ClipboardTests.png
    • Gamepad_CurrentReading.png-dark
    • DoubleImageBrushInList.png-dark
    • Gamepad_CurrentReading.png
    • DoubleImageBrushInList.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ImagesInlineInFlipView.png-dark
    • ImagesInlineInFlipView.png
    • CalendarView_Theming.png-dark
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • CompositionEffectBrush.png-dark
  • skia-windows-screenshots: 177 changed over 2326

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ContentPresenter_Template.png-dark
    • ContentPresenter_Template.png
    • ContentPresenter_TextProperties.png-dark
    • ContentPresenter_TextProperties.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • BenchmarkDotNet.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BasicEnability.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • ClipboardTests.png-dark
    • BasicAutoSuggestBox.png-dark
    • FocusManagerTest.png-dark
    • ContentPresenter_NativeEmbedding_Android_FillType.png-dark
    • ContentPresenter_NativeEmbedding_Android_FillType.png
  • wasm: 109 changed over 1068

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • GenericApp.Views.Samples.Shared.Content.UITests.GridViewMultipleSelectionMode
    • SamplesApp.Windows_UI_Xaml_Controls.ToggleSwitchControl.ToggleSwitch_Default_Style
    • UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_With_ListViews_Count_Measure
    • UITests.Shared.Windows_UI_Xaml_Controls.ToggleSwitchControl.ToggleSwitchUnloadReload
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewLegacy
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListView_ItemTemplateSelector_And_ItemContainerStyleSelector
    • UITests.Microsoft_UI_Xaml_Controls.TreeViewTests.TreeView_ItemInvoked
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Controls.Repeater.ItemsRepeater_Nested
    • UITests.Windows_UI_Xaml_Controls.TextBox.WASM_Multiline
    • MUXControlsTestApp.SwipeControlPage
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Windows_UI_Input.GestureRecognizerTests.Button_Inside_Border
    • UITests.Shared.Windows_UI_Xaml_Controls.Buttons_Native
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • MUXControlsTestApp.CommandBarFlyoutPage
    • UITests.Windows_UI_Xaml_Controls.TextBox.TextBox_ClipboardMethods
    • UITests.Microsoft_UI_Xaml_Controls.ScrollViewTests.KeyboardNavigationSample
    • UITests.Shared.Windows_ApplicationModel.Email.EmailManagerTests
  • wasm-automated-net10.0-WinUI-Benchmarks-automated: 0 changed over 1

  • wasm-automated-net10.0-WinUI-Default-automated: 11 changed over 877

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Default_StrokeThickness_MyPath
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • When_StretchAndAlignmentNone_ImageBrush-50-50-None-XLeft-YBottom
    • Default_StrokeThickness_MyPolyline
    • Default_StrokeThickness_MyLine
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Default_StrokeThickness_MyPolygon
    • Default_StrokeThickness_MyRect
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
  • wasm-automated-net10.0-WinUI-RuntimeTests-0: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-1: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-2: 0 changed over 1

@unodevops
Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 206059 has failed on Uno.UI - CI.

@unodevops
Copy link
Copy Markdown
Contributor

🤖 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

@MartinZikmund
Copy link
Copy Markdown
Member Author

@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>
Copilot AI review requested due to automatic review settings April 11, 2026 09:58
@MartinZikmund MartinZikmund review requested due to automatic review settings April 11, 2026 09:58
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

@copilot fix xamlstyler issue

Fixed in c431c6d. Applied XamlStyler formatting to AlphaMaskTests.xaml — added BOM, moved tag to its own line, 4-space indentation for attributes, and sorted attributes alphabetically (matching the project's XamlStyler conventions).

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ MartinZikmund
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@unodevops
Copy link
Copy Markdown
Contributor

🤖 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

@MartinZikmund MartinZikmund enabled auto-merge April 11, 2026 10:35
@MartinZikmund MartinZikmund merged commit 31327df into master Apr 11, 2026
42 checks passed
@MartinZikmund MartinZikmund deleted the dev/mazi/alphamask branch April 11, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for TextBlock.GetAlphaMask()

7 participants