public static extern int TranscodeImageLevel( IntPtr transcoder, void *pData, UInt32 dataSize, UInt32 imageIndex, UInt32 levelIndex, void *pOutput, UInt32 outputSizeInBlocks, TranscoderTextureFormats format, DecodeFlags decodeFlags, UInt32 outputRowPitch, UInt32 outputHeightInPixels );
public bool TryTranscode( TranscoderTextureFormats format, ArraySegment <byte> output, DecodeFlags decodeFlags, out ImageLevelInfo levelInfo, uint outputRowPitch = 0, uint outputHeightInPixels = 0 ) { lock (File) { if (!File.IsStarted) { if (Transcoder.Start(File.pTranscoder, File.pData, File.DataSize) == 0) { levelInfo = default; return(false); } File.IsStarted = true; } if (Transcoder.GetImageLevelInfo(File.pTranscoder, File.pData, File.DataSize, Image.Index, Index, out levelInfo) == 0) { return(false); } var blockSize = Transcoder.GetBytesPerBlockOrPixel(format); var numBlocks = (uint)(output.Count / blockSize); fixed(byte *pBuffer = output.Array) { var pOutput = pBuffer + output.Offset; if (Transcoder.TranscodeImageLevel( File.pTranscoder, File.pData, File.DataSize, Image.Index, Index, pOutput, numBlocks, format, decodeFlags, outputRowPitch, outputHeightInPixels ) == 0) { return(false); } } } return(true); }