Class SpecializedImageDecoder<T>
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.
Inheritance
Inherited Members
Namespace: SixLabors.ImageSharp.Formats
Assembly: SixLabors.ImageSharp.dll
Syntax
public abstract class SpecializedImageDecoder<T> : ImageDecoder, ISpecializedImageDecoder<T>, IImageDecoder where T : ISpecializedDecoderOptions
Type Parameters
Name | Description |
---|---|
T | The type of specialized options. |
Methods
| Edit this page View SourceCreateDefaultSpecializedOptions(DecoderOptions)
A factory method for creating the default specialized options.
Declaration
protected abstract T CreateDefaultSpecializedOptions(DecoderOptions options)
Parameters
Type | Name | Description |
---|---|---|
DecoderOptions | options | The general decoder options. |
Returns
Type | Description |
---|---|
T | The new |
Decode(DecoderOptions, Stream, CancellationToken)
Decodes the image from the specified stream to an Image.
Declaration
protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DecoderOptions | options | The general decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Image | The Image. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Decode(T, Stream)
Decodes the image from the specified stream to an Image of a specific pixel type.
Declaration
public Image Decode(T options, Stream stream)
Parameters
Type | Name | Description |
---|---|---|
T | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
Returns
Type | Description |
---|---|
Image | The Image<TPixel>. |
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Decode(T, Stream, CancellationToken)
Decodes the image from the specified stream to an Image of a specific pixel type.
Declaration
protected abstract Image Decode(T options, Stream stream, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Image | The Image<TPixel>. |
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
DecodeAsync(T, Stream, CancellationToken)
Decodes the image from the specified stream to an Image of a specific pixel type.
Declaration
public Task<Image> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
T | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task<Image> | A Task<TResult> representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
DecodeAsync<TPixel>(T, Stream, CancellationToken)
Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.
Declaration
public Task<Image<TPixel>> DecodeAsync<TPixel>(T options, Stream stream, CancellationToken cancellationToken = default) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
T | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task<Image<TPixel>> | A Task<TResult> representing the asynchronous operation. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Decode<TPixel>(DecoderOptions, Stream, CancellationToken)
Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.
Declaration
protected override Image<TPixel> Decode<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
DecoderOptions | options | The general decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Image<TPixel> | The Image<TPixel>. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Decode<TPixel>(T, Stream)
Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.
Declaration
public Image<TPixel> Decode<TPixel>(T options, Stream stream) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
T | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
Returns
Type | Description |
---|---|
Image<TPixel> | The Image<TPixel>. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Decode<TPixel>(T, Stream, CancellationToken)
Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.
Declaration
protected abstract Image<TPixel> Decode<TPixel>(T options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
T | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Image<TPixel> | The Image<TPixel>. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |