Table of Contents

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 DecoderOptions

The general decoder options.

Returns

T

The new T.

Decode(DecoderOptions, Stream, CancellationToken)

Decodes the image from the specified stream to an Image.

protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Image

The Image.

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.

Decode(T, Stream)

Decodes the image from the specified stream to an Image of a specific pixel type.

public Image Decode(T options, Stream stream)

Parameters

options T

The specialized decoder options.

stream Stream

The Stream containing image data.

Returns

Image

The Image<TPixel>.

Exceptions

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.

protected abstract Image Decode(T options, Stream stream, CancellationToken cancellationToken)

Parameters

options T

The specialized decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The 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)

Decodes the image from the specified stream to an Image of a specific pixel type.

public Task<Image> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken = default)

Parameters

options T

The specialized decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<Image>

A Task<TResult> representing the asynchronous operation.

Exceptions

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.

public Task<Image<TPixel>> DecodeAsync<TPixel>(T options, Stream stream, CancellationToken cancellationToken = default) where TPixel : unmanaged, IPixel<TPixel>

Parameters

options T

The specialized decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<Image<TPixel>>

A Task<TResult> representing the asynchronous operation.

Type Parameters

TPixel

The pixel format.

Exceptions

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.

protected override Image<TPixel> Decode<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The 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.

Decode<TPixel>(T, Stream)

Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.

public Image<TPixel> Decode<TPixel>(T options, Stream stream) where TPixel : unmanaged, IPixel<TPixel>

Parameters

options T

The specialized decoder options.

stream Stream

The Stream containing image data.

Returns

Image<TPixel>

The Image<TPixel>.

Type Parameters

TPixel

The pixel format.

Exceptions

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.

protected abstract Image<TPixel> Decode<TPixel>(T options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>

Parameters

options T

The specialized decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The 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.