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)

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

Parameters

options DecoderOptions
stream Stream
cancellationToken CancellationToken

Returns

Image

Decode(T, Stream)

public Image Decode(T options, Stream stream)

Parameters

options T
stream Stream

Returns

Image

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)

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

Parameters

options T
stream Stream
cancellationToken CancellationToken

Returns

Task<Image>

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 T
stream Stream
cancellationToken CancellationToken

Returns

Task<Image<TPixel>>

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 DecoderOptions
stream Stream
cancellationToken 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 T
stream 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 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.