public void Dispose() { if (DX_Child != null) { DX_Child.Clear(); GC.SuppressFinalize(DX_Child); } if (gaussian != null) { gaussian.Dispose(); } BitmapBuffer.Dispose(); DX_Core.DisposeSwapChain(ref com); GC.SuppressFinalize(this); }
public void ReSize(double width, double height) { Width = width; Height = height; DX_Core.DisposeSwapChain(ref com); DX_Core.CreateD3DInstance(ref com); lock (DX_Core.D2D) { BitmapBuffer.Dispose(); if (gaussian != null) { gaussian.Dispose(); gaussian = null; } var bp = new D2D1.BitmapProperties1( new D2D1.PixelFormat(Dxgi.Format.B8G8R8A8_UNorm, D2D1.AlphaMode.Premultiplied), com.dpi, com.dpi, D2D1.BitmapOptions.Target); BitmapBuffer = new D2D1.Bitmap1(DX_Core.D2D.d2dContext, new Size2((int)width, (int)height), bp); } }
public SwapChain(double width, double height) { Width = width; Height = height; com = new SwapChainComponent(); com.panel = this; com.dpi = DisplayInformation.GetForCurrentView().LogicalDpi; DX_Core.CreateD3DInstance(ref com); DX_Child = new List <UIElement>(); this.PointerPressed += PointerOperation; this.PointerMoved += PointerOperation; this.PointerReleased += PointerOperation; this.PointerEntered += PointerOperation; this.PointerExited += PointerOperation; this.PointerWheelChanged += PointerOperation; var bp = new D2D1.BitmapProperties1( new D2D1.PixelFormat(Dxgi.Format.B8G8R8A8_UNorm, D2D1.AlphaMode.Premultiplied), com.dpi, com.dpi, D2D1.BitmapOptions.Target); lock (DX_Core.D2D) BitmapBuffer = new D2D1.Bitmap1(DX_Core.D2D.d2dContext, new Size2((int)width, (int)height), bp); ThreadManage.StartLoop(this); }