CSPspEmu.Gui.Winforms.Winforms.GLControl.GrabScreenshot C# (CSharp) Method

GrabScreenshot() public method

public GrabScreenshot ( ) : Bitmap
return System.Drawing.Bitmap
        public Bitmap GrabScreenshot()
        {
            int Width = Size.Width;
            int Height = Size.Height;
            var Data = new byte[Width * Height * 4];
            fixed (byte* DataPtr = Data)
            {
                GL.glReadPixels(0, 0, Width, Height, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, DataPtr);
            }
            var Bitmap = new Bitmap(Width, Height).SetChannelsDataInterleaved(Data, BitmapChannelList.RGBA);
            Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
            return Bitmap;
        }