Пример #1
0
        public void DiscardDeviceResources()
        {
            _renderTarget.Dispose();
            _renderTarget = null;

            GC.Collect();
        }
Пример #2
0
        public void CreateDeviceResource()
        {
            if (_renderTarget == null)
            {
                var renderProps = new RenderTargetProperties()
                {
                    Type        = RenderTargetType.Hardware,
                    Usage       = RenderTargetUsage.None,
                    PixelFormat = new PixelFormat(Vortice.DXGI.Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied),
                    MinLevel    = FeatureLevel.Default,
                    DpiX        = 96,
                    DpiY        = 96
                };

                var hwndRenderTargetProperties = new HwndRenderTargetProperties()
                {
                    Hwnd           = _owner.HostWindowHandle,
                    PresentOptions = PresentOptions.RetainContents,
                    PixelSize      = new Vortice.Mathematics.Size(_owner.HostWindowInternal.ClientRectangle.Width, _owner.HostWindowInternal.ClientRectangle.Height)
                };

                _renderTarget = _d2dFactory.CreateHwndRenderTarget(renderProps, hwndRenderTargetProperties);
            }
        }
 internal D2D1HwndRenderTarget(ID2D1HwndRenderTarget renderTarget)
 {
     this.renderTarget = renderTarget;
 }
Пример #4
0
 internal D2D1HwndRenderTarget(ID2D1HwndRenderTarget renderTarget)
 {
     this.renderTarget = renderTarget;
 }