diff --git a/src/ImageSharp/FormattedImage.cs b/src/ImageSharp/FormattedImage.cs
deleted file mode 100644
index 9b604eced..000000000
--- a/src/ImageSharp/FormattedImage.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the GNU Affero General Public License, Version 3.
-
-using System;
-using System.Collections.Generic;
-using SixLabors.ImageSharp.Formats;
-
-namespace SixLabors.ImageSharp
-{
- ///
- /// Struct to curry and for return from async overloads.
- ///
- public readonly struct FormattedImage : IEquatable
- {
- ///
- /// Initializes a new instance of the struct.
- ///
- /// The .
- /// The .
- public FormattedImage(Image image, IImageFormat format)
- {
- this.Image = image;
- this.Format = format;
- }
-
- ///
- /// Gets the Image.
- ///
- public readonly Image Image { get; }
-
- ///
- /// Gets the Format.
- ///
- public readonly IImageFormat Format { get; }
-
- ///
- /// Converts to .
- ///
- /// The to convert.
- public static implicit operator (Image image, IImageFormat format)(FormattedImage value)
- => (value.Image, value.Format);
-
- ///
- /// Converts to
- ///
- /// The to convert.
- public static implicit operator FormattedImage((Image image, IImageFormat format) value)
- => new FormattedImage(value.image, value.format);
-
- ///
- /// Compares two objects for equality.
- ///
- /// The on the left side of the operand.
- /// The on the right side of the operand.
- ///
- /// True if the parameter is equal to the parameter; otherwise, false.
- ///
- public static bool operator ==(FormattedImage left, FormattedImage right)
- => left.Equals(right);
-
- ///
- /// Compares two objects for inequality.
- ///
- /// The on the left side of the operand.
- /// The on the right side of the operand.
- ///
- /// True if the parameter is not equal to the parameter; otherwise, false.
- ///
- public static bool operator !=(FormattedImage left, FormattedImage right)
- => !(left == right);
-
- ///
- public override bool Equals(object obj)
- => obj is FormattedImage image && this.Equals(image);
-
- ///
- public bool Equals(FormattedImage other)
- => EqualityComparer.Default.Equals(this.Image, other.Image)
- && EqualityComparer.Default.Equals(this.Format, other.Format);
-
- ///
- public override int GetHashCode() => HashCode.Combine(this.Image, this.Format);
-
- ///
- /// Deconstructs into component parts.
- ///
- /// The .
- /// The .
- public void Deconstruct(out Image image, out IImageFormat format)
- {
- image = this.Image;
- format = this.Format;
- }
- }
-}
diff --git a/src/ImageSharp/FormattedImageInfo.cs b/src/ImageSharp/FormattedImageInfo.cs
deleted file mode 100644
index 72368be34..000000000
--- a/src/ImageSharp/FormattedImageInfo.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the GNU Affero General Public License, Version 3.
-
-using System;
-using System.Collections.Generic;
-using SixLabors.ImageSharp.Formats;
-
-namespace SixLabors.ImageSharp
-{
- ///
- /// Struct to curry and for return from async overloads.
- ///
- public readonly struct FormattedImageInfo : IEquatable
- {
- ///
- /// Initializes a new instance of the struct.
- ///
- /// The .
- /// The .
- public FormattedImageInfo(IImageInfo imageInfo, IImageFormat format)
- {
- this.ImageInfo = imageInfo;
- this.Format = format;
- }
-
- ///
- /// Gets the Image Info.
- ///
- public readonly IImageInfo ImageInfo { get; }
-
- ///
- /// Gets the Format.
- ///
- public readonly IImageFormat Format { get; }
-
- ///
- /// Converts to a
- ///
- /// The to convert.
- public static implicit operator (IImageInfo imageInfo, IImageFormat format)(FormattedImageInfo value)
- => (value.ImageInfo, value.Format);
-
- ///
- /// Converts to
- ///
- /// The to convert.
- public static implicit operator FormattedImageInfo((IImageInfo imageInfo, IImageFormat format) value)
- => new FormattedImageInfo(value.imageInfo, value.format);
-
- ///
- /// Compares two objects for equality.
- ///
- /// The on the left side of the operand.
- /// The on the right side of the operand.
- ///
- /// True if the parameter is equal to the parameter; otherwise, false.
- ///
- public static bool operator ==(FormattedImageInfo left, FormattedImageInfo right) => left.Equals(right);
-
- ///
- /// Compares two objects for inequality.
- ///
- /// The on the left side of the operand.
- /// The on the right side of the operand.
- ///
- /// True if the parameter is not equal to the parameter; otherwise, false.
- ///
- public static bool operator !=(FormattedImageInfo left, FormattedImageInfo right) => !(left == right);
-
- ///
- public override bool Equals(object obj)
- => obj is FormattedImageInfo info && this.Equals(info);
-
- ///
- public bool Equals(FormattedImageInfo other)
- => EqualityComparer.Default.Equals(this.ImageInfo, other.ImageInfo)
- && EqualityComparer.Default.Equals(this.Format, other.Format);
-
- ///
- public override int GetHashCode() => HashCode.Combine(this.ImageInfo, this.Format);
-
- ///
- /// Deconstructs into component parts.
- ///
- /// The .
- /// The .
- public void Deconstruct(out IImageInfo imageInfo, out IImageFormat format)
- {
- imageInfo = this.ImageInfo;
- format = this.Format;
- }
- }
-}
diff --git a/src/ImageSharp/FormattedImage{TPixel}.cs b/src/ImageSharp/FormattedImage{TPixel}.cs
deleted file mode 100644
index bb3eeabe7..000000000
--- a/src/ImageSharp/FormattedImage{TPixel}.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the GNU Affero General Public License, Version 3.
-
-using System;
-using System.Collections.Generic;
-using SixLabors.ImageSharp.Formats;
-using SixLabors.ImageSharp.PixelFormats;
-
-namespace SixLabors.ImageSharp
-{
- ///
- /// Struct to curry and for return from async overloads.
- ///
- /// The pixel format.
- public readonly struct FormattedImage : IEquatable>
- where TPixel : unmanaged, IPixel
- {
- ///
- /// Initializes a new instance of the struct.
- ///
- /// The .
- /// The .
- public FormattedImage(Image image, IImageFormat format)
- {
- this.Image = image;
- this.Format = format;
- }
-
- ///
- /// Gets the Image.
- ///
- public readonly Image Image { get; }
-
- ///
- /// Gets the Format.
- ///
- public readonly IImageFormat Format { get; }
-
- ///
- /// Converts to .
- ///
- /// The to convert.
- public static implicit operator (Image image, IImageFormat format)(FormattedImage value)
- => (value.Image, value.Format);
-
- ///
- /// Converts to
- ///
- /// The to convert.
- public static implicit operator FormattedImage((Image image, IImageFormat format) value)
- => new FormattedImage(value.image, value.format);
-
- ///
- /// Compares two objects for equality.
- ///
- /// The on the left side of the operand.
- /// The on the right side of the operand.
- ///
- /// True if the parameter is equal to the parameter; otherwise, false.
- ///
- public static bool operator ==(FormattedImage left, FormattedImage right)
- => left.Equals(right);
-
- ///
- /// Compares two objects for inequality.
- ///
- /// The on the left side of the operand.
- /// The on the right side of the operand.
- ///
- /// True if the parameter is not equal to the parameter; otherwise, false.
- ///
- public static bool operator !=(FormattedImage left, FormattedImage right)
- => !(left == right);
-
- ///
- public override bool Equals(object obj)
- => obj is FormattedImage image && this.Equals(image);
-
- ///
- public bool Equals(FormattedImage other)
- => EqualityComparer>.Default.Equals(this.Image, other.Image)
- && EqualityComparer.Default.Equals(this.Format, other.Format);
-
- ///
- public override int GetHashCode() => HashCode.Combine(this.Image, this.Format);
-
- ///
- /// Deconstructs into component parts.
- ///
- /// The .
- /// The .
- public void Deconstruct(out Image image, out IImageFormat format)
- {
- image = this.Image;
- format = this.Format;
- }
- }
-}
diff --git a/src/ImageSharp/Image.Decode.cs b/src/ImageSharp/Image.Decode.cs
index e3ef5cb53..6b6dc6e21 100644
--- a/src/ImageSharp/Image.Decode.cs
+++ b/src/ImageSharp/Image.Decode.cs
@@ -110,7 +110,7 @@ namespace SixLabors.ImageSharp
///
/// A new .
///
- private static FormattedImage Decode(Stream stream, Configuration config)
+ private static (Image Image, IImageFormat Format) Decode(Stream stream, Configuration config)
where TPixel : unmanaged, IPixel
{
IImageDecoder decoder = DiscoverDecoder(stream, config, out IImageFormat format);
@@ -120,7 +120,7 @@ namespace SixLabors.ImageSharp
}
Image img = decoder.Decode(config, stream);
- return new FormattedImage(img, format);
+ return (img, format);
}
///
@@ -129,10 +129,8 @@ namespace SixLabors.ImageSharp
/// The stream.
/// the configuration.
/// The pixel format.
- ///
- /// A new .
- ///
- private static async Task> DecodeAsync(Stream stream, Configuration config)
+ /// A representing the asynchronous operation.
+ private static async Task<(Image Image, IImageFormat Format)> DecodeAsync(Stream stream, Configuration config)
where TPixel : unmanaged, IPixel
{
IImageDecoder decoder = DiscoverDecoder(stream, config, out IImageFormat format);
@@ -142,10 +140,10 @@ namespace SixLabors.ImageSharp
}
Image img = await decoder.DecodeAsync(config, stream).ConfigureAwait(false);
- return new FormattedImage(img, format);
+ return (img, format);
}
- private static FormattedImage Decode(Stream stream, Configuration config)
+ private static (Image Image, IImageFormat Format) Decode(Stream stream, Configuration config)
{
IImageDecoder decoder = DiscoverDecoder(stream, config, out IImageFormat format);
if (decoder is null)
@@ -154,10 +152,10 @@ namespace SixLabors.ImageSharp
}
Image img = decoder.Decode(config, stream);
- return new FormattedImage(img, format);
+ return (img, format);
}
- private static async Task DecodeAsync(Stream stream, Configuration config)
+ private static async Task<(Image Image, IImageFormat Format)> DecodeAsync(Stream stream, Configuration config)
{
IImageDecoder decoder = DiscoverDecoder(stream, config, out IImageFormat format);
if (decoder is null)
@@ -166,7 +164,7 @@ namespace SixLabors.ImageSharp
}
Image img = await decoder.DecodeAsync(config, stream).ConfigureAwait(false);
- return new FormattedImage(img, format);
+ return (img, format);
}
///
@@ -175,9 +173,9 @@ namespace SixLabors.ImageSharp
/// The stream.
/// the configuration.
///
- /// The or null if suitable info detector not found.
+ /// The or null if a suitable info detector is not found.
///
- private static FormattedImageInfo InternalIdentity(Stream stream, Configuration config)
+ private static (IImageInfo ImageInfo, IImageFormat Format) InternalIdentity(Stream stream, Configuration config)
{
if (!(DiscoverDecoder(stream, config, out IImageFormat format) is IImageInfoDetector detector))
{
@@ -185,7 +183,7 @@ namespace SixLabors.ImageSharp
}
IImageInfo info = detector?.Identify(config, stream);
- return new FormattedImageInfo(info, format);
+ return (info, format);
}
///
@@ -194,9 +192,10 @@ namespace SixLabors.ImageSharp
/// The stream.
/// the configuration.
///
- /// The or null if suitable info detector not found.
- ///
- private static async Task InternalIdentityAsync(Stream stream, Configuration config)
+ /// A representing the asynchronous operation with the
+ /// property of the returned type set to null if a suitable detector
+ /// is not found.
+ private static async Task<(IImageInfo ImageInfo, IImageFormat Format)> InternalIdentityAsync(Stream stream, Configuration config)
{
if (!(DiscoverDecoder(stream, config, out IImageFormat format) is IImageInfoDetector detector))
{
@@ -209,7 +208,7 @@ namespace SixLabors.ImageSharp
}
IImageInfo info = await detector.IdentifyAsync(config, stream).ConfigureAwait(false);
- return new FormattedImageInfo(info, format);
+ return (info, format);
}
}
}
diff --git a/src/ImageSharp/Image.FromStream.cs b/src/ImageSharp/Image.FromStream.cs
index 4f1d5c194..5c64ae559 100644
--- a/src/ImageSharp/Image.FromStream.cs
+++ b/src/ImageSharp/Image.FromStream.cs
@@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp
/// The image stream to read the header from.
/// The stream is null.
/// The stream is not readable.
- /// The format type or null if none found.
+ /// A representing the asynchronous operation or null if none is found.
public static Task DetectFormatAsync(Stream stream)
=> DetectFormatAsync(Configuration.Default, stream);
@@ -56,7 +56,7 @@ namespace SixLabors.ImageSharp
/// The configuration is null.
/// The stream is null.
/// The stream is not readable.
- /// The format type or null if none found.
+ /// A representing the asynchronous operation.
public static Task DetectFormatAsync(Configuration configuration, Stream stream)
=> WithSeekableStreamAsync(
configuration,
@@ -71,7 +71,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The or null if suitable info detector not found.
+ /// The or null if a suitable info detector is not found.
///
public static IImageInfo Identify(Stream stream)
=> Identify(stream, out IImageFormat _);
@@ -84,7 +84,8 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The or null if suitable info detector not found.
+ /// A representing the asynchronous operation or null if
+ /// a suitable detector is not found.
///
public static Task IdentifyAsync(Stream stream)
=> IdentifyAsync(Configuration.Default, stream);
@@ -98,7 +99,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The or null if suitable info detector not found.
+ /// The or null if a suitable info detector is not found.
///
public static IImageInfo Identify(Stream stream, out IImageFormat format)
=> Identify(Configuration.Default, stream, out format);
@@ -113,7 +114,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The or null if suitable info detector is not found.
+ /// The or null if a suitable info detector is not found.
///
public static IImageInfo Identify(Configuration configuration, Stream stream)
=> Identify(configuration, stream, out _);
@@ -128,11 +129,12 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The or null if suitable info detector is not found.
+ /// A representing the asynchronous operation or null if
+ /// a suitable detector is not found.
///
public static async Task IdentifyAsync(Configuration configuration, Stream stream)
{
- FormattedImageInfo res = await IdentifyWithFormatAsync(configuration, stream).ConfigureAwait(false);
+ (IImageInfo ImageInfo, IImageFormat Format) res = await IdentifyWithFormatAsync(configuration, stream).ConfigureAwait(false);
return res.ImageInfo;
}
@@ -147,11 +149,11 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The or null if suitable info detector is not found.
+ /// The or null if a suitable info detector is not found.
///
public static IImageInfo Identify(Configuration configuration, Stream stream, out IImageFormat format)
{
- FormattedImageInfo data = WithSeekableStream(configuration, stream, s => InternalIdentity(s, configuration ?? Configuration.Default));
+ (IImageInfo ImageInfo, IImageFormat Format) data = WithSeekableStream(configuration, stream, s => InternalIdentity(s, configuration ?? Configuration.Default));
format = data.Format;
return data.ImageInfo;
@@ -166,9 +168,10 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The with set to null if suitable info detector is not found.
+ /// A representing the asynchronous operation or null if
+ /// a suitable detector is not found.
///
- public static Task IdentifyWithFormatAsync(Stream stream)
+ public static Task<(IImageInfo ImageInfo, IImageFormat Format)> IdentifyWithFormatAsync(Stream stream)
=> IdentifyWithFormatAsync(Configuration.Default, stream);
///
@@ -181,9 +184,10 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image contains invalid content.
///
- /// The with set to null if suitable info detector is not found.
+ /// The representing the asyncronous operation with the parameter type
+ /// property set to null if suitable info detector is not found.
///
- public static Task IdentifyWithFormatAsync(Configuration configuration, Stream stream)
+ public static Task<(IImageInfo ImageInfo, IImageFormat Format)> IdentifyWithFormatAsync(Configuration configuration, Stream stream)
=> WithSeekableStreamAsync(
configuration,
stream,
@@ -212,8 +216,8 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// A representing the asynchronous operation.
- public static Task LoadWithFormatAsync(Stream stream)
+ /// A representing the asynchronous operation.
+ public static Task<(Image Image, IImageFormat Format)> LoadWithFormatAsync(Stream stream)
=> LoadWithFormatAsync(Configuration.Default, stream);
///
@@ -237,7 +241,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// The .
+ /// A representing the asynchronous operation.
public static Task LoadAsync(Stream stream) => LoadAsync(Configuration.Default, stream);
///
@@ -266,7 +270,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// The .
+ /// A representing the asynchronous operation.
public static Task LoadAsync(Stream stream, IImageDecoder decoder)
=> LoadAsync(Configuration.Default, stream, decoder);
@@ -283,7 +287,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// A new .>
+ /// A new .
public static Image Load(Configuration configuration, Stream stream, IImageDecoder decoder)
{
Guard.NotNull(decoder, nameof(decoder));
@@ -303,7 +307,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// A new .>
+ /// A representing the asynchronous operation.
public static Task LoadAsync(Configuration configuration, Stream stream, IImageDecoder decoder)
{
Guard.NotNull(decoder, nameof(decoder));
@@ -323,7 +327,7 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// A new .>
+ /// A new .
public static Image Load(Configuration configuration, Stream stream) => Load(configuration, stream, out _);
///
@@ -336,10 +340,10 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// A new .>
+ /// A representing the asynchronous operation.
public static async Task LoadAsync(Configuration configuration, Stream stream)
{
- FormattedImage fmt = await LoadWithFormatAsync(configuration, stream).ConfigureAwait(false);
+ (Image Image, IImageFormat Format) fmt = await LoadWithFormatAsync(configuration, stream).ConfigureAwait(false);
return fmt.Image;
}
@@ -352,7 +356,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A new .
public static Image Load(Stream stream)
where TPixel : unmanaged, IPixel
=> Load(Configuration.Default, stream);
@@ -366,7 +370,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A representing the asynchronous operation.
public static Task> LoadAsync(Stream stream)
where TPixel : unmanaged, IPixel
=> LoadAsync(Configuration.Default, stream);
@@ -381,7 +385,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A new .
public static Image Load(Stream stream, out IImageFormat format)
where TPixel : unmanaged, IPixel
=> Load(Configuration.Default, stream, out format);
@@ -395,8 +399,8 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A representing the asynchronous operation.
- public static async Task> LoadWithFormatAsync(Stream stream)
+ /// A representing the asynchronous operation.
+ public static async Task<(Image Image, IImageFormat Format)> LoadWithFormatAsync(Stream stream)
where TPixel : unmanaged, IPixel
=> await LoadWithFormatAsync(Configuration.Default, stream).ConfigureAwait(false);
@@ -410,7 +414,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A new .
public static Image Load(Stream stream, IImageDecoder decoder)
where TPixel : unmanaged, IPixel
=> WithSeekableStream(Configuration.Default, stream, s => decoder.Decode(Configuration.Default, s));
@@ -425,7 +429,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A representing the asynchronous operation.
public static Task> LoadAsync(Stream stream, IImageDecoder decoder)
where TPixel : unmanaged, IPixel
=> WithSeekableStreamAsync(
@@ -445,7 +449,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A new .
public static Image Load(Configuration configuration, Stream stream, IImageDecoder decoder)
where TPixel : unmanaged, IPixel
=> WithSeekableStream(configuration, stream, s => decoder.Decode(configuration, s));
@@ -462,7 +466,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A representing the asynchronous operation.
public static Task> LoadAsync(Configuration configuration, Stream stream, IImageDecoder decoder)
where TPixel : unmanaged, IPixel
=> WithSeekableStreamAsync(
@@ -481,7 +485,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .>
+ /// A new .
public static Image Load(Configuration configuration, Stream stream)
where TPixel : unmanaged, IPixel
=> Load(configuration, stream, out IImageFormat _);
@@ -498,17 +502,17 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .
+ /// A representing the asynchronous operation.
public static Image Load(Configuration configuration, Stream stream, out IImageFormat format)
where TPixel : unmanaged, IPixel
{
- (Image img, IImageFormat format) data = WithSeekableStream(configuration, stream, s => Decode(s, configuration));
+ (Image Image, IImageFormat Format) data = WithSeekableStream(configuration, stream, s => Decode(s, configuration));
- format = data.format;
+ format = data.Format;
- if (data.img != null)
+ if (data.Image != null)
{
- return data.img;
+ return data.Image;
}
var sb = new StringBuilder();
@@ -532,16 +536,16 @@ namespace SixLabors.ImageSharp
/// The stream is not readable.
/// Image format not recognised.
/// Image contains invalid content.
- /// A new .
- public static async Task LoadWithFormatAsync(Configuration configuration, Stream stream)
+ /// A representing the asynchronous operation.
+ public static async Task<(Image Image, IImageFormat Format)> LoadWithFormatAsync(Configuration configuration, Stream stream)
{
- (Image img, IImageFormat format) data = await WithSeekableStreamAsync(
+ (Image Image, IImageFormat Format) data = await WithSeekableStreamAsync(
configuration,
stream,
async s => await DecodeAsync(s, configuration).ConfigureAwait(false))
.ConfigureAwait(false);
- if (data.img != null)
+ if (data.Image != null)
{
return data;
}
@@ -568,18 +572,18 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .
- public static async Task> LoadWithFormatAsync(Configuration configuration, Stream stream)
+ /// A representing the asynchronous operation.
+ public static async Task<(Image Image, IImageFormat Format)> LoadWithFormatAsync(Configuration configuration, Stream stream)
where TPixel : unmanaged, IPixel
{
- (Image img, IImageFormat format) data =
+ (Image Image, IImageFormat Format) data =
await WithSeekableStreamAsync(
configuration,
stream,
s => DecodeAsync(s, configuration))
.ConfigureAwait(false);
- if (data.img != null)
+ if (data.Image != null)
{
return data;
}
@@ -606,7 +610,7 @@ namespace SixLabors.ImageSharp
/// Image format not recognised.
/// Image contains invalid content.
/// The pixel format.
- /// A new .
+ /// A representing the asynchronous operation.
public static async Task> LoadAsync(Configuration configuration, Stream stream)
where TPixel : unmanaged, IPixel
{
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs b/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs
index 35e20dc0d..69b1d21a6 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs
@@ -133,7 +133,7 @@ namespace SixLabors.ImageSharp.Tests
using (var stream = new MemoryStream(this.ActualImageBytes))
{
var asyncStream = new AsyncStreamWrapper(stream, () => false);
- FormattedImageInfo info = await Image.IdentifyWithFormatAsync(asyncStream);
+ (IImageInfo ImageInfo, IImageFormat Format) info = await Image.IdentifyWithFormatAsync(asyncStream);
Assert.NotNull(info.ImageInfo);
Assert.Equal(ExpectedGlobalFormat, info.Format);
@@ -144,7 +144,7 @@ namespace SixLabors.ImageSharp.Tests
public async Task FromStreamAsync_CustomConfiguration()
{
var asyncStream = new AsyncStreamWrapper(this.DataStream, () => false);
- FormattedImageInfo info = await Image.IdentifyWithFormatAsync(this.LocalConfiguration, asyncStream);
+ (IImageInfo ImageInfo, IImageFormat Format) info = await Image.IdentifyWithFormatAsync(this.LocalConfiguration, asyncStream);
Assert.Equal(this.LocalImageInfo, info.ImageInfo);
Assert.Equal(this.LocalImageFormat, info.Format);
@@ -154,7 +154,7 @@ namespace SixLabors.ImageSharp.Tests
public async Task WhenNoMatchingFormatFoundAsync_ReturnsNull()
{
var asyncStream = new AsyncStreamWrapper(this.DataStream, () => false);
- FormattedImageInfo info = await Image.IdentifyWithFormatAsync(new Configuration(), asyncStream);
+ (IImageInfo ImageInfo, IImageFormat Format) info = await Image.IdentifyWithFormatAsync(new Configuration(), asyncStream);
Assert.Null(info.ImageInfo);
}
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs b/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs
index 0aba932ce..4a6c96ae8 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs
@@ -1,5 +1,5 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the GNU Affero General Public License, Version 3.
+// Copyright (c) Six Labors.
+// Licensed under the Apache License, Version 2.0.
using System;
using System.IO;
@@ -13,7 +13,6 @@ using Xunit;
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests
{
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats;
@@ -27,7 +26,7 @@ namespace SixLabors.ImageSharp.Tests
public async Task DetectedEncoding()
{
string dir = TestEnvironment.CreateOutputDirectory(nameof(ImageTests));
- string file = System.IO.Path.Combine(dir, "DetectedEncodingAsync.png");
+ string file = Path.Combine(dir, "DetectedEncodingAsync.png");
using (var image = new Image(10, 10))
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/AsyncStreamWrapper.cs b/tests/ImageSharp.Tests/TestUtilities/AsyncStreamWrapper.cs
index 3d23a3c3b..2000c6e0c 100644
--- a/tests/ImageSharp.Tests/TestUtilities/AsyncStreamWrapper.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/AsyncStreamWrapper.cs
@@ -1,10 +1,8 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the GNU Affero General Public License, Version 3.
+// Copyright (c) Six Labors.
+// Licensed under the Apache License, Version 2.0.
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;