void SetDevice(CanvasDevice device, Size windowSize) { _drawLoopCancellationTokenSource?.Cancel(); _swapChain = new CanvasSwapChain(device, (float)this.ActualWidth, (float)this.ActualHeight, 96); _swapChainVisual.Brush = _compositor.CreateSurfaceBrush(CanvasComposition.CreateCompositionSurfaceForSwapChain(_compositor, _swapChain)); _drawLoopCancellationTokenSource = new CancellationTokenSource(); Task.Factory.StartNew( DrawLoop, _drawLoopCancellationTokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
public void SetDevice(CanvasDevice device, Size windowSize) { ++deviceCount; drawLoopCancellationTokenSource?.Cancel(); swapChain = new CanvasSwapChain(device, 256, 256, 96); swapChainVisual.Brush = compositor.CreateSurfaceBrush(CanvasComposition.CreateCompositionSurfaceForSwapChain(compositor, swapChain)); drawLoopCancellationTokenSource = new CancellationTokenSource(); Task.Factory.StartNew( DrawLoop, drawLoopCancellationTokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
public void SetDevice(CanvasDevice device) { drawLoopCancellationTokenSource?.Cancel(); var displayInfo = Windows.Graphics.Display.DisplayInformation.GetForCurrentView(); this.swapChain = new CanvasSwapChain( device, (int)this.ActualWidth, (int)this.ActualHeight, displayInfo.LogicalDpi, Windows.Graphics.DirectX.DirectXPixelFormat.B8G8R8A8UIntNormalized, 2, CanvasAlphaMode.Premultiplied); swapChainVisual.Brush = Window.Current.Compositor.CreateSurfaceBrush(CanvasComposition.CreateCompositionSurfaceForSwapChain(Window.Current.Compositor, swapChain)); drawLoopCancellationTokenSource = new CancellationTokenSource(); }
public void SetDevice(CanvasDevice device) { drawLoopCancellationTokenSource?.Cancel(); var displayInfo = Windows.Graphics.Display.DisplayInformation.GetForCurrentView(); this.swapChain = new CanvasSwapChain(device, (int)this.ActualWidth, (int)this.ActualHeight, displayInfo.LogicalDpi); swapChainVisual.Brush = Window.Current.Compositor().CreateSurfaceBrush(CanvasComposition.CreateCompositionSurfaceForSwapChain(Window.Current.Compositor(), swapChain)); drawLoopCancellationTokenSource = new CancellationTokenSource(); Task.Factory.StartNew( DrawLoop, drawLoopCancellationTokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
public ICompositionSurface CreateSurface(Compositor compositor) { return(CanvasComposition.CreateCompositionSurfaceForSwapChain(compositor, _swapChain)); }