AmaroK86.ImageFormat.ImageMipMapHandler.ConvertTo32bit C# (CSharp) Method

ConvertTo32bit() public static method

public static ConvertTo32bit ( byte buff, int w, int h ) : byte[]
buff byte
w int
h int
return byte[]
        public static byte[] ConvertTo32bit(byte[] buff, int w, int h)
        {
            if (buff.Length != (w * h * 3))
                throw new ArgumentException("Buffer length is not equivalent to a 24-bit texture length");
            byte[] val = new byte[w * h * 4];

            for (int i = 0; i < w * h; i++)
            {
                Array.Copy(buff, i * 3, val, i * 4, 3);
                val[(i * 4) + 3] = 0xFF;
            }

            return val;
        }
    }