-
-
Notifications
You must be signed in to change notification settings - Fork 890
Improve Decoder/Encoder symmetry #2276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 53 commits
19bdecc
31def5c
5726089
7d5c05b
93a1700
391442b
5669626
1d99413
c550af8
b1db34d
dd88269
b98e1df
1dc7bbf
afa204b
2721ad5
0dc9949
b32755d
32965d3
8fdd6b0
6978235
28243df
4891dc3
47f1cda
4a613b6
d8c8244
00ca204
3a7c4f4
447cd85
937e78c
112b114
d1c76e2
f3a2aea
0018845
6a07a51
6675333
1b1be0a
ce7ef11
b9ba211
834f686
25e8d01
0eadea2
a58e6ff
e2c5748
718bdc4
5f488ee
64b4045
475825d
9a55652
bb22d69
2145794
bd6e58c
1dd2d6e
85dc0f3
205e1b3
64c7a8e
4007a48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,35 +6,68 @@ | |
| namespace SixLabors.ImageSharp.Formats; | ||
|
|
||
| /// <summary> | ||
| /// Encapsulates properties and methods required for decoding an image from a stream. | ||
| /// Defines the contract for all image decoders. | ||
| /// </summary> | ||
| public interface IImageDecoder : IImageInfoDetector | ||
| public interface IImageDecoder | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No reason for a separate interface here. |
||
| { | ||
| /// <summary> | ||
| /// Reads the raw image information from the specified stream. | ||
| /// </summary> | ||
| /// <param name="options">The general decoder options.</param> | ||
| /// <param name="stream">The <see cref="Stream"/> containing image data.</param> | ||
| /// <returns>The <see cref="IImageInfo"/> object.</returns> | ||
| /// <exception cref="ImageFormatException">Thrown if the encoded image contains errors.</exception> | ||
| public IImageInfo Identify(DecoderOptions options, Stream stream); | ||
|
|
||
| /// <summary> | ||
| /// Reads the raw image information from the specified stream. | ||
| /// </summary> | ||
| /// <param name="options">The general decoder options.</param> | ||
| /// <param name="stream">The <see cref="Stream"/> containing image data.</param> | ||
| /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> | ||
| /// <returns>The <see cref="Task{IImageInfo}"/> object.</returns> | ||
| /// <exception cref="ImageFormatException">Thrown if the encoded image contains errors.</exception> | ||
| public Task<IImageInfo> IdentifyAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken); | ||
|
|
||
| /// <summary> | ||
| /// Decodes the image from the specified stream to an <see cref="Image{TPixel}"/> of a specific pixel type. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use. | ||
| /// </remarks> | ||
| /// <typeparam name="TPixel">The pixel format.</typeparam> | ||
| /// <param name="options">The general decoder options.</param> | ||
| /// <param name="stream">The <see cref="Stream"/> containing image data.</param> | ||
| /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> | ||
| /// <returns>The <see cref="Image{TPixel}"/>.</returns> | ||
| /// <exception cref="ImageFormatException">Thrown if the encoded image contains errors.</exception> | ||
| Image<TPixel> Decode<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken) | ||
| public Image<TPixel> Decode<TPixel>(DecoderOptions options, Stream stream) | ||
| where TPixel : unmanaged, IPixel<TPixel>; | ||
|
|
||
| /// <summary> | ||
| /// Decodes the image from the specified stream to an <see cref="Image"/> of a specific pixel type. | ||
| /// </summary> | ||
| /// <param name="options">The general decoder options.</param> | ||
| /// <param name="stream">The <see cref="Stream"/> containing image data.</param> | ||
| /// <returns>The <see cref="Image{TPixel}"/>.</returns> | ||
| /// <exception cref="ImageFormatException">Thrown if the encoded image contains errors.</exception> | ||
| public Image Decode(DecoderOptions options, Stream stream); | ||
|
|
||
| /// <summary> | ||
| /// Decodes the image from the specified stream to an <see cref="Image{TPixel}"/> of a specific pixel type. | ||
| /// </summary> | ||
| /// <typeparam name="TPixel">The pixel format.</typeparam> | ||
| /// <param name="options">The general decoder options.</param> | ||
| /// <param name="stream">The <see cref="Stream"/> containing image data.</param> | ||
| /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> | ||
| /// <returns>A <see cref="Task{Image}"/> representing the asynchronous operation.</returns> | ||
| /// <exception cref="ImageFormatException">Thrown if the encoded image contains errors.</exception> | ||
| public Task<Image<TPixel>> DecodeAsync<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken) | ||
|
||
| where TPixel : unmanaged, IPixel<TPixel>; | ||
|
|
||
| /// <summary> | ||
| /// Decodes the image from the specified stream to an <see cref="Image"/>. | ||
| /// Decodes the image from the specified stream to an <see cref="Image"/> of a specific pixel type. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use. | ||
| /// </remarks> | ||
| /// <param name="options">The general decoder options.</param> | ||
| /// <param name="stream">The <see cref="Stream"/> containing image data.</param> | ||
| /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> | ||
| /// <returns>The <see cref="Image"/>.</returns> | ||
| /// <returns>A <see cref="Task{Image}"/> representing the asynchronous operation.</returns> | ||
| /// <exception cref="ImageFormatException">Thrown if the encoded image contains errors.</exception> | ||
| Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken); | ||
| public Task<Image> DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.