Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 1.82 KB

image_getalphamask_1000193962.md

File metadata and controls

39 lines (25 loc) · 1.82 KB
-api-id -api-type
M:Microsoft.UI.Xaml.Controls.Image.GetAlphaMask
winrt method

Microsoft.UI.Xaml.Controls.Image.GetAlphaMask

-description

Returns a mask that represents the alpha channel of an image as a CompositionBrush.

-returns

A mask that represents the alpha channel of an image.

-remarks

This method gets an alpha mask from an image as a CompositionBrush that you can use as an input to composition shadows and effects. The alpha mask CompositionBrush has the same alignment and stretch property values that the source XAML element applies to its rendered content so that you can use those values to correctly position shadows or effects relative to the XAML element.

Version compatibility

The GetAlphaMask method is not available prior to Windows 10, version 1607. If your app’s 'minimum platform version' setting in Microsoft Visual Studio is less than the 'introduced version' shown in the Requirements block later in this page, you must design and test your app to account for this. For more info, see Version adaptive code.

To avoid exceptions when your app runs on previous versions of Windows 10, do not call this method without first performing a runtime check. This example shows how to use the ApiInformation class to check for the presence of this method before you use it.

if (ApiInformation.IsMethodPresent("Windows.UI.Xaml.Controls.Image", "GetAlphaMask"))
{
    var compositionBrush = image1.GetAlphaMask();
}

-examples

-see-also