Description
The MatchSource
field is a member of the MaskMode
enumeration within the Sandbox.UI
namespace. It specifies how the mask values should be derived from the mask layer image based on the type of the mask-image
property. If the mask-image
is of type mask-source
, the luminance values of the mask layer image are used as the mask values. Conversely, if the mask-image
is of type image
, the alpha values of the mask layer image are used as the mask values.
Usage
Use the MatchSource
field when you want the mask values to be determined by the type of the mask-image
property. This is particularly useful when you need to dynamically switch between using luminance and alpha values based on the image type.
Example
// Example of using MaskMode.MatchSource in a UI component
var maskMode = MaskMode.MatchSource;
// Apply the mask mode to a UI element
UIElement element = new UIElement();
element.Style.MaskMode = maskMode;
// This will ensure that the mask values are derived based on the mask-image type
// If the mask-image is 'mask-source', luminance values are used
// If the mask-image is 'image', alpha values are used