示例#1
0
        private async Task <CompositionSurfaceBrush> CreateOpacityMaskBrush(Uri opacityMaskImageUri)
        {
            // load in our opacity mask image.
            // this is created in a graphic tool such as paint.net
            var opacityMaskSurface = await _surfaceFactory.CreateSurfaceFromUriAsync(opacityMaskImageUri);

            // create surfacebrush with ICompositionSurface that contains the gradient opacity mask asset
            var opacityBrush = _compositor.CreateSurfaceBrush(opacityMaskSurface);

            opacityBrush.Stretch = CompositionStretch.UniformToFill;
            return(opacityBrush);
        }