/// <summary> /// Creates an instance of the ColorBloomTransitionHelper. /// Any visuals to be later created and animated will be hosted within the specified UIElement. /// </summary> public ColorBloomTransitionHelper(UIElement hostForVisual) { this.hostForVisual = hostForVisual; // we have an element in the XAML tree that will host our Visuals var visual = ElementCompositionPreview.GetElementVisual(hostForVisual); _compositor = visual.Compositor; // create a container // adding children to this container adds them to the live visual tree _containerForVisuals = _compositor.CreateContainerVisual(); ElementCompositionPreview.SetElementChildVisual(hostForVisual, _containerForVisuals); _canvasDevice = new CanvasDevice(); _graphicsDevice = CanvasComposition.CreateCompositionGraphicsDevice(_compositor, _canvasDevice); // Create the circle mask _circleMaskSurface = LoadCircle(200, Colors.White); }
public ManagedSurface LoadCircle(float radius, Color color) { ManagedSurface surface = new ManagedSurface(CreateSurface(new Size(radius * 2, radius * 2))); var ignored = surface.Draw(_graphicsDevice, _drawingLock, new CircleDrawer(radius, color)); return(surface); }
public ManagedSurface LoadCircle(float radius, Color color) { _graphicsDevice = CanvasComposition.CreateCompositionGraphicsDevice(_compositor, _canvasDevice); ManagedSurface surface = new ManagedSurface(CreateSurface(new Size(radius * 2, radius * 2))); var ignored = surface.Draw(_graphicsDevice, _drawingLock, new CircleDrawer(radius, color)); return(surface); }