public static void ExportPVR(Texture2D texture, Stream writer, Stream reader, long length) { PVRContainerParameters @params = new PVRContainerParameters() { DataLength = length, PixelFormat = texture.PVRPixelFormat(), Width = texture.Width, Height = texture.Height, MipMapCount = texture.MipCount, }; PVRContainer.ExportPVR(writer, reader, @params); }
public static Bitmap PVRTextureToBitmap(Texture2D texture, byte[] data) { using (MemoryStream dstStream = new MemoryStream()) { PVRContainerParameters @params = new PVRContainerParameters { DataLength = data.Length, PixelFormat = texture.PVRPixelFormat(), Width = texture.Width, Height = texture.Height, MipMapCount = texture.MipCount, }; using (MemoryStream srcStream = new MemoryStream(data)) { PVRContainer.ExportPVR(dstStream, srcStream, @params); } return(PVRToBitmap(dstStream.ToArray(), texture.Width, texture.Height)); } }
public static Bitmap PVRCrunchedTextureToBitmap(Texture2D texture, byte[] data) { byte[] decompressed = DecompressCrunch(texture, data); using (MemoryStream dstStream = new MemoryStream()) { using (MemoryStream srcStream = new MemoryStream(decompressed)) { PVRContainerParameters @params = new PVRContainerParameters { DataLength = decompressed.Length, PixelFormat = texture.PVRPixelFormat(), Width = texture.Width, Height = texture.Height, MipMapCount = texture.MipCount, }; PVRContainer.ExportPVR(dstStream, srcStream, @params); } return(PVRTextureToBitmap(texture, dstStream.ToArray())); } }