Closed onepiecefreak3 closed 3 years ago
As per microsoft's documentation on Span
Example:
public Task<Image<Rgba32>> DecodeRawAsync(ReadOnlyMemory<byte> input, CompressionFormat format, int pixelWidth, int pixelHeight)
{
return Task.Factory.StartNew(() => DecodeRaw(input.Span, format, pixelWidth, pixelHeight));
}
Documentation: https://docs.microsoft.com/en-us/dotnet/standard/memory-and-spans/memory-t-usage-guidelines
Since the PR is merged, the Async API is ready to use.
As discussed in issue #15 an async api would benefit consuming programs of this library to design non-blocking UI's while decoding and encoding processes are running. Currently all classes seem to be thread-safe already, so it would just suffice to offer Async methods that wrap starting the async operation. This needs further investigation though.