Skip to content

Commit 1ab5185

Browse files
committed
Add NotSupportedException to the Image.Load overload documentation
1 parent 59a8449 commit 1ab5185

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

src/ImageSharp/Image.FromBytes.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public static Image Load(byte[] data)
102102
/// <typeparam name="TPixel">The pixel format.</typeparam>
103103
/// <exception cref="ArgumentNullException">The data is null.</exception>
104104
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
105+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
105106
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
106107
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
107108
public static Image<TPixel> Load<TPixel>(byte[] data)
@@ -116,6 +117,7 @@ public static Image<TPixel> Load<TPixel>(byte[] data)
116117
/// <typeparam name="TPixel">The pixel format.</typeparam>
117118
/// <exception cref="ArgumentNullException">The data is null.</exception>
118119
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
120+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
119121
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
120122
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
121123
public static Image<TPixel> Load<TPixel>(byte[] data, out IImageFormat format)
@@ -131,6 +133,7 @@ public static Image<TPixel> Load<TPixel>(byte[] data, out IImageFormat format)
131133
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
132134
/// <exception cref="ArgumentNullException">The data is null.</exception>
133135
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
136+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
134137
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
135138
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
136139
public static Image<TPixel> Load<TPixel>(Configuration configuration, byte[] data)
@@ -154,6 +157,7 @@ public static Image<TPixel> Load<TPixel>(Configuration configuration, byte[] dat
154157
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
155158
/// <exception cref="ArgumentNullException">The data is null.</exception>
156159
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
160+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
157161
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
158162
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
159163
public static Image<TPixel> Load<TPixel>(Configuration configuration, byte[] data, out IImageFormat format)
@@ -175,6 +179,7 @@ public static Image<TPixel> Load<TPixel>(Configuration configuration, byte[] dat
175179
/// <typeparam name="TPixel">The pixel format.</typeparam>
176180
/// <exception cref="ArgumentNullException">The data is null.</exception>
177181
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
182+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
178183
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
179184
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
180185
public static Image<TPixel> Load<TPixel>(byte[] data, IImageDecoder decoder)
@@ -198,6 +203,7 @@ public static Image<TPixel> Load<TPixel>(byte[] data, IImageDecoder decoder)
198203
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
199204
/// <exception cref="ArgumentNullException">The data is null.</exception>
200205
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
206+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
201207
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
202208
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
203209
public static Image<TPixel> Load<TPixel>(Configuration configuration, byte[] data, IImageDecoder decoder)
@@ -216,10 +222,7 @@ public static Image<TPixel> Load<TPixel>(Configuration configuration, byte[] dat
216222
/// </summary>
217223
/// <param name="data">The byte span containing encoded image data to read the header from.</param>
218224
/// <returns>The format or null if none found.</returns>
219-
public static IImageFormat DetectFormat(ReadOnlySpan<byte> data)
220-
{
221-
return DetectFormat(Configuration.Default, data);
222-
}
225+
public static IImageFormat DetectFormat(ReadOnlySpan<byte> data) => DetectFormat(Configuration.Default, data);
223226

224227
/// <summary>
225228
/// By reading the header on the provided byte span this calculates the images format.
@@ -258,6 +261,7 @@ public static IImageFormat DetectFormat(Configuration configuration, ReadOnlySpa
258261
/// <typeparam name="TPixel">The pixel format.</typeparam>
259262
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
260263
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
264+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
261265
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
262266
public static Image<TPixel> Load<TPixel>(ReadOnlySpan<byte> data)
263267
where TPixel : unmanaged, IPixel<TPixel>
@@ -271,6 +275,7 @@ public static Image<TPixel> Load<TPixel>(ReadOnlySpan<byte> data)
271275
/// <typeparam name="TPixel">The pixel format.</typeparam>
272276
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
273277
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
278+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
274279
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
275280
public static Image<TPixel> Load<TPixel>(ReadOnlySpan<byte> data, out IImageFormat format)
276281
where TPixel : unmanaged, IPixel<TPixel>
@@ -284,6 +289,7 @@ public static Image<TPixel> Load<TPixel>(ReadOnlySpan<byte> data, out IImageForm
284289
/// <typeparam name="TPixel">The pixel format.</typeparam>
285290
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
286291
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
292+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
287293
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
288294
public static Image<TPixel> Load<TPixel>(ReadOnlySpan<byte> data, IImageDecoder decoder)
289295
where TPixel : unmanaged, IPixel<TPixel>
@@ -298,6 +304,7 @@ public static Image<TPixel> Load<TPixel>(ReadOnlySpan<byte> data, IImageDecoder
298304
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
299305
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
300306
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
307+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
301308
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
302309
public static unsafe Image<TPixel> Load<TPixel>(Configuration configuration, ReadOnlySpan<byte> data)
303310
where TPixel : unmanaged, IPixel<TPixel>
@@ -321,6 +328,7 @@ public static unsafe Image<TPixel> Load<TPixel>(Configuration configuration, Rea
321328
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
322329
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
323330
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
331+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
324332
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
325333
public static unsafe Image<TPixel> Load<TPixel>(
326334
Configuration configuration,
@@ -347,6 +355,7 @@ public static unsafe Image<TPixel> Load<TPixel>(
347355
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
348356
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
349357
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
358+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
350359
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
351360
public static unsafe Image<TPixel> Load<TPixel>(
352361
Configuration configuration,
@@ -372,6 +381,7 @@ public static unsafe Image<TPixel> Load<TPixel>(
372381
/// <exception cref="ArgumentNullException">The data is null.</exception>
373382
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
374383
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
384+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
375385
/// <returns>The <see cref="Image"/>.</returns>
376386
public static Image Load(byte[] data, out IImageFormat format)
377387
=> Load(Configuration.Default, data, out format);
@@ -384,6 +394,7 @@ public static Image Load(byte[] data, out IImageFormat format)
384394
/// <exception cref="ArgumentNullException">The data is null.</exception>
385395
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
386396
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
397+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
387398
/// <returns>The <see cref="Image"/>.</returns>
388399
public static Image Load(byte[] data, IImageDecoder decoder)
389400
=> Load(Configuration.Default, data, decoder);
@@ -397,6 +408,7 @@ public static Image Load(byte[] data, IImageDecoder decoder)
397408
/// <exception cref="ArgumentNullException">The data is null.</exception>
398409
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
399410
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
411+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
400412
/// <returns>The <see cref="Image"/>.</returns>
401413
public static Image Load(Configuration configuration, byte[] data)
402414
=> Load(configuration, data, out _);
@@ -411,6 +423,7 @@ public static Image Load(Configuration configuration, byte[] data)
411423
/// <exception cref="ArgumentNullException">The data is null.</exception>
412424
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
413425
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
426+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
414427
/// <returns>The <see cref="Image"/>.</returns>
415428
public static Image Load(Configuration configuration, byte[] data, IImageDecoder decoder)
416429
{
@@ -430,6 +443,7 @@ public static Image Load(Configuration configuration, byte[] data, IImageDecoder
430443
/// <exception cref="ArgumentNullException">The data is null.</exception>
431444
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
432445
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
446+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
433447
/// <returns>The <see cref="Image"/>.</returns>
434448
public static Image Load(Configuration configuration, byte[] data, out IImageFormat format)
435449
{
@@ -445,6 +459,7 @@ public static Image Load(Configuration configuration, byte[] data, out IImageFor
445459
/// <param name="data">The byte span containing image data.</param>
446460
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
447461
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
462+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
448463
/// <returns>The <see cref="Image"/>.</returns>
449464
public static Image Load(ReadOnlySpan<byte> data)
450465
=> Load(Configuration.Default, data);
@@ -458,6 +473,7 @@ public static Image Load(ReadOnlySpan<byte> data)
458473
/// <exception cref="ArgumentNullException">The decoder is null.</exception>
459474
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
460475
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
476+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
461477
/// <returns>The <see cref="Image"/>.</returns>
462478
public static Image Load(ReadOnlySpan<byte> data, IImageDecoder decoder)
463479
=> Load(Configuration.Default, data, decoder);
@@ -470,6 +486,7 @@ public static Image Load(ReadOnlySpan<byte> data, IImageDecoder decoder)
470486
/// <exception cref="ArgumentNullException">The decoder is null.</exception>
471487
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
472488
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
489+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
473490
/// <returns>The <see cref="Image"/>.</returns>
474491
public static Image Load(ReadOnlySpan<byte> data, out IImageFormat format)
475492
=> Load(Configuration.Default, data, out format);
@@ -491,7 +508,7 @@ public static Image Load(Configuration configuration, ReadOnlySpan<byte> data)
491508
/// <param name="decoder">The decoder.</param>
492509
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
493510
/// <exception cref="ArgumentNullException">The decoder is null.</exception>
494-
/// <exception cref="NotSupportedException">The stream is not readable.</exception>
511+
/// <exception cref="NotSupportedException">The stream is not readable or the image format is not supported.</exception>
495512
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
496513
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
497514
/// <returns>The <see cref="Image"/>.</returns>
@@ -518,6 +535,7 @@ public static unsafe Image Load(
518535
/// <exception cref="ArgumentNullException">The configuration is null.</exception>
519536
/// <exception cref="UnknownImageFormatException">Image format not recognised.</exception>
520537
/// <exception cref="InvalidImageContentException">Image contains invalid content.</exception>
538+
/// <exception cref="NotSupportedException">Image format is not supported.</exception>
521539
/// <returns>The <see cref="Image"/>.</returns>
522540
public static unsafe Image Load(
523541
Configuration configuration,

0 commit comments

Comments
 (0)