/// <summary>
        /// Loads all resource.
        /// </summary>
        /// <param name="device">The device on which to load all resources.</param>
        /// <param name="resources">The current ResourceDictionary.</param>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            m_renderTargetTexture = GraphicsHelper.CreateRenderTargetTexture(
                device, m_width, m_height, new GraphicsViewConfiguration()
            {
                AntialiasingEnabled = false
            });
            m_renderTargetTextureView = new D3D11.ShaderResourceView(device.DeviceD3D11_1, m_renderTargetTexture);

            m_overlayRenderer = new Direct2DOverlayRenderer(
                device,
                m_renderTargetTexture,
                m_width, m_height,
                DpiScaling.Default);
            m_graphics2D = new Graphics2D(device, m_overlayRenderer.RenderTarget2D, new Size2F(m_width, m_height));
        }
        /// <summary>
        /// Loads all resource.
        /// </summary>
        /// <param name="device">The device on which to load all resources.</param>
        /// <param name="resources">The current ResourceDictionary.</param>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            m_renderTargetTexture = GraphicsHelper.CreateRenderTargetTexture(
                device, m_width, m_height, new GraphicsViewConfiguration()
            {
                AntialiasingEnabled = false
            });
            m_renderTargetTextureView = new D3D11.ShaderResourceView(device.DeviceD3D11_1, m_renderTargetTexture);

            // Create resources for rendering on the texture
            using (Direct2DOverlayRenderer overlayRenderer = new Direct2DOverlayRenderer(
                       device,
                       m_renderTargetTexture,
                       m_width, m_height,
                       DpiScaling.Default))
            {
                Graphics2D graphics2D = new Graphics2D(device, overlayRenderer.RenderTarget2D, new Size2F(m_width, m_height));

                // Start drawing
                overlayRenderer.BeginDraw();
                try
                {
                    if (m_drawingLayer != null)
                    {
                        m_drawingLayer.Draw2DInternal(graphics2D);
                    }
                    else if (m_fillBrush != null)
                    {
                        graphics2D.FillRectangle(
                            new RectangleF(0f, 0f, m_width, m_height),
                            m_fillBrush);
                    }
                }
                finally
                {
                    overlayRenderer.EndDraw();
                }
            }
        }