From 1dc7bbf98f99328c57b3d74bcd9763ec25ac08d5 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 15 Nov 2022 23:01:33 +1000 Subject: [PATCH] Update SpecializedImageDecoder{T}.cs --- .../Formats/SpecializedImageDecoder{T}.cs | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs b/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs index 90442689bc..54a3c42914 100644 --- a/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs +++ b/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs @@ -14,6 +14,38 @@ namespace SixLabors.ImageSharp.Formats; public abstract class SpecializedImageDecoder : ImageDecoder, ISpecializedImageDecoder where T : ISpecializedDecoderOptions { + /// + public Image Decode(T options, Stream stream) + where TPixel : unmanaged, IPixel + => WithSeekableStream( + options.GeneralOptions, + stream, + s => this.Decode(options, s, default)); + + /// + public Image Decode(T options, Stream stream) + => WithSeekableStream( + options.GeneralOptions, + stream, + s => this.Decode(options, s, default)); + + /// + public Task> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken) + where TPixel : unmanaged, IPixel + => WithSeekableStreamAsync( + options.GeneralOptions, + stream, + (s, ct) => this.Decode(options, s, ct), + cancellationToken); + + /// + public Task DecodeAsync(T options, Stream stream, CancellationToken cancellationToken) + => WithSeekableStreamAsync( + options.GeneralOptions, + stream, + (s, ct) => this.Decode(options, s, ct), + cancellationToken); + /// /// Decodes the image from the specified stream to an of a specific pixel type. /// @@ -56,36 +88,4 @@ public abstract class SpecializedImageDecoder : ImageDecoder, ISpecializedIma /// The general decoder options. /// The new . protected abstract T CreateDefaultSpecializedOptions(DecoderOptions options); - - /// - public Image Decode(T options, Stream stream) - where TPixel : unmanaged, IPixel - => WithSeekableStream( - options.GeneralOptions, - stream, - s => this.Decode(options, s, default)); - - /// - public Image Decode(T options, Stream stream) - => WithSeekableStream( - options.GeneralOptions, - stream, - s => this.Decode(options, s, default)); - - /// - public Task> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken) - where TPixel : unmanaged, IPixel - => WithSeekableStreamAsync( - options.GeneralOptions, - stream, - (s, ct) => this.Decode(options, s, ct), - cancellationToken); - - /// - public Task DecodeAsync(T options, Stream stream, CancellationToken cancellationToken) - => WithSeekableStreamAsync( - options.GeneralOptions, - stream, - (s, ct) => this.Decode(options, s, ct), - cancellationToken); }