Class SpecializedImageDecoder<T>
- Namespace
- SixLabors.ImageSharp.Formats
- Assembly
- SixLabors.ImageSharp.dll
Acts as a base class for specialized image decoders. Specialized decoders allow for additional options to be passed to the decoder. Types that inherit this decoder are required to implement cancellable synchronous decoding operations only.
public abstract class SpecializedImageDecoder<T> : ImageDecoder, ISpecializedImageDecoder<T>, IImageDecoder where T : ISpecializedDecoderOptions
Type Parameters
T
The type of specialized options.
- Inheritance
-
SpecializedImageDecoder<T>
- Implements
- Derived
- Inherited Members
Constructors
SpecializedImageDecoder()
protected SpecializedImageDecoder()
Methods
CreateDefaultSpecializedOptions(DecoderOptions)
A factory method for creating the default specialized options.
protected abstract T CreateDefaultSpecializedOptions(DecoderOptions options)
Parameters
options
DecoderOptionsThe general decoder options.
Returns
- T
The new
T
.
Decode(DecoderOptions, Stream, CancellationToken)
protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
Parameters
options
DecoderOptionsstream
StreamcancellationToken
CancellationToken
Returns
Decode(T, Stream)
public Image Decode(T options, Stream stream)
Parameters
options
Tstream
Stream
Returns
Decode(T, Stream, CancellationToken)
Decodes the image from the specified stream to an Image of a specific pixel type.
protected abstract Image Decode(T options, Stream stream, CancellationToken cancellationToken)
Parameters
options
TThe specialized decoder options.
stream
StreamThe Stream containing image data.
cancellationToken
CancellationTokenThe token to monitor for cancellation requests.
Returns
- Image
The Image<TPixel>.
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
- ImageFormatException
Thrown if the encoded image contains errors.
DecodeAsync(T, Stream, CancellationToken)
public Task<Image> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken = default)
Parameters
options
Tstream
StreamcancellationToken
CancellationToken
Returns
DecodeAsync<TPixel>(T, Stream, CancellationToken)
public Task<Image<TPixel>> DecodeAsync<TPixel>(T options, Stream stream, CancellationToken cancellationToken = default) where TPixel : unmanaged, IPixel<TPixel>
Parameters
options
Tstream
StreamcancellationToken
CancellationToken
Returns
Type Parameters
TPixel
Decode<TPixel>(DecoderOptions, Stream, CancellationToken)
protected override Image<TPixel> Decode<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
options
DecoderOptionsstream
StreamcancellationToken
CancellationToken
Returns
- Image<TPixel>
Type Parameters
TPixel
Decode<TPixel>(T, Stream)
public Image<TPixel> Decode<TPixel>(T options, Stream stream) where TPixel : unmanaged, IPixel<TPixel>
Parameters
options
Tstream
Stream
Returns
- Image<TPixel>
Type Parameters
TPixel
Decode<TPixel>(T, Stream, CancellationToken)
Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.
protected abstract Image<TPixel> Decode<TPixel>(T options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
options
TThe specialized decoder options.
stream
StreamThe Stream containing image data.
cancellationToken
CancellationTokenThe token to monitor for cancellation requests.
Returns
- Image<TPixel>
The Image<TPixel>.
Type Parameters
TPixel
The pixel format.
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
- ImageFormatException
Thrown if the encoded image contains errors.