CSPspEmu.Core.Utils.PspBitmap.ToBitmap C# (CSharp) Method

ToBitmap() public method

public ToBitmap ( ) : Bitmap
return System.Drawing.Bitmap
        public Bitmap ToBitmap()
        {
            var Bitmap = new Bitmap(Width, Height, PixelFormat.Format24bppRgb);
            Bitmap.LockBitsUnlock(PixelFormat.Format32bppArgb, (BitmapData) =>
            {
                int Count = Width * Height;
                var Output = (OutputPixel*)BitmapData.Scan0;
                PixelFormatDecoder.Decode(
                    GuPixelFormat,
                    Address,
                    Output,
                    Width,
                    Height,
                    IgnoreAlpha: true
                );

                for (int n = 0; n < Count; n++)
                {
                    var Color = Output[n];
                    Output[n].R = Color.B;
                    Output[n].G = Color.G;
                    Output[n].B = Color.R;
                    Output[n].A = 0xFF;
                }
            });
            return Bitmap;
        }