diff --git a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
index 10267c8ef7..f7fb0948fc 100644
--- a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
+++ b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
@@ -21,8 +21,8 @@ public static class AdvancedImageExtensions
/// The target file path to save the image to.
/// The file path is null.
/// No encoder available for provided path.
- /// The matching .
- public static IImageEncoder DetectEncoder(this Image source, string filePath)
+ /// The matching .
+ public static ImageEncoder DetectEncoder(this Image source, string filePath)
{
Guard.NotNull(filePath, nameof(filePath));
@@ -40,13 +40,13 @@ public static class AdvancedImageExtensions
throw new NotSupportedException(sb.ToString());
}
- IImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
+ ImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
if (encoder is null)
{
StringBuilder sb = new();
sb.AppendLine(CultureInfo.InvariantCulture, $"No encoder was found for extension '{ext}' using image format '{format.Name}'. Registered encoders include:");
- foreach (KeyValuePair enc in source.GetConfiguration().ImageFormatsManager.ImageEncoders)
+ foreach (KeyValuePair enc in source.GetConfiguration().ImageFormatsManager.ImageEncoders)
{
sb.AppendFormat(CultureInfo.InvariantCulture, " - {0} : {1}{2}", enc.Key, enc.Value.GetType().Name, Environment.NewLine);
}
diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs
index 4ac95be9ab..be0d057b26 100644
--- a/src/ImageSharp/Advanced/AotCompilerTools.cs
+++ b/src/ImageSharp/Advanced/AotCompilerTools.cs
@@ -230,7 +230,7 @@ internal static class AotCompilerTools
}
///
- /// This method pre-seeds the all in the AoT compiler.
+ /// This method pre-seeds the all in the AoT compiler.
///
/// The pixel format.
[Preserve]
@@ -266,14 +266,14 @@ internal static class AotCompilerTools
}
///
- /// This method pre-seeds the in the AoT compiler.
+ /// This method pre-seeds the in the AoT compiler.
///
/// The pixel format.
/// The encoder.
[Preserve]
private static void AotCompileImageEncoder()
where TPixel : unmanaged, IPixel
- where TEncoder : class, IImageEncoder
+ where TEncoder : ImageEncoder
{
default(TEncoder).Encode(default, default);
default(TEncoder).EncodeAsync(default, default, default);
diff --git a/src/ImageSharp/Formats/IImageEncoder.cs b/src/ImageSharp/Formats/IImageEncoder.cs
deleted file mode 100644
index 112c38bd5a..0000000000
--- a/src/ImageSharp/Formats/IImageEncoder.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) Six Labors.
-// Licensed under the Six Labors Split License.
-
-using SixLabors.ImageSharp.PixelFormats;
-
-namespace SixLabors.ImageSharp.Formats;
-
-///
-/// Encapsulates properties and methods required for encoding an image to a stream.
-///
-public interface IImageEncoder
-{
- ///
- /// Encodes the image to the specified stream from the .
- ///
- /// The pixel format.
- /// The to encode from.
- /// The to encode the image data to.
- void Encode(Image image, Stream stream)
- where TPixel : unmanaged, IPixel;
-
- ///
- /// Encodes the image to the specified stream from the .
- ///
- /// The pixel format.
- /// The to encode from.
- /// The to encode the image data to.
- /// The token to monitor for cancellation requests.
- /// A representing the asynchronous operation.
- Task EncodeAsync(Image image, Stream stream, CancellationToken cancellationToken)
- where TPixel : unmanaged, IPixel;
-}
diff --git a/src/ImageSharp/Formats/ImageEncoder.cs b/src/ImageSharp/Formats/ImageEncoder.cs
index a0c087e646..c887e7b0b2 100644
--- a/src/ImageSharp/Formats/ImageEncoder.cs
+++ b/src/ImageSharp/Formats/ImageEncoder.cs
@@ -10,18 +10,30 @@ namespace SixLabors.ImageSharp.Formats;
///
/// The base class for all image encoders.
///
-public abstract class ImageEncoder : IImageEncoder
+public abstract class ImageEncoder
{
///
/// Gets a value indicating whether to ignore decoded metadata when encoding.
///
public bool SkipMetadata { get; init; }
- ///
+ ///
+ /// Encodes the image to the specified stream from the .
+ ///
+ /// The pixel format.
+ /// The to encode from.
+ /// The to encode the image data to.
public abstract void Encode(Image image, Stream stream)
where TPixel : unmanaged, IPixel;
- ///
+ ///
+ /// Encodes the image to the specified stream from the .
+ ///
+ /// The pixel format.
+ /// The to encode from.
+ /// The to encode the image data to.
+ /// The token to monitor for cancellation requests.
+ /// A representing the asynchronous operation.
public abstract Task EncodeAsync(Image image, Stream stream, CancellationToken cancellationToken)
where TPixel : unmanaged, IPixel;
}
diff --git a/src/ImageSharp/Formats/ImageFormatManager.cs b/src/ImageSharp/Formats/ImageFormatManager.cs
index 922018456b..efa6c435a8 100644
--- a/src/ImageSharp/Formats/ImageFormatManager.cs
+++ b/src/ImageSharp/Formats/ImageFormatManager.cs
@@ -17,9 +17,9 @@ public class ImageFormatManager
private static readonly object HashLock = new();
///
- /// The list of supported keyed to mime types.
+ /// The list of supported keyed to mime types.
///
- private readonly ConcurrentDictionary mimeTypeEncoders = new();
+ private readonly ConcurrentDictionary mimeTypeEncoders = new();
///
/// The list of supported keyed to mime types.
@@ -64,9 +64,9 @@ public class ImageFormatManager
internal IEnumerable> ImageDecoders => this.mimeTypeDecoders;
///
- /// Gets the currently registered s.
+ /// Gets the currently registered s.
///
- internal IEnumerable> ImageEncoders => this.mimeTypeEncoders;
+ internal IEnumerable> ImageEncoders => this.mimeTypeEncoders;
///
/// Registers a new format provider.
@@ -117,7 +117,7 @@ public class ImageFormatManager
///
/// The image format to register the encoder for.
/// The encoder to use,
- public void SetEncoder(IImageFormat imageFormat, IImageEncoder encoder)
+ public void SetEncoder(IImageFormat imageFormat, ImageEncoder encoder)
{
Guard.NotNull(imageFormat, nameof(imageFormat));
Guard.NotNull(encoder, nameof(encoder));
@@ -172,12 +172,12 @@ public class ImageFormatManager
/// For the specified mime type find the encoder.
///
/// The format to discover
- /// The if found otherwise null
- public IImageEncoder FindEncoder(IImageFormat format)
+ /// The if found otherwise null
+ public ImageEncoder FindEncoder(IImageFormat format)
{
Guard.NotNull(format, nameof(format));
- return this.mimeTypeEncoders.TryGetValue(format, out IImageEncoder encoder)
+ return this.mimeTypeEncoders.TryGetValue(format, out ImageEncoder encoder)
? encoder
: null;
}
diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs
index 91c96b55f6..f2a534b5d6 100644
--- a/src/ImageSharp/Image.cs
+++ b/src/ImageSharp/Image.cs
@@ -96,7 +96,7 @@ public abstract partial class Image : IImage, IConfigurationProvider
/// The stream to save the image to.
/// The encoder to save the image with.
/// Thrown if the stream or encoder is null.
- public void Save(Stream stream, IImageEncoder encoder)
+ public void Save(Stream stream, ImageEncoder encoder)
{
Guard.NotNull(stream, nameof(stream));
Guard.NotNull(encoder, nameof(encoder));
@@ -113,7 +113,7 @@ public abstract partial class Image : IImage, IConfigurationProvider
/// The token to monitor for cancellation requests.
/// Thrown if the stream or encoder is null.
/// A representing the asynchronous operation.
- public Task SaveAsync(Stream stream, IImageEncoder encoder, CancellationToken cancellationToken = default)
+ public Task SaveAsync(Stream stream, ImageEncoder encoder, CancellationToken cancellationToken = default)
{
Guard.NotNull(stream, nameof(stream));
Guard.NotNull(encoder, nameof(encoder));
@@ -184,11 +184,11 @@ public abstract partial class Image : IImage, IConfigurationProvider
private class EncodeVisitor : IImageVisitor, IImageVisitorAsync
{
- private readonly IImageEncoder encoder;
+ private readonly ImageEncoder encoder;
private readonly Stream stream;
- public EncodeVisitor(IImageEncoder encoder, Stream stream)
+ public EncodeVisitor(ImageEncoder encoder, Stream stream)
{
this.encoder = encoder;
this.stream = stream;
diff --git a/src/ImageSharp/ImageExtensions.cs b/src/ImageSharp/ImageExtensions.cs
index e79fceeaa0..d12c483450 100644
--- a/src/ImageSharp/ImageExtensions.cs
+++ b/src/ImageSharp/ImageExtensions.cs
@@ -43,7 +43,7 @@ public static partial class ImageExtensions
/// The encoder to save the image with.
/// The path is null.
/// The encoder is null.
- public static void Save(this Image source, string path, IImageEncoder encoder)
+ public static void Save(this Image source, string path, ImageEncoder encoder)
{
Guard.NotNull(path, nameof(path));
Guard.NotNull(encoder, nameof(encoder));
@@ -66,16 +66,14 @@ public static partial class ImageExtensions
public static async Task SaveAsync(
this Image source,
string path,
- IImageEncoder encoder,
+ ImageEncoder encoder,
CancellationToken cancellationToken = default)
{
Guard.NotNull(path, nameof(path));
Guard.NotNull(encoder, nameof(encoder));
- using (Stream fs = source.GetConfiguration().FileSystem.Create(path))
- {
- await source.SaveAsync(fs, encoder, cancellationToken).ConfigureAwait(false);
- }
+ using Stream fs = source.GetConfiguration().FileSystem.Create(path);
+ await source.SaveAsync(fs, encoder, cancellationToken).ConfigureAwait(false);
}
///
@@ -98,14 +96,14 @@ public static partial class ImageExtensions
throw new NotSupportedException("Cannot write to the stream.");
}
- IImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
+ ImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
if (encoder is null)
{
StringBuilder sb = new();
sb.AppendLine("No encoder was found for the provided mime type. Registered encoders include:");
- foreach (KeyValuePair val in source.GetConfiguration().ImageFormatsManager.ImageEncoders)
+ foreach (KeyValuePair val in source.GetConfiguration().ImageFormatsManager.ImageEncoders)
{
sb.AppendFormat(CultureInfo.InvariantCulture, " - {0} : {1}{2}", val.Key.Name, val.Value.GetType().Name, Environment.NewLine);
}
@@ -142,14 +140,14 @@ public static partial class ImageExtensions
throw new NotSupportedException("Cannot write to the stream.");
}
- IImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
+ ImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
if (encoder is null)
{
StringBuilder sb = new();
sb.AppendLine("No encoder was found for the provided mime type. Registered encoders include:");
- foreach (KeyValuePair val in source.GetConfiguration().ImageFormatsManager.ImageEncoders)
+ foreach (KeyValuePair val in source.GetConfiguration().ImageFormatsManager.ImageEncoders)
{
sb.AppendFormat(CultureInfo.InvariantCulture, " - {0} : {1}{2}", val.Key.Name, val.Value.GetType().Name, Environment.NewLine);
}
diff --git a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs
index c982979ff6..277863a582 100644
--- a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs
+++ b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs
@@ -56,7 +56,7 @@ public class ImageFormatManagerTests
[Fact]
public void RegisterNullMimeTypeEncoder()
{
- Assert.Throws(() => this.DefaultFormatsManager.SetEncoder(null, new Mock().Object));
+ Assert.Throws(() => this.DefaultFormatsManager.SetEncoder(null, new Mock().Object));
Assert.Throws(() => this.DefaultFormatsManager.SetEncoder(BmpFormat.Instance, null));
Assert.Throws(() => this.DefaultFormatsManager.SetEncoder(null, null));
}
@@ -72,14 +72,14 @@ public class ImageFormatManagerTests
[Fact]
public void RegisterMimeTypeEncoderReplacesLast()
{
- IImageEncoder encoder1 = new Mock().Object;
+ ImageEncoder encoder1 = new Mock().Object;
this.FormatsManagerEmpty.SetEncoder(TestFormat.GlobalTestFormat, encoder1);
- IImageEncoder found = this.FormatsManagerEmpty.FindEncoder(TestFormat.GlobalTestFormat);
+ ImageEncoder found = this.FormatsManagerEmpty.FindEncoder(TestFormat.GlobalTestFormat);
Assert.Equal(encoder1, found);
- IImageEncoder encoder2 = new Mock().Object;
+ ImageEncoder encoder2 = new Mock().Object;
this.FormatsManagerEmpty.SetEncoder(TestFormat.GlobalTestFormat, encoder2);
- IImageEncoder found2 = this.FormatsManagerEmpty.FindEncoder(TestFormat.GlobalTestFormat);
+ ImageEncoder found2 = this.FormatsManagerEmpty.FindEncoder(TestFormat.GlobalTestFormat);
Assert.Equal(encoder2, found2);
Assert.NotEqual(found, found2);
}
diff --git a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs
index a3f03bed5a..e59f4337a4 100644
--- a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs
+++ b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs
@@ -16,8 +16,8 @@ public class ImageSaveTests : IDisposable
{
private readonly Image image;
private readonly Mock fileSystem;
- private readonly Mock encoder;
- private readonly Mock encoderNotInFormat;
+ private readonly Mock encoder;
+ private readonly Mock encoderNotInFormat;
private IImageFormatDetector localMimeTypeDetector;
private Mock localImageFormat;
@@ -27,9 +27,9 @@ public class ImageSaveTests : IDisposable
this.localImageFormat.Setup(x => x.FileExtensions).Returns(new[] { "png" });
this.localMimeTypeDetector = new MockImageFormatDetector(this.localImageFormat.Object);
- this.encoder = new Mock();
+ this.encoder = new Mock();
- this.encoderNotInFormat = new Mock();
+ this.encoderNotInFormat = new Mock();
this.fileSystem = new Mock();
var config = new Configuration
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Save.cs b/tests/ImageSharp.Tests/Image/ImageTests.Save.cs
index 88a6b5890b..576af74fa5 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.Save.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.Save.cs
@@ -68,7 +68,7 @@ public partial class ImageTests
{
using var image = new Image(5, 5);
image.Dispose();
- IImageEncoder encoder = Mock.Of();
+ ImageEncoder encoder = Mock.Of();
using (var stream = new MemoryStream())
{
Assert.Throws(() => image.Save(stream, encoder));
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs b/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs
index 1ceadb964d..ec16225744 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs
@@ -102,7 +102,7 @@ public partial class ImageTests
{
var image = new Image(5, 5);
image.Dispose();
- IImageEncoder encoder = Mock.Of();
+ ImageEncoder encoder = Mock.Of();
using (var stream = new MemoryStream())
{
await Assert.ThrowsAsync(async () => await image.SaveAsync(stream, encoder));
@@ -120,7 +120,7 @@ public partial class ImageTests
{
using (var image = new Image(5, 5))
{
- IImageEncoder encoder = image.DetectEncoder(filename);
+ ImageEncoder encoder = image.DetectEncoder(filename);
using (var stream = new MemoryStream())
{
var asyncStream = new AsyncStreamWrapper(stream, () => false);
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.cs b/tests/ImageSharp.Tests/Image/ImageTests.cs
index 02ccfb713b..def1403fda 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.cs
@@ -328,7 +328,7 @@ public partial class ImageTests
public void KnownExtension_ReturnsEncoder()
{
using var image = new Image(1, 1);
- IImageEncoder encoder = image.DetectEncoder("dummy.png");
+ ImageEncoder encoder = image.DetectEncoder("dummy.png");
Assert.NotNull(encoder);
Assert.IsType(encoder);
}
diff --git a/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs b/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs
index b65719228c..2bbf12bdf8 100644
--- a/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs
+++ b/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs
@@ -55,7 +55,7 @@ public class LargeImageIntegrationTests
Configuration configuration = Configuration.Default.Clone();
configuration.PreferContiguousImageBuffers = true;
- IImageEncoder encoder = configuration.ImageFormatsManager.FindEncoder(
+ ImageEncoder encoder = configuration.ImageFormatsManager.FindEncoder(
configuration.ImageFormatsManager.FindFormatByFileExtension(formatInner));
string dir = TestEnvironment.CreateOutputDirectory(".Temp");
string path = Path.Combine(dir, $"{Guid.NewGuid()}.{formatInner}");
diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs
index 8ef31a2af2..092698cb26 100644
--- a/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs
+++ b/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs
@@ -242,7 +242,7 @@ public class XmpProfileTests
return profile;
}
- private static Image WriteAndRead(Image image, IImageEncoder encoder)
+ private static Image WriteAndRead(Image image, ImageEncoder encoder)
{
using (var memStream = new MemoryStream())
{
diff --git a/tests/ImageSharp.Tests/TestFormat.cs b/tests/ImageSharp.Tests/TestFormat.cs
index cecde5ddb5..99b522a4fe 100644
--- a/tests/ImageSharp.Tests/TestFormat.cs
+++ b/tests/ImageSharp.Tests/TestFormat.cs
@@ -233,7 +233,7 @@ public class TestFormat : IConfigurationModule, IImageFormat
public DecoderOptions GeneralOptions { get; set; } = new();
}
- public class TestEncoder : IImageEncoder
+ public class TestEncoder : ImageEncoder
{
private readonly TestFormat testFormat;
@@ -243,14 +243,13 @@ public class TestFormat : IConfigurationModule, IImageFormat
public IEnumerable FileExtensions => this.testFormat.SupportedExtensions;
- public void Encode(Image image, Stream stream)
- where TPixel : unmanaged, IPixel
+ public override void Encode(Image image, Stream stream)
{
// TODO record this happened so we can verify it.
}
- public Task EncodeAsync(Image image, Stream stream, CancellationToken cancellationToken)
- where TPixel : unmanaged, IPixel => Task.CompletedTask; // TODO record this happened so we can verify it.
+ public override Task EncodeAsync(Image image, Stream stream, CancellationToken cancellationToken)
+ => Task.CompletedTask; // TODO record this happened so we can verify it.
}
public struct TestPixelForAgnosticDecode : IPixel
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs
index 460ecac85a..c4f26b0f61 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs
@@ -158,7 +158,7 @@ public class ImagingTestCaseUtility
public string SaveTestOutputFile(
Image image,
string extension = null,
- IImageEncoder encoder = null,
+ ImageEncoder encoder = null,
object testOutputDetails = null,
bool appendPixelTypeToFileName = true,
bool appendSourceFileOrDescription = true)
@@ -203,7 +203,7 @@ public class ImagingTestCaseUtility
public string[] SaveTestOutputFileMultiFrame(
Image image,
string extension = "png",
- IImageEncoder encoder = null,
+ ImageEncoder encoder = null,
object testOutputDetails = null,
bool appendPixelTypeToFileName = true)
where TPixel : unmanaged, IPixel
diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs
index af13d64ce2..954ec2ffae 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs
@@ -3,34 +3,27 @@
using System.Drawing.Imaging;
using SixLabors.ImageSharp.Formats;
-using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
-public class SystemDrawingReferenceEncoder : IImageEncoder
+public class SystemDrawingReferenceEncoder : ImageEncoder
{
- private readonly System.Drawing.Imaging.ImageFormat imageFormat;
+ private readonly ImageFormat imageFormat;
public SystemDrawingReferenceEncoder(ImageFormat imageFormat)
- {
- this.imageFormat = imageFormat;
- }
+ => this.imageFormat = imageFormat;
public static SystemDrawingReferenceEncoder Png { get; } = new SystemDrawingReferenceEncoder(ImageFormat.Png);
public static SystemDrawingReferenceEncoder Bmp { get; } = new SystemDrawingReferenceEncoder(ImageFormat.Bmp);
- public void Encode(Image image, Stream stream)
- where TPixel : unmanaged, IPixel
+ public override void Encode(Image image, Stream stream)
{
- using (System.Drawing.Bitmap sdBitmap = SystemDrawingBridge.To32bppArgbSystemDrawingBitmap(image))
- {
- sdBitmap.Save(stream, this.imageFormat);
- }
+ using System.Drawing.Bitmap sdBitmap = SystemDrawingBridge.To32bppArgbSystemDrawingBitmap(image);
+ sdBitmap.Save(stream, this.imageFormat);
}
- public Task EncodeAsync(Image image, Stream stream, CancellationToken cancellationToken)
- where TPixel : unmanaged, IPixel
+ public override Task EncodeAsync(Image image, Stream stream, CancellationToken cancellationToken)
{
using (System.Drawing.Bitmap sdBitmap = SystemDrawingBridge.To32bppArgbSystemDrawingBitmap(image))
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs
index dbbf16ef22..fb76d3b68a 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs
@@ -26,7 +26,7 @@ public static partial class TestEnvironment
return Configuration.ImageFormatsManager.FindDecoder(format);
}
- internal static IImageEncoder GetReferenceEncoder(string filePath)
+ internal static ImageEncoder GetReferenceEncoder(string filePath)
{
IImageFormat format = GetImageFormat(filePath);
return Configuration.ImageFormatsManager.FindEncoder(format);
@@ -43,7 +43,7 @@ public static partial class TestEnvironment
this Configuration cfg,
IImageFormat imageFormat,
ImageDecoder decoder,
- IImageEncoder encoder,
+ ImageEncoder encoder,
IImageFormatDetector detector)
{
cfg.ImageFormatsManager.SetDecoder(imageFormat, decoder);
@@ -61,8 +61,8 @@ public static partial class TestEnvironment
new WebpConfigurationModule(),
new TiffConfigurationModule());
- IImageEncoder pngEncoder = IsWindows ? SystemDrawingReferenceEncoder.Png : new ImageSharpPngEncoderWithDefaultConfiguration();
- IImageEncoder bmpEncoder = IsWindows ? SystemDrawingReferenceEncoder.Bmp : new BmpEncoder();
+ ImageEncoder pngEncoder = IsWindows ? SystemDrawingReferenceEncoder.Png : new ImageSharpPngEncoderWithDefaultConfiguration();
+ ImageEncoder bmpEncoder = IsWindows ? SystemDrawingReferenceEncoder.Bmp : new BmpEncoder();
// Magick codecs should work on all platforms
cfg.ConfigureCodecs(
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
index 92314ffb2d..d6a025fc45 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
@@ -19,6 +19,7 @@ public static class TestImageExtensions
///
/// TODO: Consider adding this private processor to the library
///
+ /// The image processing context.
public static void MakeOpaque(this IImageProcessingContext ctx) =>
ctx.ApplyProcessor(new MakeOpaqueProcessor());
@@ -29,7 +30,7 @@ public static class TestImageExtensions
string extension = "png",
bool appendPixelTypeToFileName = true,
bool appendSourceFileOrDescription = true,
- IImageEncoder encoder = null)
+ ImageEncoder encoder = null)
=> image.DebugSave(
provider,
(object)testOutputDetails,
@@ -56,7 +57,7 @@ public static class TestImageExtensions
string extension = "png",
bool appendPixelTypeToFileName = true,
bool appendSourceFileOrDescription = true,
- IImageEncoder encoder = null)
+ ImageEncoder encoder = null)
{
if (TestEnvironment.RunsWithCodeCoverage)
{
@@ -76,7 +77,7 @@ public static class TestImageExtensions
public static void DebugSave(
this Image image,
ITestImageProvider provider,
- IImageEncoder encoder,
+ ImageEncoder encoder,
FormattableString testOutputDetails,
bool appendPixelTypeToFileName = true)
=> image.DebugSave(provider, encoder, (object)testOutputDetails, appendPixelTypeToFileName);
@@ -92,7 +93,7 @@ public static class TestImageExtensions
public static void DebugSave(
this Image image,
ITestImageProvider provider,
- IImageEncoder encoder,
+ ImageEncoder encoder,
object testOutputDetails = null,
bool appendPixelTypeToFileName = true)
=> provider.Utility.SaveTestOutputFile(
@@ -663,7 +664,7 @@ public static class TestImageExtensions
ITestImageProvider provider,
string extension,
object testOutputDetails,
- IImageEncoder encoder,
+ ImageEncoder encoder,
ImageComparer customComparer = null,
bool appendPixelTypeToFileName = true,
string referenceImageExtension = null,
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
index f6b6757c4a..fc900aa903 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
@@ -62,7 +62,7 @@ public class TestEnvironmentTests
return;
}
- IImageEncoder encoder = TestEnvironment.GetReferenceEncoder(fileName);
+ ImageEncoder encoder = TestEnvironment.GetReferenceEncoder(fileName);
Assert.IsType(expectedEncoderType, encoder);
}
@@ -96,7 +96,7 @@ public class TestEnvironmentTests
return;
}
- IImageEncoder encoder = TestEnvironment.GetReferenceEncoder(fileName);
+ ImageEncoder encoder = TestEnvironment.GetReferenceEncoder(fileName);
Assert.IsType(expectedEncoderType, encoder);
}