예제 #1
0
        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);
        }
예제 #2
0
        public Bitmap CreateBitmapFromOffscreenGraphics(Direct2DOffscreenGraphics g)
        {
            BitmapProperties bmpProps = new BitmapProperties(new PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied));

            return(new Bitmap(renderTarget, g.Surface, bmpProps));
        }