Beispiel #1
0
        void EnsureCurrentBufferMatchesWindow()
        {
            var   bounds     = window.Bounds;
            Size  windowSize = new Size(bounds.Width, bounds.Height);
            float dpi        = DisplayInformation.GetForCurrentView().LogicalDpi;

            var buffer = accumulationBuffers[currentBuffer];

            if (buffer == null || SwapChainManager.SizeEqualsWithTolerance(buffer.Size, windowSize) || buffer.Dpi != dpi)
            {
                if (buffer != null)
                {
                    buffer.Dispose();
                }

                buffer = new CanvasRenderTarget(device, (float)windowSize.Width, (float)windowSize.Height, dpi);
                accumulationBuffers[currentBuffer] = buffer;
            }
        }
Beispiel #2
0
        public Renderer(CoreWindow window)
        {
            this.window = window;
            window.PointerPressed += window_PointerPressed;
            window.PointerMoved += window_PointerMoved;
            window.PointerReleased += window_PointerReleased;

            device = new CanvasDevice();
            swapChainManager = new SwapChainManager(window, device);

            var effect = new GaussianBlurEffect()
            {
                BlurAmount = 5,
                Source = inputEffect
            };

            outputEffect = new Transform2DEffect()
            {
                Source = effect
            };

            imageBrush = new CanvasImageBrush(device);
            imageBrush.Opacity = 0.99f;
        }
Beispiel #3
0
        public Renderer(CoreWindow window)
        {
            this.window             = window;
            window.PointerPressed  += window_PointerPressed;
            window.PointerMoved    += window_PointerMoved;
            window.PointerReleased += window_PointerReleased;

            device           = new CanvasDevice();
            swapChainManager = new SwapChainManager(window, device);

            var effect = new GaussianBlurEffect()
            {
                BlurAmount = 5,
                Source     = inputEffect
            };

            outputEffect = new Transform2DEffect()
            {
                Source = effect
            };

            imageBrush         = new CanvasImageBrush(device);
            imageBrush.Opacity = 0.99f;
        }