internal static void DecodeGif(int taskId, string filepath, int framesToRead, System.Threading.ThreadPriority workerPriority, DecodeCompleteCallback completeCallback) { var gifMetaHolderHandle = GCHandle.Alloc(new GifMetadata(), GCHandleType.Pinned); DecodeTasks[taskId] = new GifDecodeResources() { gifMetadataHandle = gifMetaHolderHandle, completeCallback = completeCallback }; C.EM_DecodeGif(taskId, filepath, framesToRead, EncodeThreadPriority(workerPriority), gifMetaHolderHandle.AddrOfPinnedObject(), GetFrameMetadataHolderFunc, GetImageDataHolderFunc, GifDecodingCompleteCallback); }
private void DoDecodeGif() { var taskId = mDecodeTask.taskId; var filepath = mDecodeTask.filepath; var framesToRead = mDecodeTask.framesToRead; var completeCallback = mDecodeTask.completeCallback; // First pin the gif metadata holding struct so we can pass it to unmanaged. var gifMetaHolderHandle = GCHandle.Alloc(new GifMetadata(), GCHandleType.Pinned); DecodeTasks[taskId] = new GifDecodeResources() { gifMetadataHandle = gifMetaHolderHandle, completeCallback = completeCallback }; C._DecodeGif(taskId, filepath, framesToRead, gifMetaHolderHandle.AddrOfPinnedObject(), GetFrameMetadataHolderFunc, GetImageDataHolderFunc, GifDecodingCompleteCallback); }