Esempio n. 1
0
        private CanvasRenderTarget CreateOpacityMask(ICanvasResourceCreator resourceCreator, double width, double height)
        {
            var device = CanvasDevice.GetSharedDevice();
            var target = new CanvasRenderTarget(device, (float)width, (float)height, 96);

            using (var session = target.CreateDrawingSession())
            {
                session.Clear(Colors.Transparent);

                _maskGeometry.Add(ResourcesFactory.CreateCloud(session));
                _maskGeometry.Add(ResourcesFactory.CreateCircle(session));

                foreach (var geometry in _maskGeometry)
                {
                    session.FillGeometry(geometry, Colors.White);
                }
            }
            return(target);
        }
Esempio n. 2
0
 private void Canvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.ICanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     _maskGeometry.Add(ResourcesFactory.CreateCloud(sender));
     _maskGeometry.Add(ResourcesFactory.CreateCircle(sender));
 }