Replies: 3 comments 6 replies
-
Sounds like a good plan :) Feel free to open up a PR for this. |
Beta Was this translation helpful? Give feedback.
-
@pekspro the problem is that these are fake async methods. This is what is what usually happens in case of decoding:
Step 2 takes significantly longer execute than step 1, and the logic is much more complicated (+ it's per decoder+encoder, and we support 5 formats ATM). I don't see value for doing it only for step 1, it would be a false promise to users. I think this should happen together with the introduction of first real async codec implementations. @JimBobSquarePants @tocsoft what is most interesting in this proposal is that we probably need to introduce a breaking change on our decoder API before 1.0 (!) to make this possible in the future: public interface IImageDecoder
{
- Task<Image<TPixel>> DecodeAsync<TPixel>(Configuration configuration, Stream stream) where TPixel : unmanaged, IPixel<TPixel>;
- Task<Image> DecodeAsync(Configuration configuration, Stream stream);
+ Task<Image<TPixel>> DecodeAsync<TPixel>(Configuration configuration, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>;
+ Task<Image> DecodeAsync(Configuration configuration, Stream stream, CancellationToken cancellationToken);
} |
Beta Was this translation helpful? Give feedback.
-
It's coming in #1296! |
Beta Was this translation helpful? Give feedback.
-
I think it would be nice if all a Load and Save sync methods could be cancellable. In principle it should be possible to add
CancellationToken cancellationToken = default
to all public method and then pass on the token to all methods all the way to stream object when reads and writes occurs.I think this would be fairly easy to do. It just requires a lot of tiny changes, but I am willing to do the work :)
Beta Was this translation helpful? Give feedback.
All reactions