public static Direct2DOffscreenGraphics Create(int imageSizeX, int imageSizeY, bool allowReadback) { var gfx = new Direct2DOffscreenGraphics(imageSizeX, imageSizeY, allowReadback); if (gfx.renderTarget == null) { gfx.Dispose(); return(null); } return(gfx); }
public Bitmap CreateBitmapFromOffscreenGraphics(Direct2DOffscreenGraphics g) { BitmapProperties bmpProps = new BitmapProperties(new PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied)); return(new Bitmap(renderTarget, g.Surface, bmpProps)); }