AmaroK86.ImageFormat.DDSImage.View24Bit C# (CSharp) Method

View24Bit() public static method

public static View24Bit ( byte imgData, int w, int h ) : Bitmap
imgData byte
w int
h int
return System.Drawing.Bitmap
        public static Bitmap View24Bit(byte[] imgData, int w, int h)
        {
            if (imgData.Length != (w * h * 3))
                throw new ArgumentException("Input array is not correct size");
            var bmp = new Bitmap(w, h, PixelFormat.Format24bppRgb);
            BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
            Marshal.Copy(imgData, 0, bmpData.Scan0, imgData.Length);
            bmp.UnlockBits(bmpData);
            return bmp;
        }
        #endregion