static public unsafe void toCompressedFormat(byte[] data, int numXPixels, int numZPixels, int pixelMemSize, BDXTFormat desiredFormat, eDXTQuality quality, ref byte[] outImg, ref int memLen) { byte *imgDat = null; CompressToFormat(data, numXPixels, numZPixels, pixelMemSize, desiredFormat, quality, &imgDat, ref memLen); IntPtr p = new IntPtr(imgDat); outImg = new byte[memLen]; System.Runtime.InteropServices.Marshal.Copy(p, outImg, 0, memLen); FreeCompressedData(&imgDat); imgDat = null; }
static extern unsafe void CompressToFormat(byte[] data, int numXPixels, int numZPixels, int pixelMemSize, BDXTFormat desiredFormat, eDXTQuality quality, byte **outTexture, ref int outSize);