diff --git a/Directory.Build.targets b/Directory.Build.targets
index eb0764d89..e5c44f776 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -23,10 +23,12 @@
-
+
-
+
+
+
diff --git a/GitVersion.yml b/GitVersion.yml
index 0cd51a4ad..f2a251c55 100644
--- a/GitVersion.yml
+++ b/GitVersion.yml
@@ -2,5 +2,6 @@ continuous-delivery-fallback-tag: ci
branches:
master:
tag: unstable
+ mode: ContinuousDeployment
pull-request:
tag: pr
diff --git a/ci-test.ps1 b/ci-test.ps1
index fc368b22f..35a9b4646 100644
--- a/ci-test.ps1
+++ b/ci-test.ps1
@@ -34,8 +34,4 @@ elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) {
else {
dotnet test --no-build -c Release -f $targetFramework
-}
-
-# Explicitly exit with 0 to ignore errors caused by coverlet attempting to read
-# project files that dotnet test is set to ignore.
-exit 0
+}
\ No newline at end of file
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index c0e01ae58..68d4f8949 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -50,6 +50,6 @@
-
+
diff --git a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
index 22e6d47e9..9bf8943b7 100644
--- a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
+++ b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
@@ -6,7 +6,6 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Advanced
{
diff --git a/src/ImageSharp/Advanced/ParallelUtils/ParallelExecutionSettings.cs b/src/ImageSharp/Advanced/ParallelUtils/ParallelExecutionSettings.cs
index 431656ef9..f17d70a2a 100644
--- a/src/ImageSharp/Advanced/ParallelUtils/ParallelExecutionSettings.cs
+++ b/src/ImageSharp/Advanced/ParallelUtils/ParallelExecutionSettings.cs
@@ -4,7 +4,7 @@
using System;
using System.Threading.Tasks;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Advanced.ParallelUtils
{
diff --git a/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs b/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs
index c56337bff..4833dbafd 100644
--- a/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs
+++ b/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs
@@ -7,8 +7,6 @@ using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Advanced.ParallelUtils
{
diff --git a/src/ImageSharp/Common/Extensions/StreamExtensions.cs b/src/ImageSharp/Common/Extensions/StreamExtensions.cs
index cee3e2414..971bff322 100644
--- a/src/ImageSharp/Common/Extensions/StreamExtensions.cs
+++ b/src/ImageSharp/Common/Extensions/StreamExtensions.cs
@@ -5,7 +5,6 @@ using System;
using System.Buffers;
using System.IO;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Common/Helpers/Buffer2DUtils.cs b/src/ImageSharp/Common/Helpers/Buffer2DUtils.cs
index b678e798f..f82774601 100644
--- a/src/ImageSharp/Common/Helpers/Buffer2DUtils.cs
+++ b/src/ImageSharp/Common/Helpers/Buffer2DUtils.cs
@@ -8,7 +8,6 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Common/Helpers/DenseMatrixUtils.cs b/src/ImageSharp/Common/Helpers/DenseMatrixUtils.cs
index c5c9ddebe..ff6e3a4ec 100644
--- a/src/ImageSharp/Common/Helpers/DenseMatrixUtils.cs
+++ b/src/ImageSharp/Common/Helpers/DenseMatrixUtils.cs
@@ -6,7 +6,6 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs
index 122952cae..e7b14be42 100644
--- a/src/ImageSharp/Common/Helpers/ImageMaths.cs
+++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs
@@ -6,7 +6,6 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Common/Helpers/Vector4Utils.cs b/src/ImageSharp/Common/Helpers/Vector4Utils.cs
index a4e0921d0..594a5ff10 100644
--- a/src/ImageSharp/Common/Helpers/Vector4Utils.cs
+++ b/src/ImageSharp/Common/Helpers/Vector4Utils.cs
@@ -5,7 +5,6 @@ using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs
index 4dba7a7e8..9f26df300 100644
--- a/src/ImageSharp/Configuration.cs
+++ b/src/ImageSharp/Configuration.cs
@@ -10,8 +10,8 @@ using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Formats.Tga;
using SixLabors.ImageSharp.IO;
+using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
index eda5f1f78..8d82d28fb 100644
--- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
@@ -11,7 +11,6 @@ using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Bmp
{
diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
index 41be71d2b..1c7c606ca 100644
--- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
@@ -12,7 +12,6 @@ using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Bmp
{
diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
index b4d92b15d..722c9c899 100644
--- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
+++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
@@ -10,8 +10,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Gif
{
diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
index f8b40306b..b4aae0744 100644
--- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
+++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
@@ -12,7 +12,6 @@ using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Gif
{
diff --git a/src/ImageSharp/Formats/Gif/LzwDecoder.cs b/src/ImageSharp/Formats/Gif/LzwDecoder.cs
index 2ae8a834e..0129db0e3 100644
--- a/src/ImageSharp/Formats/Gif/LzwDecoder.cs
+++ b/src/ImageSharp/Formats/Gif/LzwDecoder.cs
@@ -8,7 +8,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Gif
{
diff --git a/src/ImageSharp/Formats/Gif/LzwEncoder.cs b/src/ImageSharp/Formats/Gif/LzwEncoder.cs
index d80910614..eda0c5fb8 100644
--- a/src/ImageSharp/Formats/Gif/LzwEncoder.cs
+++ b/src/ImageSharp/Formats/Gif/LzwEncoder.cs
@@ -8,7 +8,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Gif
{
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs
index 2492a985a..169b02e9f 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs
index 2f393fada..8075fd4ba 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs
@@ -3,8 +3,6 @@
using System;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
///
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs
index c5efb812e..44f9048a5 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs
@@ -4,7 +4,6 @@
using System;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs
index 9fa4ce6d8..622c34e9b 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs
@@ -4,8 +4,6 @@
using System;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs
index e1a9380a0..39c8be312 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs
@@ -6,8 +6,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs
index f3f2952b1..0400978d2 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs
@@ -7,8 +7,6 @@ using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
using JpegColorConverter = SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters.JpegColorConverter;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
diff --git a/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs
index 48ad18856..94771aa64 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs
@@ -4,8 +4,6 @@
using System;
using System.Numerics;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Formats.Jpeg.Components
{
///
diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
index 62765a884..9b6a72cc9 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
@@ -15,9 +15,6 @@ using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg
{
diff --git a/src/ImageSharp/Formats/Png/PngChunk.cs b/src/ImageSharp/Formats/Png/PngChunk.cs
index 1fee4a837..7d8498ab7 100644
--- a/src/ImageSharp/Formats/Png/PngChunk.cs
+++ b/src/ImageSharp/Formats/Png/PngChunk.cs
@@ -1,7 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Png
{
diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
index 016179712..69b341c8d 100644
--- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
@@ -17,7 +17,6 @@ using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Png
{
diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
index 22e3f252d..57a596bcd 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
@@ -17,7 +17,6 @@ using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Png
{
diff --git a/src/ImageSharp/Formats/Png/PngThrowHelper.cs b/src/ImageSharp/Formats/Png/PngThrowHelper.cs
index 00b40c50b..dd3a05464 100644
--- a/src/ImageSharp/Formats/Png/PngThrowHelper.cs
+++ b/src/ImageSharp/Formats/Png/PngThrowHelper.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace SixLabors.ImageSharp.Formats.Png
diff --git a/src/ImageSharp/Formats/Png/Zlib/Deflater.cs b/src/ImageSharp/Formats/Png/Zlib/Deflater.cs
index 6c4ea44d1..7398b089b 100644
--- a/src/ImageSharp/Formats/Png/Zlib/Deflater.cs
+++ b/src/ImageSharp/Formats/Png/Zlib/Deflater.cs
@@ -3,7 +3,7 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Png.Zlib
{
diff --git a/src/ImageSharp/Formats/Png/Zlib/DeflaterEngine.cs b/src/ImageSharp/Formats/Png/Zlib/DeflaterEngine.cs
index 0163eec0b..7be794b5e 100644
--- a/src/ImageSharp/Formats/Png/Zlib/DeflaterEngine.cs
+++ b/src/ImageSharp/Formats/Png/Zlib/DeflaterEngine.cs
@@ -4,7 +4,7 @@
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Png.Zlib
{
diff --git a/src/ImageSharp/Formats/Png/Zlib/DeflaterHuffman.cs b/src/ImageSharp/Formats/Png/Zlib/DeflaterHuffman.cs
index 96ff6b657..e8dd8a520 100644
--- a/src/ImageSharp/Formats/Png/Zlib/DeflaterHuffman.cs
+++ b/src/ImageSharp/Formats/Png/Zlib/DeflaterHuffman.cs
@@ -5,7 +5,7 @@ using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Png.Zlib
{
diff --git a/src/ImageSharp/Formats/Png/Zlib/DeflaterOutputStream.cs b/src/ImageSharp/Formats/Png/Zlib/DeflaterOutputStream.cs
index 9eeb12cb0..a777e6f7d 100644
--- a/src/ImageSharp/Formats/Png/Zlib/DeflaterOutputStream.cs
+++ b/src/ImageSharp/Formats/Png/Zlib/DeflaterOutputStream.cs
@@ -3,7 +3,7 @@
using System;
using System.IO;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Png.Zlib
{
diff --git a/src/ImageSharp/Formats/Png/Zlib/DeflaterPendingBuffer.cs b/src/ImageSharp/Formats/Png/Zlib/DeflaterPendingBuffer.cs
index a5f00f03c..731c9e80f 100644
--- a/src/ImageSharp/Formats/Png/Zlib/DeflaterPendingBuffer.cs
+++ b/src/ImageSharp/Formats/Png/Zlib/DeflaterPendingBuffer.cs
@@ -4,7 +4,7 @@
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Png.Zlib
{
diff --git a/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs b/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs
index 3c52d306f..c723b463f 100644
--- a/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs
+++ b/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs
@@ -3,7 +3,7 @@
using System;
using System.IO;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Png.Zlib
{
diff --git a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
index d4f42a6c3..91cc93e19 100644
--- a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
+++ b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
@@ -9,7 +9,6 @@ using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Tga
{
diff --git a/src/ImageSharp/Formats/Tga/TgaEncoderCore.cs b/src/ImageSharp/Formats/Tga/TgaEncoderCore.cs
index 9dcea142f..a4b141f38 100644
--- a/src/ImageSharp/Formats/Tga/TgaEncoderCore.cs
+++ b/src/ImageSharp/Formats/Tga/TgaEncoderCore.cs
@@ -4,14 +4,12 @@
using System;
using System.Buffers.Binary;
using System.IO;
-using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Tga
{
diff --git a/src/ImageSharp/GeometryUtilities.cs b/src/ImageSharp/GeometryUtilities.cs
new file mode 100644
index 000000000..43c46f181
--- /dev/null
+++ b/src/ImageSharp/GeometryUtilities.cs
@@ -0,0 +1,34 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors
+{
+ ///
+ /// Utility class for common geometric functions.
+ ///
+ public static class GeometryUtilities
+ {
+ ///
+ /// Converts a degree (360-periodic) angle to a radian (2*Pi-periodic) angle.
+ ///
+ /// The angle in degrees.
+ ///
+ /// The representing the degree as radians.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float DegreeToRadian(float degree) => degree * (MathF.PI / 180F);
+
+ ///
+ /// Converts a radian (2*Pi-periodic) angle to a degree (360-periodic) angle.
+ ///
+ /// The angle in radians.
+ ///
+ /// The representing the degree as radians.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float RadianToDegree(float radian) => radian / (MathF.PI / 180F);
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/IO/DoubleBufferedStreamReader.cs b/src/ImageSharp/IO/DoubleBufferedStreamReader.cs
index 07f892806..0345717d2 100644
--- a/src/ImageSharp/IO/DoubleBufferedStreamReader.cs
+++ b/src/ImageSharp/IO/DoubleBufferedStreamReader.cs
@@ -6,7 +6,7 @@ using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.IO
{
diff --git a/src/ImageSharp/Image.Decode.cs b/src/ImageSharp/Image.Decode.cs
index db6a5e165..e1376b4a2 100644
--- a/src/ImageSharp/Image.Decode.cs
+++ b/src/ImageSharp/Image.Decode.cs
@@ -8,7 +8,6 @@ using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs
index d7fed9016..a62bfed1e 100644
--- a/src/ImageSharp/Image.cs
+++ b/src/ImageSharp/Image.cs
@@ -8,7 +8,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/ImageFrame.cs b/src/ImageSharp/ImageFrame.cs
index 91872b21d..fe2a2b762 100644
--- a/src/ImageSharp/ImageFrame.cs
+++ b/src/ImageSharp/ImageFrame.cs
@@ -2,11 +2,9 @@
// Licensed under the Apache License, Version 2.0.
using System;
-
+using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/ImageFrame{TPixel}.cs b/src/ImageSharp/ImageFrame{TPixel}.cs
index 64f37a340..85454e150 100644
--- a/src/ImageSharp/ImageFrame{TPixel}.cs
+++ b/src/ImageSharp/ImageFrame{TPixel}.cs
@@ -10,8 +10,6 @@ using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/ImageInfoExtensions.cs b/src/ImageSharp/ImageInfoExtensions.cs
index dca5502d0..abaa7c4bc 100644
--- a/src/ImageSharp/ImageInfoExtensions.cs
+++ b/src/ImageSharp/ImageInfoExtensions.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp
{
///
diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj
index a6beac725..0fd449d90 100644
--- a/src/ImageSharp/ImageSharp.csproj
+++ b/src/ImageSharp/ImageSharp.csproj
@@ -19,6 +19,23 @@
SixLabors.ImageSharp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
True
@@ -187,18 +204,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/ImageSharp/Image{TPixel}.cs b/src/ImageSharp/Image{TPixel}.cs
index 29184522f..b7e63dc25 100644
--- a/src/ImageSharp/Image{TPixel}.cs
+++ b/src/ImageSharp/Image{TPixel}.cs
@@ -9,7 +9,6 @@ using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp
{
diff --git a/src/ImageSharp/Memory/Allocators/AllocationOptions.cs b/src/ImageSharp/Memory/Allocators/AllocationOptions.cs
new file mode 100644
index 000000000..4edb702ed
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/AllocationOptions.cs
@@ -0,0 +1,21 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+namespace SixLabors.ImageSharp.Memory
+{
+ ///
+ /// Options for allocating buffers.
+ ///
+ public enum AllocationOptions
+ {
+ ///
+ /// Indicates that the buffer should just be allocated.
+ ///
+ None,
+
+ ///
+ /// Indicates that the allocated buffer should be cleaned following allocation.
+ ///
+ Clean
+ }
+}
diff --git a/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.Buffer{T}.cs b/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.Buffer{T}.cs
new file mode 100644
index 000000000..0d7e0b784
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.Buffer{T}.cs
@@ -0,0 +1,85 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Buffers;
+using System.Runtime.InteropServices;
+using SixLabors.ImageSharp.Memory.Internals;
+
+namespace SixLabors.ImageSharp.Memory
+{
+ ///
+ /// Contains and .
+ ///
+ public partial class ArrayPoolMemoryAllocator
+ {
+ ///
+ /// The buffer implementation of .
+ ///
+ private class Buffer : ManagedBufferBase
+ where T : struct
+ {
+ ///
+ /// The length of the buffer.
+ ///
+ private readonly int length;
+
+ ///
+ /// A weak reference to the source pool.
+ ///
+ ///
+ /// By using a weak reference here, we are making sure that array pools and their retained arrays are always GC-ed
+ /// after a call to , regardless of having buffer instances still being in use.
+ ///
+ private WeakReference> sourcePoolReference;
+
+ public Buffer(byte[] data, int length, ArrayPool sourcePool)
+ {
+ this.Data = data;
+ this.length = length;
+ this.sourcePoolReference = new WeakReference>(sourcePool);
+ }
+
+ ///
+ /// Gets the buffer as a byte array.
+ ///
+ protected byte[] Data { get; private set; }
+
+ ///
+ public override Span GetSpan() => MemoryMarshal.Cast(this.Data.AsSpan()).Slice(0, this.length);
+
+ ///
+ protected override void Dispose(bool disposing)
+ {
+ if (!disposing || this.Data is null || this.sourcePoolReference is null)
+ {
+ return;
+ }
+
+ if (this.sourcePoolReference.TryGetTarget(out ArrayPool pool))
+ {
+ pool.Return(this.Data);
+ }
+
+ this.sourcePoolReference = null;
+ this.Data = null;
+ }
+
+ protected override object GetPinnableObject() => this.Data;
+ }
+
+ ///
+ /// The implementation of .
+ ///
+ private sealed class ManagedByteBuffer : Buffer, IManagedByteBuffer
+ {
+ public ManagedByteBuffer(byte[] data, int length, ArrayPool sourcePool)
+ : base(data, length, sourcePool)
+ {
+ }
+
+ ///
+ public byte[] Array => this.Data;
+ }
+ }
+}
diff --git a/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.CommonFactoryMethods.cs b/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.CommonFactoryMethods.cs
new file mode 100644
index 000000000..1ce2525b8
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.CommonFactoryMethods.cs
@@ -0,0 +1,72 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+namespace SixLabors.ImageSharp.Memory
+{
+ ///
+ /// Contains common factory methods and configuration constants.
+ ///
+ public partial class ArrayPoolMemoryAllocator
+ {
+ ///
+ /// The default value for: maximum size of pooled arrays in bytes.
+ /// Currently set to 24MB, which is equivalent to 8 megapixels of raw RGBA32 data.
+ ///
+ internal const int DefaultMaxPooledBufferSizeInBytes = 24 * 1024 * 1024;
+
+ ///
+ /// The value for: The threshold to pool arrays in which has less buckets for memory safety.
+ ///
+ private const int DefaultBufferSelectorThresholdInBytes = 8 * 1024 * 1024;
+
+ ///
+ /// The default bucket count for .
+ ///
+ private const int DefaultLargePoolBucketCount = 6;
+
+ ///
+ /// The default bucket count for .
+ ///
+ private const int DefaultNormalPoolBucketCount = 16;
+
+ ///
+ /// This is the default. Should be good for most use cases.
+ ///
+ /// The memory manager.
+ public static ArrayPoolMemoryAllocator CreateDefault()
+ {
+ return new ArrayPoolMemoryAllocator(
+ DefaultMaxPooledBufferSizeInBytes,
+ DefaultBufferSelectorThresholdInBytes,
+ DefaultLargePoolBucketCount,
+ DefaultNormalPoolBucketCount);
+ }
+
+ ///
+ /// For environments with very limited memory capabilities, only small buffers like image rows are pooled.
+ ///
+ /// The memory manager.
+ public static ArrayPoolMemoryAllocator CreateWithMinimalPooling()
+ {
+ return new ArrayPoolMemoryAllocator(64 * 1024, 32 * 1024, 8, 24);
+ }
+
+ ///
+ /// For environments with limited memory capabilities, only small array requests are pooled, which can result in reduced throughput.
+ ///
+ /// The memory manager.
+ public static ArrayPoolMemoryAllocator CreateWithModeratePooling()
+ {
+ return new ArrayPoolMemoryAllocator(1024 * 1024, 32 * 1024, 16, 24);
+ }
+
+ ///
+ /// For environments where memory capabilities are not an issue, the maximum amount of array requests are pooled which results in optimal throughput.
+ ///
+ /// The memory manager.
+ public static ArrayPoolMemoryAllocator CreateWithAggressivePooling()
+ {
+ return new ArrayPoolMemoryAllocator(128 * 1024 * 1024, 32 * 1024 * 1024, 16, 32);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.cs b/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.cs
new file mode 100644
index 000000000..c4d92ca3c
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/ArrayPoolMemoryAllocator.cs
@@ -0,0 +1,150 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Buffers;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors.ImageSharp.Memory
+{
+ ///
+ /// Implements by allocating memory from .
+ ///
+ public sealed partial class ArrayPoolMemoryAllocator : MemoryAllocator
+ {
+ private readonly int maxArraysPerBucketNormalPool;
+
+ private readonly int maxArraysPerBucketLargePool;
+
+ ///
+ /// The for small-to-medium buffers which is not kept clean.
+ ///
+ private ArrayPool normalArrayPool;
+
+ ///
+ /// The for huge buffers, which is not kept clean.
+ ///
+ private ArrayPool largeArrayPool;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ArrayPoolMemoryAllocator()
+ : this(DefaultMaxPooledBufferSizeInBytes, DefaultBufferSelectorThresholdInBytes)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The maximum size of pooled arrays. Arrays over the thershold are gonna be always allocated.
+ public ArrayPoolMemoryAllocator(int maxPoolSizeInBytes)
+ : this(maxPoolSizeInBytes, GetLargeBufferThresholdInBytes(maxPoolSizeInBytes))
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The maximum size of pooled arrays. Arrays over the thershold are gonna be always allocated.
+ /// Arrays over this threshold will be pooled in which has less buckets for memory safety.
+ public ArrayPoolMemoryAllocator(int maxPoolSizeInBytes, int poolSelectorThresholdInBytes)
+ : this(maxPoolSizeInBytes, poolSelectorThresholdInBytes, DefaultLargePoolBucketCount, DefaultNormalPoolBucketCount)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The maximum size of pooled arrays. Arrays over the thershold are gonna be always allocated.
+ /// The threshold to pool arrays in which has less buckets for memory safety.
+ /// Max arrays per bucket for the large array pool.
+ /// Max arrays per bucket for the normal array pool.
+ public ArrayPoolMemoryAllocator(int maxPoolSizeInBytes, int poolSelectorThresholdInBytes, int maxArraysPerBucketLargePool, int maxArraysPerBucketNormalPool)
+ {
+ Guard.MustBeGreaterThan(maxPoolSizeInBytes, 0, nameof(maxPoolSizeInBytes));
+ Guard.MustBeLessThanOrEqualTo(poolSelectorThresholdInBytes, maxPoolSizeInBytes, nameof(poolSelectorThresholdInBytes));
+
+ this.MaxPoolSizeInBytes = maxPoolSizeInBytes;
+ this.PoolSelectorThresholdInBytes = poolSelectorThresholdInBytes;
+ this.maxArraysPerBucketLargePool = maxArraysPerBucketLargePool;
+ this.maxArraysPerBucketNormalPool = maxArraysPerBucketNormalPool;
+
+ this.InitArrayPools();
+ }
+
+ ///
+ /// Gets the maximum size of pooled arrays in bytes.
+ ///
+ public int MaxPoolSizeInBytes { get; }
+
+ ///
+ /// Gets the threshold to pool arrays in which has less buckets for memory safety.
+ ///
+ public int PoolSelectorThresholdInBytes { get; }
+
+ ///
+ public override void ReleaseRetainedResources()
+ {
+ this.InitArrayPools();
+ }
+
+ ///
+ public override IMemoryOwner Allocate(int length, AllocationOptions options = AllocationOptions.None)
+ {
+ Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length));
+ int itemSizeBytes = Unsafe.SizeOf();
+ int bufferSizeInBytes = length * itemSizeBytes;
+ if (bufferSizeInBytes < 0)
+ {
+ throw new ArgumentOutOfRangeException(
+ nameof(length),
+ $"{nameof(ArrayPoolMemoryAllocator)} can not allocate {length} elements of {typeof(T).Name}.");
+ }
+
+ ArrayPool pool = this.GetArrayPool(bufferSizeInBytes);
+ byte[] byteArray = pool.Rent(bufferSizeInBytes);
+
+ var buffer = new Buffer(byteArray, length, pool);
+ if (options == AllocationOptions.Clean)
+ {
+ buffer.GetSpan().Clear();
+ }
+
+ return buffer;
+ }
+
+ ///
+ public override IManagedByteBuffer AllocateManagedByteBuffer(int length, AllocationOptions options = AllocationOptions.None)
+ {
+ Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length));
+
+ ArrayPool pool = this.GetArrayPool(length);
+ byte[] byteArray = pool.Rent(length);
+
+ var buffer = new ManagedByteBuffer(byteArray, length, pool);
+ if (options == AllocationOptions.Clean)
+ {
+ buffer.GetSpan().Clear();
+ }
+
+ return buffer;
+ }
+
+ private static int GetLargeBufferThresholdInBytes(int maxPoolSizeInBytes)
+ {
+ return maxPoolSizeInBytes / 4;
+ }
+
+ private ArrayPool GetArrayPool(int bufferSizeInBytes)
+ {
+ return bufferSizeInBytes <= this.PoolSelectorThresholdInBytes ? this.normalArrayPool : this.largeArrayPool;
+ }
+
+ private void InitArrayPools()
+ {
+ this.largeArrayPool = ArrayPool.Create(this.MaxPoolSizeInBytes, this.maxArraysPerBucketLargePool);
+ this.normalArrayPool = ArrayPool.Create(this.PoolSelectorThresholdInBytes, this.maxArraysPerBucketNormalPool);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Memory/Allocators/IManagedByteBuffer.cs b/src/ImageSharp/Memory/Allocators/IManagedByteBuffer.cs
new file mode 100644
index 000000000..cb1f58ddb
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/IManagedByteBuffer.cs
@@ -0,0 +1,18 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System.Buffers;
+
+namespace SixLabors.ImageSharp.Memory
+{
+ ///
+ /// Represents a byte buffer backed by a managed array. Useful for interop with classic .NET API-s.
+ ///
+ public interface IManagedByteBuffer : IMemoryOwner
+ {
+ ///
+ /// Gets the managed array backing this buffer instance.
+ ///
+ byte[] Array { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Memory/Allocators/Internals/BasicArrayBuffer.cs b/src/ImageSharp/Memory/Allocators/Internals/BasicArrayBuffer.cs
new file mode 100644
index 000000000..56057f372
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/Internals/BasicArrayBuffer.cs
@@ -0,0 +1,60 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+
+namespace SixLabors.ImageSharp.Memory.Internals
+{
+ ///
+ /// Wraps an array as an instance.
+ ///
+ ///
+ internal class BasicArrayBuffer : ManagedBufferBase
+ where T : struct
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The array.
+ /// The length of the buffer.
+ public BasicArrayBuffer(T[] array, int length)
+ {
+ DebugGuard.MustBeLessThanOrEqualTo(length, array.Length, nameof(length));
+ this.Array = array;
+ this.Length = length;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The array.
+ public BasicArrayBuffer(T[] array)
+ : this(array, array.Length)
+ {
+ }
+
+ ///
+ /// Gets the array.
+ ///
+ public T[] Array { get; }
+
+ ///
+ /// Gets the length.
+ ///
+ public int Length { get; }
+
+ ///
+ public override Span GetSpan() => this.Array.AsSpan(0, this.Length);
+
+ ///
+ protected override void Dispose(bool disposing)
+ {
+ }
+
+ ///
+ protected override object GetPinnableObject()
+ {
+ return this.Array;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Memory/Allocators/Internals/BasicByteBuffer.cs b/src/ImageSharp/Memory/Allocators/Internals/BasicByteBuffer.cs
new file mode 100644
index 000000000..571ad70c5
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/Internals/BasicByteBuffer.cs
@@ -0,0 +1,20 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+namespace SixLabors.ImageSharp.Memory.Internals
+{
+ ///
+ /// Provides an based on .
+ ///
+ internal sealed class BasicByteBuffer : BasicArrayBuffer, IManagedByteBuffer
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The byte array.
+ internal BasicByteBuffer(byte[] array)
+ : base(array)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs b/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs
new file mode 100644
index 000000000..890963860
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs
@@ -0,0 +1,45 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System.Buffers;
+using System.Runtime.InteropServices;
+
+namespace SixLabors.ImageSharp.Memory.Internals
+{
+ ///
+ /// Provides a base class for implementations by implementing pinning logic for adaption.
+ ///
+ /// The element type.
+ internal abstract class ManagedBufferBase : MemoryManager
+ where T : struct
+ {
+ private GCHandle pinHandle;
+
+ ///
+ public override unsafe MemoryHandle Pin(int elementIndex = 0)
+ {
+ if (!this.pinHandle.IsAllocated)
+ {
+ this.pinHandle = GCHandle.Alloc(this.GetPinnableObject(), GCHandleType.Pinned);
+ }
+
+ void* ptr = (void*)this.pinHandle.AddrOfPinnedObject();
+ return new MemoryHandle(ptr, this.pinHandle);
+ }
+
+ ///
+ public override void Unpin()
+ {
+ if (this.pinHandle.IsAllocated)
+ {
+ this.pinHandle.Free();
+ }
+ }
+
+ ///
+ /// Gets the object that should be pinned.
+ ///
+ /// The pinnable .
+ protected abstract object GetPinnableObject();
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Memory/Allocators/MemoryAllocator.cs b/src/ImageSharp/Memory/Allocators/MemoryAllocator.cs
new file mode 100644
index 000000000..20598c3e3
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/MemoryAllocator.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System.Buffers;
+
+namespace SixLabors.ImageSharp.Memory
+{
+ ///
+ /// Memory managers are used to allocate memory for image processing operations.
+ ///
+ public abstract class MemoryAllocator
+ {
+ ///
+ /// Allocates an , holding a of length .
+ ///
+ /// Type of the data stored in the buffer.
+ /// Size of the buffer to allocate.
+ /// The allocation options.
+ /// A buffer of values of type .
+ public abstract IMemoryOwner Allocate(int length, AllocationOptions options = AllocationOptions.None)
+ where T : struct;
+
+ ///
+ /// Allocates an .
+ ///
+ /// The requested buffer length.
+ /// The allocation options.
+ /// The .
+ public abstract IManagedByteBuffer AllocateManagedByteBuffer(int length, AllocationOptions options = AllocationOptions.None);
+
+ ///
+ /// Releases all retained resources not being in use.
+ /// Eg: by resetting array pools and letting GC to free the arrays.
+ ///
+ public virtual void ReleaseRetainedResources()
+ {
+ }
+ }
+}
diff --git a/src/ImageSharp/Memory/Allocators/SimpleGcMemoryAllocator.cs b/src/ImageSharp/Memory/Allocators/SimpleGcMemoryAllocator.cs
new file mode 100644
index 000000000..54b64b131
--- /dev/null
+++ b/src/ImageSharp/Memory/Allocators/SimpleGcMemoryAllocator.cs
@@ -0,0 +1,30 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System.Buffers;
+using SixLabors.ImageSharp.Memory.Internals;
+
+namespace SixLabors.ImageSharp.Memory
+{
+ ///
+ /// Implements by newing up arrays by the GC on every allocation requests.
+ ///
+ public sealed class SimpleGcMemoryAllocator : MemoryAllocator
+ {
+ ///
+ public override IMemoryOwner Allocate(int length, AllocationOptions options = AllocationOptions.None)
+ {
+ Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length));
+
+ return new BasicArrayBuffer(new T[length]);
+ }
+
+ ///
+ public override IManagedByteBuffer AllocateManagedByteBuffer(int length, AllocationOptions options = AllocationOptions.None)
+ {
+ Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length));
+
+ return new BasicByteBuffer(new byte[length]);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Memory/Buffer2DExtensions.cs b/src/ImageSharp/Memory/Buffer2DExtensions.cs
index 35d55ba59..ba4f9c925 100644
--- a/src/ImageSharp/Memory/Buffer2DExtensions.cs
+++ b/src/ImageSharp/Memory/Buffer2DExtensions.cs
@@ -6,8 +6,6 @@ using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Memory
{
///
diff --git a/src/ImageSharp/Memory/Buffer2D{T}.cs b/src/ImageSharp/Memory/Buffer2D{T}.cs
index 69dff78c1..6b7f3bf42 100644
--- a/src/ImageSharp/Memory/Buffer2D{T}.cs
+++ b/src/ImageSharp/Memory/Buffer2D{T}.cs
@@ -4,8 +4,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Memory
{
///
@@ -16,7 +14,7 @@ namespace SixLabors.ImageSharp.Memory
/// Before RC1, this class might be target of API changes, use it on your own risk!
///
/// The value type.
- // TODO: Consider moving this type to the SixLabors.Memory namespace (SixLabors.Core).
+ // TODO: Consider moving this type to the SixLabors.ImageSharp.Memory namespace (SixLabors.Core).
public sealed class Buffer2D : IDisposable
where T : struct
{
diff --git a/src/ImageSharp/Memory/BufferArea{T}.cs b/src/ImageSharp/Memory/BufferArea{T}.cs
index 38f0b8129..08731846e 100644
--- a/src/ImageSharp/Memory/BufferArea{T}.cs
+++ b/src/ImageSharp/Memory/BufferArea{T}.cs
@@ -3,8 +3,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Memory
{
///
diff --git a/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs b/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs
index a3fa0e1ff..6e317bb8f 100644
--- a/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs
+++ b/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs
@@ -3,9 +3,6 @@
using System.Buffers;
-using SixLabors.Memory;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Memory
{
///
diff --git a/src/ImageSharp/Memory/MemorySource.cs b/src/ImageSharp/Memory/MemorySource.cs
index f0b0ab028..54f1bb0d1 100644
--- a/src/ImageSharp/Memory/MemorySource.cs
+++ b/src/ImageSharp/Memory/MemorySource.cs
@@ -4,8 +4,6 @@
using System;
using System.Buffers;
-using SixLabors.Memory;
-
namespace SixLabors.ImageSharp.Memory
{
///
diff --git a/src/ImageSharp/Memory/RowInterval.cs b/src/ImageSharp/Memory/RowInterval.cs
index 13037c889..c2962cfe9 100644
--- a/src/ImageSharp/Memory/RowInterval.cs
+++ b/src/ImageSharp/Memory/RowInterval.cs
@@ -1,10 +1,8 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Memory
{
///
@@ -13,7 +11,6 @@ namespace SixLabors.ImageSharp.Memory
///
/// Before RC1, this class might be target of API changes, use it on your own risk!
///
- // TODO: Consider moving this type to the SixLabors.Memory namespace (SixLabors.Core).
public readonly struct RowInterval : IEquatable
{
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs
index f98a1f3c7..c2a731825 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs
index 00410fb59..6ad8d24fa 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs
@@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
using System.Text;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs
index 48b0fddca..c068461b2 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs
@@ -5,7 +5,6 @@ using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.Text;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs
index 7f6be3c4d..6cea52b1a 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs
index b4feba056..b515ab36a 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs
index db52bbb22..f1364b2c3 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs
index ece06c247..63b10e3e2 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs
index 58a713411..29d61db88 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs
index 4022f5c1a..9a6e3063b 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumber.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumber.cs
index 8d886d21c..ef7d20c85 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumber.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumber.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Globalization;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumberArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumberArray.cs
index a7ecf7bc8..521cfc085 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumberArray.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumberArray.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
internal sealed class ExifNumberArray : ExifArrayValue
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs
index 2806386b5..3ab77ab32 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Globalization;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs
index ae4fb0c57..f78e363da 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRational.cs
index 2a4051601..61fba979b 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRational.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRational.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Globalization;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRationalArray.cs
index 6c6bb0a4a..2545bd9b2 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRationalArray.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedRationalArray.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
internal sealed class ExifSignedRationalArray : ExifArrayValue
diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Matrix.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Matrix.cs
index b0bd377cb..585892e96 100644
--- a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Matrix.cs
+++ b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Matrix.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
diff --git a/src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccMatrixProcessElement.cs b/src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccMatrixProcessElement.cs
index 0d8683397..668883e1a 100644
--- a/src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccMatrixProcessElement.cs
+++ b/src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccMatrixProcessElement.cs
@@ -3,8 +3,6 @@
using System;
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
///
diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
index 51ee5d12d..4075b664c 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
@@ -4,10 +4,6 @@
//
using System;
using System.Numerics;
-using System.Buffers;
-
-using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
@@ -26,7 +22,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
where TPixel : struct, IPixel
{
-
///
/// A pixel blender that implements the "NormalSrc" composition equation.
///
@@ -65,7 +60,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplySrc" composition equation.
///
@@ -104,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddSrc" composition equation.
///
@@ -143,7 +136,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractSrc" composition equation.
///
@@ -182,7 +174,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenSrc" composition equation.
///
@@ -221,7 +212,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenSrc" composition equation.
///
@@ -260,7 +250,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenSrc" composition equation.
///
@@ -299,7 +288,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlaySrc" composition equation.
///
@@ -338,7 +326,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightSrc" composition equation.
///
@@ -377,7 +364,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalSrcAtop" composition equation.
///
@@ -416,7 +402,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplySrcAtop" composition equation.
///
@@ -455,7 +440,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddSrcAtop" composition equation.
///
@@ -494,7 +478,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractSrcAtop" composition equation.
///
@@ -533,7 +516,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenSrcAtop" composition equation.
///
@@ -572,7 +554,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenSrcAtop" composition equation.
///
@@ -611,7 +592,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenSrcAtop" composition equation.
///
@@ -650,7 +630,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlaySrcAtop" composition equation.
///
@@ -689,7 +668,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightSrcAtop" composition equation.
///
@@ -728,7 +706,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalSrcOver" composition equation.
///
@@ -767,7 +744,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplySrcOver" composition equation.
///
@@ -806,7 +782,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddSrcOver" composition equation.
///
@@ -845,7 +820,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractSrcOver" composition equation.
///
@@ -884,7 +858,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenSrcOver" composition equation.
///
@@ -923,7 +896,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenSrcOver" composition equation.
///
@@ -962,7 +934,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenSrcOver" composition equation.
///
@@ -1001,7 +972,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlaySrcOver" composition equation.
///
@@ -1040,7 +1010,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightSrcOver" composition equation.
///
@@ -1079,7 +1048,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalSrcIn" composition equation.
///
@@ -1118,7 +1086,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplySrcIn" composition equation.
///
@@ -1157,7 +1124,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddSrcIn" composition equation.
///
@@ -1196,7 +1162,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractSrcIn" composition equation.
///
@@ -1235,7 +1200,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenSrcIn" composition equation.
///
@@ -1274,7 +1238,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenSrcIn" composition equation.
///
@@ -1313,7 +1276,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenSrcIn" composition equation.
///
@@ -1352,7 +1314,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlaySrcIn" composition equation.
///
@@ -1391,7 +1352,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightSrcIn" composition equation.
///
@@ -1430,7 +1390,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalSrcOut" composition equation.
///
@@ -1469,7 +1428,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplySrcOut" composition equation.
///
@@ -1508,7 +1466,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddSrcOut" composition equation.
///
@@ -1547,7 +1504,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractSrcOut" composition equation.
///
@@ -1586,7 +1542,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenSrcOut" composition equation.
///
@@ -1625,7 +1580,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenSrcOut" composition equation.
///
@@ -1664,7 +1618,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenSrcOut" composition equation.
///
@@ -1703,7 +1656,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlaySrcOut" composition equation.
///
@@ -1742,7 +1694,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightSrcOut" composition equation.
///
@@ -1781,7 +1732,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalDest" composition equation.
///
@@ -1820,7 +1770,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplyDest" composition equation.
///
@@ -1859,7 +1808,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddDest" composition equation.
///
@@ -1898,7 +1846,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractDest" composition equation.
///
@@ -1937,7 +1884,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenDest" composition equation.
///
@@ -1976,7 +1922,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenDest" composition equation.
///
@@ -2015,7 +1960,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenDest" composition equation.
///
@@ -2054,7 +1998,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlayDest" composition equation.
///
@@ -2093,7 +2036,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightDest" composition equation.
///
@@ -2132,7 +2074,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalDestAtop" composition equation.
///
@@ -2171,7 +2112,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplyDestAtop" composition equation.
///
@@ -2210,7 +2150,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddDestAtop" composition equation.
///
@@ -2249,7 +2188,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractDestAtop" composition equation.
///
@@ -2288,7 +2226,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenDestAtop" composition equation.
///
@@ -2327,7 +2264,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenDestAtop" composition equation.
///
@@ -2366,7 +2302,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenDestAtop" composition equation.
///
@@ -2405,7 +2340,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlayDestAtop" composition equation.
///
@@ -2444,7 +2378,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightDestAtop" composition equation.
///
@@ -2483,7 +2416,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalDestOver" composition equation.
///
@@ -2522,7 +2454,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplyDestOver" composition equation.
///
@@ -2561,7 +2492,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddDestOver" composition equation.
///
@@ -2600,7 +2530,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractDestOver" composition equation.
///
@@ -2639,7 +2568,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenDestOver" composition equation.
///
@@ -2678,7 +2606,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenDestOver" composition equation.
///
@@ -2717,7 +2644,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenDestOver" composition equation.
///
@@ -2756,7 +2682,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlayDestOver" composition equation.
///
@@ -2795,7 +2720,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightDestOver" composition equation.
///
@@ -2834,7 +2758,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalDestIn" composition equation.
///
@@ -2873,7 +2796,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplyDestIn" composition equation.
///
@@ -2912,7 +2834,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddDestIn" composition equation.
///
@@ -2951,7 +2872,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractDestIn" composition equation.
///
@@ -2990,7 +2910,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenDestIn" composition equation.
///
@@ -3029,7 +2948,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenDestIn" composition equation.
///
@@ -3068,7 +2986,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenDestIn" composition equation.
///
@@ -3107,7 +3024,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlayDestIn" composition equation.
///
@@ -3146,7 +3062,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightDestIn" composition equation.
///
@@ -3185,7 +3100,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalDestOut" composition equation.
///
@@ -3224,7 +3138,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplyDestOut" composition equation.
///
@@ -3263,7 +3176,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddDestOut" composition equation.
///
@@ -3302,7 +3214,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractDestOut" composition equation.
///
@@ -3341,7 +3252,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenDestOut" composition equation.
///
@@ -3380,7 +3290,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenDestOut" composition equation.
///
@@ -3419,7 +3328,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenDestOut" composition equation.
///
@@ -3458,7 +3366,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlayDestOut" composition equation.
///
@@ -3497,7 +3404,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightDestOut" composition equation.
///
@@ -3536,7 +3442,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalClear" composition equation.
///
@@ -3575,7 +3480,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplyClear" composition equation.
///
@@ -3614,7 +3518,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddClear" composition equation.
///
@@ -3653,7 +3556,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractClear" composition equation.
///
@@ -3692,7 +3594,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenClear" composition equation.
///
@@ -3731,7 +3632,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenClear" composition equation.
///
@@ -3770,7 +3670,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenClear" composition equation.
///
@@ -3809,7 +3708,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlayClear" composition equation.
///
@@ -3848,7 +3746,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightClear" composition equation.
///
@@ -3887,7 +3784,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "NormalXor" composition equation.
///
@@ -3926,7 +3822,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "MultiplyXor" composition equation.
///
@@ -3965,7 +3860,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "AddXor" composition equation.
///
@@ -4004,7 +3898,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "SubtractXor" composition equation.
///
@@ -4043,7 +3936,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "ScreenXor" composition equation.
///
@@ -4082,7 +3974,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "DarkenXor" composition equation.
///
@@ -4121,7 +4012,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "LightenXor" composition equation.
///
@@ -4160,7 +4050,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "OverlayXor" composition equation.
///
@@ -4199,7 +4088,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
-
///
/// A pixel blender that implements the "HardLightXor" composition equation.
///
diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt
index 55eb01df3..ccb98c495 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt
@@ -14,10 +14,6 @@
//
using System;
using System.Numerics;
-using System.Buffers;
-
-using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
diff --git a/src/ImageSharp/Primitives/ColorMatrix.cs b/src/ImageSharp/Primitives/ColorMatrix.cs
index 11886c9c2..477d120fa 100644
--- a/src/ImageSharp/Primitives/ColorMatrix.cs
+++ b/src/ImageSharp/Primitives/ColorMatrix.cs
@@ -6,7 +6,7 @@ using System;
using System.Globalization;
using System.Runtime.InteropServices;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// A structure encapsulating a 5x4 matrix used for transforming the color and alpha components of an image.
diff --git a/src/ImageSharp/Primitives/Complex64.cs b/src/ImageSharp/Primitives/Complex64.cs
index 96883229c..a5af3f2f7 100644
--- a/src/ImageSharp/Primitives/Complex64.cs
+++ b/src/ImageSharp/Primitives/Complex64.cs
@@ -5,7 +5,7 @@ using System;
using System.Numerics;
using System.Runtime.CompilerServices;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// Represents a complex number, where the real and imaginary parts are stored as values.
diff --git a/src/ImageSharp/Primitives/ComplexVector4.cs b/src/ImageSharp/Primitives/ComplexVector4.cs
index b90da65b2..5287ab23f 100644
--- a/src/ImageSharp/Primitives/ComplexVector4.cs
+++ b/src/ImageSharp/Primitives/ComplexVector4.cs
@@ -5,7 +5,7 @@ using System;
using System.Numerics;
using System.Runtime.CompilerServices;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// A vector with 4 values of type .
diff --git a/src/ImageSharp/Primitives/DenseMatrix{T}.cs b/src/ImageSharp/Primitives/DenseMatrix{T}.cs
index cc5e4a90a..4229e69e7 100644
--- a/src/ImageSharp/Primitives/DenseMatrix{T}.cs
+++ b/src/ImageSharp/Primitives/DenseMatrix{T}.cs
@@ -4,9 +4,8 @@
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
-using SixLabors.Primitives;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// Represents a dense matrix with arbitrary elements.
diff --git a/src/ImageSharp/Primitives/LongRational.cs b/src/ImageSharp/Primitives/LongRational.cs
index b15aa4022..d0f56917e 100644
--- a/src/ImageSharp/Primitives/LongRational.cs
+++ b/src/ImageSharp/Primitives/LongRational.cs
@@ -5,7 +5,7 @@ using System;
using System.Globalization;
using System.Text;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// Represents a number that can be expressed as a fraction.
diff --git a/src/ImageSharp/Primitives/Matrix3x2Extensions.cs b/src/ImageSharp/Primitives/Matrix3x2Extensions.cs
new file mode 100644
index 000000000..4ddbcc017
--- /dev/null
+++ b/src/ImageSharp/Primitives/Matrix3x2Extensions.cs
@@ -0,0 +1,101 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System.Numerics;
+
+namespace SixLabors.ImageSharp
+{
+ ///
+ /// Extension methods for the struct.
+ ///
+ public static class Matrix3x2Extensions
+ {
+ ///
+ /// Creates a translation matrix from the given vector.
+ ///
+ /// The translation position.
+ /// A translation matrix.
+ public static Matrix3x2 CreateTranslation(PointF position) => Matrix3x2.CreateTranslation(position);
+
+ ///
+ /// Creates a scale matrix that is offset by a given center point.
+ ///
+ /// Value to scale by on the X-axis.
+ /// Value to scale by on the Y-axis.
+ /// The center point.
+ /// A scaling matrix.
+ public static Matrix3x2 CreateScale(float xScale, float yScale, PointF centerPoint) => Matrix3x2.CreateScale(xScale, yScale, centerPoint);
+
+ ///
+ /// Creates a scale matrix from the given vector scale.
+ ///
+ /// The scale to use.
+ /// A scaling matrix.
+ public static Matrix3x2 CreateScale(SizeF scales) => Matrix3x2.CreateScale(scales);
+
+ ///
+ /// Creates a scale matrix from the given vector scale with an offset from the given center point.
+ ///
+ /// The scale to use.
+ /// The center offset.
+ /// A scaling matrix.
+ public static Matrix3x2 CreateScale(SizeF scales, PointF centerPoint) => Matrix3x2.CreateScale(scales, centerPoint);
+
+ ///
+ /// Creates a scale matrix that scales uniformly with the given scale with an offset from the given center.
+ ///
+ /// The uniform scale to use.
+ /// The center offset.
+ /// A scaling matrix.
+ public static Matrix3x2 CreateScale(float scale, PointF centerPoint) => Matrix3x2.CreateScale(scale, centerPoint);
+
+ ///
+ /// Creates a skew matrix from the given angles in degrees.
+ ///
+ /// The X angle, in degrees.
+ /// The Y angle, in degrees.
+ /// A skew matrix.
+ public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY) => Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY));
+
+ ///
+ /// Creates a skew matrix from the given angles in radians and a center point.
+ ///
+ /// The X angle, in radians.
+ /// The Y angle, in radians.
+ /// The center point.
+ /// A skew matrix.
+ public static Matrix3x2 CreateSkew(float radiansX, float radiansY, PointF centerPoint) => Matrix3x2.CreateSkew(radiansX, radiansY, centerPoint);
+
+ ///
+ /// Creates a skew matrix from the given angles in degrees and a center point.
+ ///
+ /// The X angle, in degrees.
+ /// The Y angle, in degrees.
+ /// The center point.
+ /// A skew matrix.
+ public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY, PointF centerPoint) => Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY), centerPoint);
+
+ ///
+ /// Creates a rotation matrix using the given rotation in degrees.
+ ///
+ /// The amount of rotation, in degrees.
+ /// A rotation matrix.
+ public static Matrix3x2 CreateRotationDegrees(float degrees) => Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees));
+
+ ///
+ /// Creates a rotation matrix using the given rotation in radians and a center point.
+ ///
+ /// The amount of rotation, in radians.
+ /// The center point.
+ /// A rotation matrix.
+ public static Matrix3x2 CreateRotation(float radians, PointF centerPoint) => Matrix3x2.CreateRotation(radians, centerPoint);
+
+ ///
+ /// Creates a rotation matrix using the given rotation in degrees and a center point.
+ ///
+ /// The amount of rotation, in degrees.
+ /// The center point.
+ /// A rotation matrix.
+ public static Matrix3x2 CreateRotationDegrees(float degrees, PointF centerPoint) => Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees), centerPoint);
+ }
+}
diff --git a/src/ImageSharp/Primitives/Number.cs b/src/ImageSharp/Primitives/Number.cs
index 88974e72b..3d575e866 100644
--- a/src/ImageSharp/Primitives/Number.cs
+++ b/src/ImageSharp/Primitives/Number.cs
@@ -5,7 +5,7 @@ using System;
using System.Globalization;
using System.Runtime.InteropServices;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// Represents an integral number.
diff --git a/src/ImageSharp/Primitives/Point.cs b/src/ImageSharp/Primitives/Point.cs
new file mode 100644
index 000000000..96e73766b
--- /dev/null
+++ b/src/ImageSharp/Primitives/Point.cs
@@ -0,0 +1,288 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.ComponentModel;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors.ImageSharp
+{
+ ///
+ /// Represents an ordered pair of integer x- and y-coordinates that defines a point in
+ /// a two-dimensional plane.
+ ///
+ ///
+ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
+ /// as it avoids the need to create new values for modification operations.
+ ///
+ public struct Point : IEquatable
+ {
+ ///
+ /// Represents a that has X and Y values set to zero.
+ ///
+ public static readonly Point Empty = default;
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The horizontal and vertical position of the point.
+ public Point(int value)
+ : this()
+ {
+ this.X = LowInt16(value);
+ this.Y = HighInt16(value);
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The horizontal position of the point.
+ /// The vertical position of the point.
+ public Point(int x, int y)
+ : this()
+ {
+ this.X = x;
+ this.Y = y;
+ }
+
+ ///
+ /// Initializes a new instance of the struct from the given .
+ ///
+ /// The size.
+ public Point(Size size)
+ {
+ this.X = size.Width;
+ this.Y = size.Height;
+ }
+
+ ///
+ /// Gets or sets the x-coordinate of this .
+ ///
+ public int X { get; set; }
+
+ ///
+ /// Gets or sets the y-coordinate of this .
+ ///
+ public int Y { get; set; }
+
+ ///
+ /// Gets a value indicating whether this is empty.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEmpty => this.Equals(Empty);
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator PointF(Point point) => new PointF(point.X, point.Y);
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator Vector2(Point point) => new Vector2(point.X, point.Y);
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static explicit operator Size(Point point) => new Size(point.X, point.Y);
+
+ ///
+ /// Negates the given point by multiplying all values by -1.
+ ///
+ /// The source point.
+ /// The negated point.
+ public static Point operator -(Point value) => new Point(-value.X, -value.Y);
+
+ ///
+ /// Translates a by a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point operator +(Point point, Size size) => Add(point, size);
+
+ ///
+ /// Translates a by the negative of a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point operator -(Point point, Size size) => Subtract(point, size);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplier of type .
+ /// Multiplicand of type .
+ /// Product of type .
+ public static Point operator *(int left, Point right) => Multiply(right, left);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type .
+ public static Point operator *(Point left, int right) => Multiply(left, right);
+
+ ///
+ /// Divides by a producing .
+ ///
+ /// Dividend of type .
+ /// Divisor of type .
+ /// Result of type .
+ public static Point operator /(Point left, int right)
+ => new Point(left.X / right, left.Y / right);
+
+ ///
+ /// Compares two objects for equality.
+ ///
+ /// The on the left side of the operand.
+ /// The on the right side of the operand.
+ ///
+ /// True if the current left is equal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator ==(Point left, Point 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 current left is unequal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator !=(Point left, Point right) => !left.Equals(right);
+
+ ///
+ /// Translates a by the negative of a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Add(Point point, Size size) => new Point(unchecked(point.X + size.Width), unchecked(point.Y + size.Height));
+
+ ///
+ /// Translates a by the negative of a given value.
+ ///
+ /// The point on the left hand of the operand.
+ /// The value on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Multiply(Point point, int value) => new Point(unchecked(point.X * value), unchecked(point.Y * value));
+
+ ///
+ /// Translates a by the negative of a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Subtract(Point point, Size size) => new Point(unchecked(point.X - size.Width), unchecked(point.Y - size.Height));
+
+ ///
+ /// Converts a to a by performing a ceiling operation on all the coordinates.
+ ///
+ /// The point.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Ceiling(PointF point) => new Point(unchecked((int)MathF.Ceiling(point.X)), unchecked((int)MathF.Ceiling(point.Y)));
+
+ ///
+ /// Converts a to a by performing a round operation on all the coordinates.
+ ///
+ /// The point.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Round(PointF point) => new Point(unchecked((int)MathF.Round(point.X)), unchecked((int)MathF.Round(point.Y)));
+
+ ///
+ /// Converts a to a by performing a round operation on all the coordinates.
+ ///
+ /// The vector.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Round(Vector2 vector) => new Point(unchecked((int)MathF.Round(vector.X)), unchecked((int)MathF.Round(vector.Y)));
+
+ ///
+ /// Converts a to a by performing a truncate operation on all the coordinates.
+ ///
+ /// The point.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Truncate(PointF point) => new Point(unchecked((int)point.X), unchecked((int)point.Y));
+
+ ///
+ /// Transforms a point by a specified 3x2 matrix.
+ ///
+ /// The point to transform.
+ /// The transformation matrix used.
+ /// The transformed .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Transform(Point point, Matrix3x2 matrix) => Round(Vector2.Transform(new Vector2(point.X, point.Y), matrix));
+
+ ///
+ /// Deconstructs this point into two integers.
+ ///
+ /// The out value for X.
+ /// The out value for Y.
+ public void Deconstruct(out int x, out int y)
+ {
+ x = this.X;
+ y = this.Y;
+ }
+
+ ///
+ /// Translates this by the specified amount.
+ ///
+ /// The amount to offset the x-coordinate.
+ /// The amount to offset the y-coordinate.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(int dx, int dy)
+ {
+ unchecked
+ {
+ this.X += dx;
+ this.Y += dy;
+ }
+ }
+
+ ///
+ /// Translates this by the specified amount.
+ ///
+ /// The used offset this .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(Point point) => this.Offset(point.X, point.Y);
+
+ ///
+ public override int GetHashCode() => HashCode.Combine(this.X, this.Y);
+
+ ///
+ public override string ToString() => $"Point [ X={this.X}, Y={this.Y} ]";
+
+ ///
+ public override bool Equals(object obj) => obj is Point other && this.Equals(other);
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Equals(Point other) => this.X.Equals(other.X) && this.Y.Equals(other.Y);
+
+ private static short HighInt16(int n) => unchecked((short)((n >> 16) & 0xffff));
+
+ private static short LowInt16(int n) => unchecked((short)(n & 0xffff));
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Primitives/PointF.cs b/src/ImageSharp/Primitives/PointF.cs
new file mode 100644
index 000000000..e43ad4daf
--- /dev/null
+++ b/src/ImageSharp/Primitives/PointF.cs
@@ -0,0 +1,293 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.ComponentModel;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors.ImageSharp
+{
+ ///
+ /// Represents an ordered pair of single precision floating point x- and y-coordinates that defines a point in
+ /// a two-dimensional plane.
+ ///
+ ///
+ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
+ /// as it avoids the need to create new values for modification operations.
+ ///
+ public struct PointF : IEquatable
+ {
+ ///
+ /// Represents a that has X and Y values set to zero.
+ ///
+ public static readonly PointF Empty = default;
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The horizontal position of the point.
+ /// The vertical position of the point.
+ public PointF(float x, float y)
+ : this()
+ {
+ this.X = x;
+ this.Y = y;
+ }
+
+ ///
+ /// Initializes a new instance of the struct from the given .
+ ///
+ /// The size.
+ public PointF(SizeF size)
+ {
+ this.X = size.Width;
+ this.Y = size.Height;
+ }
+
+ ///
+ /// Gets or sets the x-coordinate of this .
+ ///
+ public float X { get; set; }
+
+ ///
+ /// Gets or sets the y-coordinate of this .
+ ///
+ public float Y { get; set; }
+
+ ///
+ /// Gets a value indicating whether this is empty.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEmpty => this.Equals(Empty);
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The vector.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator PointF(Vector2 vector) => new PointF(vector.X, vector.Y);
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The point.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator Vector2(PointF point) => new Vector2(point.X, point.Y);
+
+ ///
+ /// Creates a with the coordinates of the specified by truncating each of the coordinates.
+ ///
+ /// The point.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static explicit operator Point(PointF point) => Point.Truncate(point);
+
+ ///
+ /// Negates the given point by multiplying all values by -1.
+ ///
+ /// The source point.
+ /// The negated point.
+ public static PointF operator -(PointF value) => new PointF(-value.X, -value.Y);
+
+ ///
+ /// Translates a by a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF operator +(PointF point, SizeF size) => Add(point, size);
+
+ ///
+ /// Translates a by the negative of a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF operator -(PointF point, PointF size) => Subtract(point, size);
+
+ ///
+ /// Translates a by a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF operator +(PointF point, PointF size) => Add(point, size);
+
+ ///
+ /// Translates a by the negative of a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF operator -(PointF point, SizeF size) => Subtract(point, size);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplier of type .
+ /// Multiplicand of type .
+ /// Product of type .
+ public static PointF operator *(float left, PointF right) => Multiply(right, left);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type .
+ public static PointF operator *(PointF left, float right) => Multiply(left, right);
+
+ ///
+ /// Divides by a producing .
+ ///
+ /// Dividend of type .
+ /// Divisor of type .
+ /// Result of type .
+ public static PointF operator /(PointF left, float right)
+ => new PointF(left.X / right, left.Y / right);
+
+ ///
+ /// Compares two objects for equality.
+ ///
+ ///
+ /// The on the left side of the operand.
+ ///
+ ///
+ /// The on the right side of the operand.
+ ///
+ ///
+ /// True if the current left is equal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator ==(PointF left, PointF 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 current left is unequal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator !=(PointF left, PointF right) => !left.Equals(right);
+
+ ///
+ /// Translates a by the given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF Add(PointF point, SizeF size) => new PointF(point.X + size.Width, point.Y + size.Height);
+
+ ///
+ /// Translates a by the given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The point on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF Add(PointF point, PointF pointb) => new PointF(point.X + pointb.X, point.Y + pointb.Y);
+
+ ///
+ /// Translates a by the negative of a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF Subtract(PointF point, SizeF size) => new PointF(point.X - size.Width, point.Y - size.Height);
+
+ ///
+ /// Translates a by the negative of a given .
+ ///
+ /// The point on the left hand of the operand.
+ /// The point on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF Subtract(PointF point, PointF pointb) => new PointF(point.X - pointb.X, point.Y - pointb.Y);
+
+ ///
+ /// Translates a by the multiplying the X and Y by the given value.
+ ///
+ /// The point on the left hand of the operand.
+ /// The value on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF Multiply(PointF point, float right) => new PointF(point.X * right, point.Y * right);
+
+ ///
+ /// Transforms a point by a specified 3x2 matrix.
+ ///
+ /// The point to transform.
+ /// The transformation matrix used.
+ /// The transformed .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF Transform(PointF point, Matrix3x2 matrix) => Vector2.Transform(point, matrix);
+
+ ///
+ /// Deconstructs this point into two floats.
+ ///
+ /// The out value for X.
+ /// The out value for Y.
+ public void Deconstruct(out float x, out float y)
+ {
+ x = this.X;
+ y = this.Y;
+ }
+
+ ///
+ /// Translates this by the specified amount.
+ ///
+ /// The amount to offset the x-coordinate.
+ /// The amount to offset the y-coordinate.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(float dx, float dy)
+ {
+ this.X += dx;
+ this.Y += dy;
+ }
+
+ ///
+ /// Translates this by the specified amount.
+ ///
+ /// The used offset this .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(PointF point) => this.Offset(point.X, point.Y);
+
+ ///
+ public override int GetHashCode() => HashCode.Combine(this.X, this.Y);
+
+ ///
+ public override string ToString() => $"PointF [ X={this.X}, Y={this.Y} ]";
+
+ ///
+ public override bool Equals(object obj) => obj is PointF && this.Equals((PointF)obj);
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Equals(PointF other) => this.X.Equals(other.X) && this.Y.Equals(other.Y);
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Primitives/Rational.cs b/src/ImageSharp/Primitives/Rational.cs
index f9299bc17..212178a24 100644
--- a/src/ImageSharp/Primitives/Rational.cs
+++ b/src/ImageSharp/Primitives/Rational.cs
@@ -4,7 +4,7 @@
using System;
using System.Globalization;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// Represents a number that can be expressed as a fraction.
diff --git a/src/ImageSharp/Primitives/Rectangle.cs b/src/ImageSharp/Primitives/Rectangle.cs
new file mode 100644
index 000000000..95b01fd9d
--- /dev/null
+++ b/src/ImageSharp/Primitives/Rectangle.cs
@@ -0,0 +1,463 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.ComponentModel;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors.ImageSharp
+{
+ ///
+ /// Stores a set of four integers that represent the location and size of a rectangle.
+ ///
+ ///
+ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
+ /// as it avoids the need to create new values for modification operations.
+ ///
+ public struct Rectangle : IEquatable
+ {
+ ///
+ /// Represents a that has X, Y, Width, and Height values set to zero.
+ ///
+ public static readonly Rectangle Empty = default;
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The horizontal position of the rectangle.
+ /// The vertical position of the rectangle.
+ /// The width of the rectangle.
+ /// The height of the rectangle.
+ public Rectangle(int x, int y, int width, int height)
+ {
+ this.X = x;
+ this.Y = y;
+ this.Width = width;
+ this.Height = height;
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ ///
+ /// The which specifies the rectangles point in a two-dimensional plane.
+ ///
+ ///
+ /// The which specifies the rectangles height and width.
+ ///
+ public Rectangle(Point point, Size size)
+ {
+ this.X = point.X;
+ this.Y = point.Y;
+ this.Width = size.Width;
+ this.Height = size.Height;
+ }
+
+ ///
+ /// Gets or sets the x-coordinate of this .
+ ///
+ public int X { get; set; }
+
+ ///
+ /// Gets or sets the y-coordinate of this .
+ ///
+ public int Y { get; set; }
+
+ ///
+ /// Gets or sets the width of this .
+ ///
+ public int Width { get; set; }
+
+ ///
+ /// Gets or sets the height of this .
+ ///
+ public int Height { get; set; }
+
+ ///
+ /// Gets or sets the coordinates of the upper-left corner of the rectangular region represented by this .
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Point Location
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => new Point(this.X, this.Y);
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ set
+ {
+ this.X = value.X;
+ this.Y = value.Y;
+ }
+ }
+
+ ///
+ /// Gets or sets the size of this .
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size Size
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => new Size(this.Width, this.Height);
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ set
+ {
+ this.Width = value.Width;
+ this.Height = value.Height;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether this is empty.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEmpty => this.Equals(Empty);
+
+ ///
+ /// Gets the y-coordinate of the top edge of this .
+ ///
+ public int Top => this.Y;
+
+ ///
+ /// Gets the x-coordinate of the right edge of this .
+ ///
+ public int Right
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => unchecked(this.X + this.Width);
+ }
+
+ ///
+ /// Gets the y-coordinate of the bottom edge of this .
+ ///
+ public int Bottom
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => unchecked(this.Y + this.Height);
+ }
+
+ ///
+ /// Gets the x-coordinate of the left edge of this .
+ ///
+ public int Left => this.X;
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The rectangle.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator RectangleF(Rectangle rectangle) => new RectangleF(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The rectangle.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator Vector4(Rectangle rectangle) => new Vector4(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+
+ ///
+ /// Compares two objects for equality.
+ ///
+ /// The on the left side of the operand.
+ /// The on the right side of the operand.
+ ///
+ /// True if the current left is equal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator ==(Rectangle left, Rectangle 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 current left is unequal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator !=(Rectangle left, Rectangle right) => !left.Equals(right);
+
+ ///
+ /// Creates a new with the specified location and size.
+ /// The left coordinate of the rectangle.
+ /// The top coordinate of the rectangle.
+ /// The right coordinate of the rectangle.
+ /// The bottom coordinate of the rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+
+ // ReSharper disable once InconsistentNaming
+ public static Rectangle FromLTRB(int left, int top, int right, int bottom) => new Rectangle(left, top, unchecked(right - left), unchecked(bottom - top));
+
+ ///
+ /// Returns the center point of the given .
+ ///
+ /// The rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Point Center(Rectangle rectangle) => new Point(rectangle.Left + (rectangle.Width / 2), rectangle.Top + (rectangle.Height / 2));
+
+ ///
+ /// Creates a rectangle that represents the intersection between and
+ /// . If there is no intersection, an empty rectangle is returned.
+ ///
+ /// The first rectangle.
+ /// The second rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Rectangle Intersect(Rectangle a, Rectangle b)
+ {
+ int x1 = Math.Max(a.X, b.X);
+ int x2 = Math.Min(a.Right, b.Right);
+ int y1 = Math.Max(a.Y, b.Y);
+ int y2 = Math.Min(a.Bottom, b.Bottom);
+
+ if (x2 >= x1 && y2 >= y1)
+ {
+ return new Rectangle(x1, y1, x2 - x1, y2 - y1);
+ }
+
+ return Empty;
+ }
+
+ ///
+ /// Creates a that is inflated by the specified amount.
+ ///
+ /// The rectangle.
+ /// The amount to inflate the width by.
+ /// The amount to inflate the height by.
+ /// A new .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Rectangle Inflate(Rectangle rectangle, int x, int y)
+ {
+ Rectangle r = rectangle;
+ r.Inflate(x, y);
+ return r;
+ }
+
+ ///
+ /// Converts a to a by performing a ceiling operation on all the coordinates.
+ ///
+ /// The rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Rectangle Ceiling(RectangleF rectangle)
+ {
+ unchecked
+ {
+ return new Rectangle(
+ (int)MathF.Ceiling(rectangle.X),
+ (int)MathF.Ceiling(rectangle.Y),
+ (int)MathF.Ceiling(rectangle.Width),
+ (int)MathF.Ceiling(rectangle.Height));
+ }
+ }
+
+ ///
+ /// Transforms a rectangle by the given matrix.
+ ///
+ /// The source rectangle.
+ /// The transformation matrix.
+ /// A transformed rectangle.
+ public static RectangleF Transform(Rectangle rectangle, Matrix3x2 matrix)
+ {
+ PointF bottomRight = Point.Transform(new Point(rectangle.Right, rectangle.Bottom), matrix);
+ PointF topLeft = Point.Transform(rectangle.Location, matrix);
+ return new RectangleF(topLeft, new SizeF(bottomRight - topLeft));
+ }
+
+ ///
+ /// Converts a to a by performing a truncate operation on all the coordinates.
+ ///
+ /// The rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Rectangle Truncate(RectangleF rectangle)
+ {
+ unchecked
+ {
+ return new Rectangle(
+ (int)rectangle.X,
+ (int)rectangle.Y,
+ (int)rectangle.Width,
+ (int)rectangle.Height);
+ }
+ }
+
+ ///
+ /// Converts a to a by performing a round operation on all the coordinates.
+ ///
+ /// The rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Rectangle Round(RectangleF rectangle)
+ {
+ unchecked
+ {
+ return new Rectangle(
+ (int)MathF.Round(rectangle.X),
+ (int)MathF.Round(rectangle.Y),
+ (int)MathF.Round(rectangle.Width),
+ (int)MathF.Round(rectangle.Height));
+ }
+ }
+
+ ///
+ /// Creates a rectangle that represents the union between and .
+ ///
+ /// The first rectangle.
+ /// The second rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Rectangle Union(Rectangle a, Rectangle b)
+ {
+ int x1 = Math.Min(a.X, b.X);
+ int x2 = Math.Max(a.Right, b.Right);
+ int y1 = Math.Min(a.Y, b.Y);
+ int y2 = Math.Max(a.Bottom, b.Bottom);
+
+ return new Rectangle(x1, y1, x2 - x1, y2 - y1);
+ }
+
+ ///
+ /// Deconstructs this rectangle into four integers.
+ ///
+ /// The out value for X.
+ /// The out value for Y.
+ /// The out value for the width.
+ /// The out value for the height.
+ public void Deconstruct(out int x, out int y, out int width, out int height)
+ {
+ x = this.X;
+ y = this.Y;
+ width = this.Width;
+ height = this.Height;
+ }
+
+ ///
+ /// Creates a Rectangle that represents the intersection between this Rectangle and the .
+ ///
+ /// The rectangle.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Intersect(Rectangle rectangle)
+ {
+ Rectangle result = Intersect(rectangle, this);
+
+ this.X = result.X;
+ this.Y = result.Y;
+ this.Width = result.Width;
+ this.Height = result.Height;
+ }
+
+ ///
+ /// Inflates this by the specified amount.
+ ///
+ /// The width.
+ /// The height.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Inflate(int width, int height)
+ {
+ unchecked
+ {
+ this.X -= width;
+ this.Y -= height;
+
+ this.Width += 2 * width;
+ this.Height += 2 * height;
+ }
+ }
+
+ ///
+ /// Inflates this by the specified amount.
+ ///
+ /// The size.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Inflate(Size size) => this.Inflate(size.Width, size.Height);
+
+ ///
+ /// Determines if the specfied point is contained within the rectangular region defined by
+ /// this .
+ ///
+ /// The x-coordinate of the given point.
+ /// The y-coordinate of the given point.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Contains(int x, int y) => this.X <= x && x < this.Right && this.Y <= y && y < this.Bottom;
+
+ ///
+ /// Determines if the specified point is contained within the rectangular region defined by this .
+ ///
+ /// The point.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Contains(Point point) => this.Contains(point.X, point.Y);
+
+ ///
+ /// Determines if the rectangular region represented by is entirely contained
+ /// within the rectangular region represented by this .
+ ///
+ /// The rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Contains(Rectangle rectangle) =>
+ (this.X <= rectangle.X) && (rectangle.Right <= this.Right) &&
+ (this.Y <= rectangle.Y) && (rectangle.Bottom <= this.Bottom);
+
+ ///
+ /// Determines if the specfied intersects the rectangular region defined by
+ /// this .
+ ///
+ /// The other Rectange.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool IntersectsWith(Rectangle rectangle) =>
+ (rectangle.X < this.Right) && (this.X < rectangle.Right) &&
+ (rectangle.Y < this.Bottom) && (this.Y < rectangle.Bottom);
+
+ ///
+ /// Adjusts the location of this rectangle by the specified amount.
+ ///
+ /// The point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(Point point) => this.Offset(point.X, point.Y);
+
+ ///
+ /// Adjusts the location of this rectangle by the specified amount.
+ ///
+ /// The amount to offset the x-coordinate.
+ /// The amount to offset the y-coordinate.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(int dx, int dy)
+ {
+ unchecked
+ {
+ this.X += dx;
+ this.Y += dy;
+ }
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(this.X, this.Y, this.Width, this.Height);
+ }
+
+ ///
+ public override string ToString()
+ {
+ return $"Rectangle [ X={this.X}, Y={this.Y}, Width={this.Width}, Height={this.Height} ]";
+ }
+
+ ///
+ public override bool Equals(object obj) => obj is Rectangle other && this.Equals(other);
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Equals(Rectangle other) =>
+ this.X.Equals(other.X) &&
+ this.Y.Equals(other.Y) &&
+ this.Width.Equals(other.Width) &&
+ this.Height.Equals(other.Height);
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Primitives/RectangleF.cs b/src/ImageSharp/Primitives/RectangleF.cs
new file mode 100644
index 000000000..354daa446
--- /dev/null
+++ b/src/ImageSharp/Primitives/RectangleF.cs
@@ -0,0 +1,396 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.ComponentModel;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors.ImageSharp
+{
+ ///
+ /// Stores a set of four single precision floating points that represent the location and size of a rectangle.
+ ///
+ ///
+ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
+ /// as it avoids the need to create new values for modification operations.
+ ///
+ public struct RectangleF : IEquatable
+ {
+ ///
+ /// Represents a that has X, Y, Width, and Height values set to zero.
+ ///
+ public static readonly RectangleF Empty = default;
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The horizontal position of the rectangle.
+ /// The vertical position of the rectangle.
+ /// The width of the rectangle.
+ /// The height of the rectangle.
+ public RectangleF(float x, float y, float width, float height)
+ {
+ this.X = x;
+ this.Y = y;
+ this.Width = width;
+ this.Height = height;
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ ///
+ /// The which specifies the rectangles point in a two-dimensional plane.
+ ///
+ ///
+ /// The which specifies the rectangles height and width.
+ ///
+ public RectangleF(PointF point, SizeF size)
+ {
+ this.X = point.X;
+ this.Y = point.Y;
+ this.Width = size.Width;
+ this.Height = size.Height;
+ }
+
+ ///
+ /// Gets or sets the x-coordinate of this .
+ ///
+ public float X { get; set; }
+
+ ///
+ /// Gets or sets the y-coordinate of this .
+ ///
+ public float Y { get; set; }
+
+ ///
+ /// Gets or sets the width of this .
+ ///
+ public float Width { get; set; }
+
+ ///
+ /// Gets or sets the height of this .
+ ///
+ public float Height { get; set; }
+
+ ///
+ /// Gets or sets the coordinates of the upper-left corner of the rectangular region represented by this .
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PointF Location
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => new PointF(this.X, this.Y);
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ set
+ {
+ this.X = value.X;
+ this.Y = value.Y;
+ }
+ }
+
+ ///
+ /// Gets or sets the size of this .
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public SizeF Size
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => new SizeF(this.Width, this.Height);
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ set
+ {
+ this.Width = value.Width;
+ this.Height = value.Height;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether this is empty.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEmpty => (this.Width <= 0) || (this.Height <= 0);
+
+ ///
+ /// Gets the y-coordinate of the top edge of this .
+ ///
+ public float Top => this.Y;
+
+ ///
+ /// Gets the x-coordinate of the right edge of this .
+ ///
+ public float Right
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.X + this.Width;
+ }
+
+ ///
+ /// Gets the y-coordinate of the bottom edge of this .
+ ///
+ public float Bottom
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.Y + this.Height;
+ }
+
+ ///
+ /// Gets the x-coordinate of the left edge of this .
+ ///
+ public float Left => this.X;
+
+ ///
+ /// Creates a with the coordinates of the specified by truncating each coordinate.
+ ///
+ /// The rectangle.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static explicit operator Rectangle(RectangleF rectangle) => Rectangle.Truncate(rectangle);
+
+ ///
+ /// Compares two objects for equality.
+ ///
+ /// The on the left side of the operand.
+ /// The on the right side of the operand.
+ ///
+ /// True if the current left is equal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator ==(RectangleF left, RectangleF 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 current left is unequal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator !=(RectangleF left, RectangleF right) => !left.Equals(right);
+
+ ///
+ /// Creates a new with the specified location and size.
+ /// The left coordinate of the rectangle.
+ /// The top coordinate of the rectangle.
+ /// The right coordinate of the rectangle.
+ /// The bottom coordinate of the rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+
+ // ReSharper disable once InconsistentNaming
+ public static RectangleF FromLTRB(float left, float top, float right, float bottom) => new RectangleF(left, top, right - left, bottom - top);
+
+ ///
+ /// Returns the center point of the given .
+ ///
+ /// The rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static PointF Center(RectangleF rectangle) => new PointF(rectangle.Left + (rectangle.Width / 2), rectangle.Top + (rectangle.Height / 2));
+
+ ///
+ /// Creates a rectangle that represents the intersection between and
+ /// . If there is no intersection, an empty rectangle is returned.
+ ///
+ /// The first rectangle.
+ /// The second rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static RectangleF Intersect(RectangleF a, RectangleF b)
+ {
+ float x1 = MathF.Max(a.X, b.X);
+ float x2 = MathF.Min(a.Right, b.Right);
+ float y1 = MathF.Max(a.Y, b.Y);
+ float y2 = MathF.Min(a.Bottom, b.Bottom);
+
+ if (x2 >= x1 && y2 >= y1)
+ {
+ return new RectangleF(x1, y1, x2 - x1, y2 - y1);
+ }
+
+ return Empty;
+ }
+
+ ///
+ /// Creates a that is inflated by the specified amount.
+ ///
+ /// The rectangle.
+ /// The amount to inflate the width by.
+ /// The amount to inflate the height by.
+ /// A new .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static RectangleF Inflate(RectangleF rectangle, float x, float y)
+ {
+ RectangleF r = rectangle;
+ r.Inflate(x, y);
+ return r;
+ }
+
+ ///
+ /// Transforms a rectangle by the given matrix.
+ ///
+ /// The source rectangle.
+ /// The transformation matrix.
+ /// A transformed .
+ public static RectangleF Transform(RectangleF rectangle, Matrix3x2 matrix)
+ {
+ PointF bottomRight = PointF.Transform(new PointF(rectangle.Right, rectangle.Bottom), matrix);
+ PointF topLeft = PointF.Transform(rectangle.Location, matrix);
+ return new RectangleF(topLeft, new SizeF(bottomRight - topLeft));
+ }
+
+ ///
+ /// Creates a rectangle that represents the union between and .
+ ///
+ /// The first rectangle.
+ /// The second rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static RectangleF Union(RectangleF a, RectangleF b)
+ {
+ float x1 = MathF.Min(a.X, b.X);
+ float x2 = MathF.Max(a.Right, b.Right);
+ float y1 = MathF.Min(a.Y, b.Y);
+ float y2 = MathF.Max(a.Bottom, b.Bottom);
+
+ return new RectangleF(x1, y1, x2 - x1, y2 - y1);
+ }
+
+ ///
+ /// Deconstructs this rectangle into four floats.
+ ///
+ /// The out value for X.
+ /// The out value for Y.
+ /// The out value for the width.
+ /// The out value for the height.
+ public void Deconstruct(out float x, out float y, out float width, out float height)
+ {
+ x = this.X;
+ y = this.Y;
+ width = this.Width;
+ height = this.Height;
+ }
+
+ ///
+ /// Creates a RectangleF that represents the intersection between this RectangleF and the .
+ ///
+ /// The rectangle.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Intersect(RectangleF rectangle)
+ {
+ RectangleF result = Intersect(rectangle, this);
+
+ this.X = result.X;
+ this.Y = result.Y;
+ this.Width = result.Width;
+ this.Height = result.Height;
+ }
+
+ ///
+ /// Inflates this by the specified amount.
+ ///
+ /// The width.
+ /// The height.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Inflate(float width, float height)
+ {
+ this.X -= width;
+ this.Y -= height;
+
+ this.Width += 2 * width;
+ this.Height += 2 * height;
+ }
+
+ ///
+ /// Inflates this by the specified amount.
+ ///
+ /// The size.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Inflate(SizeF size) => this.Inflate(size.Width, size.Height);
+
+ ///
+ /// Determines if the specfied point is contained within the rectangular region defined by
+ /// this .
+ ///
+ /// The x-coordinate of the given point.
+ /// The y-coordinate of the given point.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Contains(float x, float y) => this.X <= x && x < this.Right && this.Y <= y && y < this.Bottom;
+
+ ///
+ /// Determines if the specified point is contained within the rectangular region defined by this .
+ ///
+ /// The point.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Contains(PointF point) => this.Contains(point.X, point.Y);
+
+ ///
+ /// Determines if the rectangular region represented by is entirely contained
+ /// within the rectangular region represented by this .
+ ///
+ /// The rectangle.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Contains(RectangleF rectangle) =>
+ (this.X <= rectangle.X) && (rectangle.Right <= this.Right) &&
+ (this.Y <= rectangle.Y) && (rectangle.Bottom <= this.Bottom);
+
+ ///
+ /// Determines if the specfied intersects the rectangular region defined by
+ /// this .
+ ///
+ /// The other Rectange.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool IntersectsWith(RectangleF rectangle) =>
+ (rectangle.X < this.Right) && (this.X < rectangle.Right) &&
+ (rectangle.Y < this.Bottom) && (this.Y < rectangle.Bottom);
+
+ ///
+ /// Adjusts the location of this rectangle by the specified amount.
+ ///
+ /// The point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(PointF point) => this.Offset(point.X, point.Y);
+
+ ///
+ /// Adjusts the location of this rectangle by the specified amount.
+ ///
+ /// The amount to offset the x-coordinate.
+ /// The amount to offset the y-coordinate.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Offset(float dx, float dy)
+ {
+ this.X += dx;
+ this.Y += dy;
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(this.X, this.Y, this.Width, this.Height);
+ }
+
+ ///
+ public override string ToString()
+ {
+ return $"RectangleF [ X={this.X}, Y={this.Y}, Width={this.Width}, Height={this.Height} ]";
+ }
+
+ ///
+ public override bool Equals(object obj) => obj is RectangleF other && this.Equals(other);
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Equals(RectangleF other) =>
+ this.X.Equals(other.X) &&
+ this.Y.Equals(other.Y) &&
+ this.Width.Equals(other.Width) &&
+ this.Height.Equals(other.Height);
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Primitives/SignedRational.cs b/src/ImageSharp/Primitives/SignedRational.cs
index 395a24b14..93a0ffe39 100644
--- a/src/ImageSharp/Primitives/SignedRational.cs
+++ b/src/ImageSharp/Primitives/SignedRational.cs
@@ -4,7 +4,7 @@
using System;
using System.Globalization;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// Represents a number that can be expressed as a fraction.
diff --git a/src/ImageSharp/Primitives/Size.cs b/src/ImageSharp/Primitives/Size.cs
new file mode 100644
index 000000000..effd657a6
--- /dev/null
+++ b/src/ImageSharp/Primitives/Size.cs
@@ -0,0 +1,296 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.ComponentModel;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors.ImageSharp
+{
+ ///
+ /// Stores an ordered pair of integers, which specify a height and width.
+ ///
+ ///
+ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
+ /// as it avoids the need to create new values for modification operations.
+ ///
+ public struct Size : IEquatable
+ {
+ ///
+ /// Represents a that has Width and Height values set to zero.
+ ///
+ public static readonly Size Empty = default;
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The width and height of the size.
+ public Size(int value)
+ : this()
+ {
+ this.Width = value;
+ this.Height = value;
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The width of the size.
+ /// The height of the size.
+ public Size(int width, int height)
+ {
+ this.Width = width;
+ this.Height = height;
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The size.
+ public Size(Size size)
+ : this()
+ {
+ this.Width = size.Width;
+ this.Height = size.Height;
+ }
+
+ ///
+ /// Initializes a new instance of the struct from the given .
+ ///
+ /// The point.
+ public Size(Point point)
+ {
+ this.Width = point.X;
+ this.Height = point.Y;
+ }
+
+ ///
+ /// Gets or sets the width of this .
+ ///
+ public int Width { get; set; }
+
+ ///
+ /// Gets or sets the height of this .
+ ///
+ public int Height { get; set; }
+
+ ///
+ /// Gets a value indicating whether this is empty.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEmpty => this.Equals(Empty);
+
+ ///
+ /// Creates a with the dimensions of the specified .
+ ///
+ /// The point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator SizeF(Size size) => new SizeF(size.Width, size.Height);
+
+ ///
+ /// Converts the given into a .
+ ///
+ /// The size.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static explicit operator Point(Size size) => new Point(size.Width, size.Height);
+
+ ///
+ /// Computes the sum of adding two sizes.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Size operator +(Size left, Size right) => Add(left, right);
+
+ ///
+ /// Computes the difference left by subtracting one size from another.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Size operator -(Size left, Size right) => Subtract(left, right);
+
+ ///
+ /// Multiplies a by an producing .
+ ///
+ /// Multiplier of type .
+ /// Multiplicand of type .
+ /// Product of type .
+ public static Size operator *(int left, Size right) => Multiply(right, left);
+
+ ///
+ /// Multiplies by an producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type .
+ public static Size operator *(Size left, int right) => Multiply(left, right);
+
+ ///
+ /// Divides by an producing .
+ ///
+ /// Dividend of type .
+ /// Divisor of type .
+ /// Result of type .
+ public static Size operator /(Size left, int right) => new Size(unchecked(left.Width / right), unchecked(left.Height / right));
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplier of type .
+ /// Multiplicand of type .
+ /// Product of type .
+ public static SizeF operator *(float left, Size right) => Multiply(right, left);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type .
+ public static SizeF operator *(Size left, float right) => Multiply(left, right);
+
+ ///
+ /// Divides by a producing .
+ ///
+ /// Dividend of type .
+ /// Divisor of type .
+ /// Result of type .
+ public static SizeF operator /(Size left, float right)
+ => new SizeF(left.Width / right, left.Height / right);
+
+ ///
+ /// Compares two objects for equality.
+ ///
+ ///
+ /// The on the left side of the operand.
+ ///
+ ///
+ /// The on the right side of the operand.
+ ///
+ ///
+ /// True if the current left is equal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator ==(Size left, Size 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 current left is unequal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator !=(Size left, Size right) => !left.Equals(right);
+
+ ///
+ /// Performs vector addition of two objects.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Size Add(Size left, Size right) => new Size(unchecked(left.Width + right.Width), unchecked(left.Height + right.Height));
+
+ ///
+ /// Contracts a by another .
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Size Subtract(Size left, Size right) => new Size(unchecked(left.Width - right.Width), unchecked(left.Height - right.Height));
+
+ ///
+ /// Converts a to a by performing a ceiling operation on all the dimensions.
+ ///
+ /// The size.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Size Ceiling(SizeF size) => new Size(unchecked((int)MathF.Ceiling(size.Width)), unchecked((int)MathF.Ceiling(size.Height)));
+
+ ///
+ /// Converts a to a by performing a round operation on all the dimensions.
+ ///
+ /// The size.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Size Round(SizeF size) => new Size(unchecked((int)MathF.Round(size.Width)), unchecked((int)MathF.Round(size.Height)));
+
+ ///
+ /// Transforms a size by the given matrix.
+ ///
+ /// The source size.
+ /// The transformation matrix.
+ /// A transformed size.
+ public static SizeF Transform(Size size, Matrix3x2 matrix)
+ {
+ var v = Vector2.Transform(new Vector2(size.Width, size.Height), matrix);
+
+ return new SizeF(v.X, v.Y);
+ }
+
+ ///
+ /// Converts a to a by performing a round operation on all the dimensions.
+ ///
+ /// The size.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Size Truncate(SizeF size) => new Size(unchecked((int)size.Width), unchecked((int)size.Height));
+
+ ///
+ /// Deconstructs this size into two integers.
+ ///
+ /// The out value for the width.
+ /// The out value for the height.
+ public void Deconstruct(out int width, out int height)
+ {
+ width = this.Width;
+ height = this.Height;
+ }
+
+ ///
+ public override int GetHashCode() => HashCode.Combine(this.Width, this.Height);
+
+ ///
+ public override string ToString() => $"Size [ Width={this.Width}, Height={this.Height} ]";
+
+ ///
+ public override bool Equals(object obj) => obj is Size other && this.Equals(other);
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Equals(Size other) => this.Width.Equals(other.Width) && this.Height.Equals(other.Height);
+
+ ///
+ /// Multiplies by an producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type .
+ private static Size Multiply(Size size, int multiplier) =>
+ new Size(unchecked(size.Width * multiplier), unchecked(size.Height * multiplier));
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type SizeF.
+ private static SizeF Multiply(Size size, float multiplier) =>
+ new SizeF(size.Width * multiplier, size.Height * multiplier);
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Primitives/SizeF.cs b/src/ImageSharp/Primitives/SizeF.cs
new file mode 100644
index 000000000..7d9bc5814
--- /dev/null
+++ b/src/ImageSharp/Primitives/SizeF.cs
@@ -0,0 +1,233 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.ComponentModel;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace SixLabors.ImageSharp
+{
+ ///
+ /// Stores an ordered pair of single precision floating points, which specify a height and width.
+ ///
+ ///
+ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
+ /// as it avoids the need to create new values for modification operations.
+ ///
+ public struct SizeF : IEquatable
+ {
+ ///
+ /// Represents a that has Width and Height values set to zero.
+ ///
+ public static readonly SizeF Empty = default;
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The width of the size.
+ /// The height of the size.
+ public SizeF(float width, float height)
+ {
+ this.Width = width;
+ this.Height = height;
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The size.
+ public SizeF(SizeF size)
+ : this()
+ {
+ this.Width = size.Width;
+ this.Height = size.Height;
+ }
+
+ ///
+ /// Initializes a new instance of the struct from the given .
+ ///
+ /// The point.
+ public SizeF(PointF point)
+ {
+ this.Width = point.X;
+ this.Height = point.Y;
+ }
+
+ ///
+ /// Gets or sets the width of this .
+ ///
+ public float Width { get; set; }
+
+ ///
+ /// Gets or sets the height of this .
+ ///
+ public float Height { get; set; }
+
+ ///
+ /// Gets a value indicating whether this is empty.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEmpty => this.Equals(Empty);
+
+ ///
+ /// Creates a with the coordinates of the specified .
+ ///
+ /// The point.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static implicit operator Vector2(SizeF point) => new Vector2(point.Width, point.Height);
+
+ ///
+ /// Creates a with the dimensions of the specified by truncating each of the dimensions.
+ ///
+ /// The size.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static explicit operator Size(SizeF size) => new Size(unchecked((int)size.Width), unchecked((int)size.Height));
+
+ ///
+ /// Converts the given into a .
+ ///
+ /// The size.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static explicit operator PointF(SizeF size) => new PointF(size.Width, size.Height);
+
+ ///
+ /// Computes the sum of adding two sizes.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static SizeF operator +(SizeF left, SizeF right) => Add(left, right);
+
+ ///
+ /// Computes the difference left by subtracting one size from another.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// The .
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static SizeF operator -(SizeF left, SizeF right) => Subtract(left, right);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplier of type .
+ /// Multiplicand of type .
+ /// Product of type .
+ public static SizeF operator *(float left, SizeF right) => Multiply(right, left);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type .
+ public static SizeF operator *(SizeF left, float right) => Multiply(left, right);
+
+ ///
+ /// Divides by a producing .
+ ///
+ /// Dividend of type .
+ /// Divisor of type .
+ /// Result of type .
+ public static SizeF operator /(SizeF left, float right)
+ => new SizeF(left.Width / right, left.Height / right);
+
+ ///
+ /// Compares two objects for equality.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// True if the current left is equal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator ==(SizeF left, SizeF right) => left.Equals(right);
+
+ ///
+ /// Compares two objects for inequality.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ ///
+ /// True if the current left is unequal to the parameter; otherwise, false.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool operator !=(SizeF left, SizeF right) => !left.Equals(right);
+
+ ///
+ /// Performs vector addition of two objects.
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static SizeF Add(SizeF left, SizeF right) => new SizeF(left.Width + right.Width, left.Height + right.Height);
+
+ ///
+ /// Contracts a by another .
+ ///
+ /// The size on the left hand of the operand.
+ /// The size on the right hand of the operand.
+ /// The .
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static SizeF Subtract(SizeF left, SizeF right) => new SizeF(left.Width - right.Width, left.Height - right.Height);
+
+ ///
+ /// Transforms a size by the given matrix.
+ ///
+ /// The source size.
+ /// The transformation matrix.
+ /// A transformed size.
+ public static SizeF Transform(SizeF size, Matrix3x2 matrix)
+ {
+ var v = Vector2.Transform(new Vector2(size.Width, size.Height), matrix);
+
+ return new SizeF(v.X, v.Y);
+ }
+
+ ///
+ /// Deconstructs this size into two floats.
+ ///
+ /// The out value for the width.
+ /// The out value for the height.
+ public void Deconstruct(out float width, out float height)
+ {
+ width = this.Width;
+ height = this.Height;
+ }
+
+ ///
+ public override int GetHashCode() => HashCode.Combine(this.Width, this.Height);
+
+ ///
+ public override string ToString() => $"SizeF [ Width={this.Width}, Height={this.Height} ]";
+
+ ///
+ public override bool Equals(object obj) => obj is SizeF && this.Equals((SizeF)obj);
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool Equals(SizeF other) => this.Width.Equals(other.Width) && this.Height.Equals(other.Height);
+
+ ///
+ /// Multiplies by a producing .
+ ///
+ /// Multiplicand of type .
+ /// Multiplier of type .
+ /// Product of type SizeF.
+ private static SizeF Multiply(SizeF size, float multiplier) =>
+ new SizeF(size.Width * multiplier, size.Height * multiplier);
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Primitives/ValueSize.cs b/src/ImageSharp/Primitives/ValueSize.cs
index 577e9187a..be2ccb725 100644
--- a/src/ImageSharp/Primitives/ValueSize.cs
+++ b/src/ImageSharp/Primitives/ValueSize.cs
@@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.Primitives;
-namespace SixLabors.ImageSharp.Primitives
+namespace SixLabors.ImageSharp
{
///
/// Represents a value in relation to a value on the image.
diff --git a/src/ImageSharp/Processing/AffineTransformBuilder.cs b/src/ImageSharp/Processing/AffineTransformBuilder.cs
index c3d01241c..90e00924a 100644
--- a/src/ImageSharp/Processing/AffineTransformBuilder.cs
+++ b/src/ImageSharp/Processing/AffineTransformBuilder.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Numerics;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs b/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs
index 5d986b6cc..a4a3f9b3d 100644
--- a/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs
+++ b/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Binarization/BinaryDiffuseExtensions.cs b/src/ImageSharp/Processing/Extensions/Binarization/BinaryDiffuseExtensions.cs
index 760102aac..66337f669 100644
--- a/src/ImageSharp/Processing/Extensions/Binarization/BinaryDiffuseExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Binarization/BinaryDiffuseExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Processing.Processors.Binarization;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs b/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs
index e8ce252a2..afd4a4941 100644
--- a/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Processing.Processors.Binarization;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs b/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
index 35aa681e3..d4fe9b562 100644
--- a/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Binarization;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs
index 2bbdd03b0..7e0b3df39 100644
--- a/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs
index 42dfd425c..4534e474a 100644
--- a/src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs
index 837b26910..53b2d40b0 100644
--- a/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Processing.Processors.Convolution;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs
index 858e3213b..9c40d94ed 100644
--- a/src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs
index 79f4a0cc3..007fffb1a 100644
--- a/src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Dithering/DiffuseExtensions.cs b/src/ImageSharp/Processing/Extensions/Dithering/DiffuseExtensions.cs
index 45eb932fe..92d312fdf 100644
--- a/src/ImageSharp/Processing/Extensions/Dithering/DiffuseExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Dithering/DiffuseExtensions.cs
@@ -4,7 +4,6 @@
using System;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs b/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs
index f83a9e9e8..f58b025f3 100644
--- a/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs
@@ -4,7 +4,6 @@
using System;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Drawing/DrawImageExtensions.cs b/src/ImageSharp/Processing/Extensions/Drawing/DrawImageExtensions.cs
index 6c7998437..4717c09ea 100644
--- a/src/ImageSharp/Processing/Extensions/Drawing/DrawImageExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Drawing/DrawImageExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Drawing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs
index 1aa98c8c1..521617281 100644
--- a/src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Effects;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Effects/PixelShaderExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/PixelShaderExtensions.cs
index b866e7fb1..00fd54267 100644
--- a/src/ImageSharp/Processing/Extensions/Effects/PixelShaderExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Effects/PixelShaderExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Effects;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs
index bf40af91a..f2a10532d 100644
--- a/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Effects;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs
index c148ccbcb..788677fc8 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs
index 8e43f06c5..7bc441297 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs
index b8d503955..e214c5a16 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs
index bdfd7c98a..4a3e460b8 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs
index 662e3a6e1..088f61884 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs
@@ -1,9 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs
index d87c40226..4125de832 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs
index 3955ea7f6..ef1fa2a6e 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs
index 16c7a8917..0642db849 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs
index 6c9b27983..eadbde7bc 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs
index 86db9509e..d68cb6aac 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs
index c2b6ac080..84b11c5e7 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs
index 9c67113ec..2cf6085f3 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs
index 6b6d43d5b..94ced7108 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs
index a94a9a407..f68c424bd 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs
index df32307f4..629ba03e7 100644
--- a/src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs b/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs
index 4241721f4..d068ba10b 100644
--- a/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Overlays;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs b/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs
index 48ecb5108..d5114e30a 100644
--- a/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs
@@ -1,9 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs b/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs
index a1f3a6e8a..799b30e01 100644
--- a/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs
@@ -1,9 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs
index 7ec85169e..5fc8125ea 100644
--- a/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs
index 270380084..33a6fc36d 100644
--- a/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing
{
///
diff --git a/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs
index f494ed909..882b17721 100644
--- a/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs
index 7fffb71d2..630564955 100644
--- a/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs
@@ -4,7 +4,6 @@
using System.Numerics;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/IImageProcessingContext.cs b/src/ImageSharp/Processing/IImageProcessingContext.cs
index e10c14088..8b57a289d 100644
--- a/src/ImageSharp/Processing/IImageProcessingContext.cs
+++ b/src/ImageSharp/Processing/IImageProcessingContext.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/KnownFilterMatrices.cs b/src/ImageSharp/Processing/KnownFilterMatrices.cs
index 31b19433c..268281e4f 100644
--- a/src/ImageSharp/Processing/KnownFilterMatrices.cs
+++ b/src/ImageSharp/Processing/KnownFilterMatrices.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.ImageSharp.Primitives;
// Many of these matrices are translated from Chromium project where
// SkScalar[] is memory-mapped to a row-major matrix.
diff --git a/src/ImageSharp/Processing/PositionAwarePixelShader.cs b/src/ImageSharp/Processing/PositionAwarePixelShader.cs
index 1ae3ba295..c87d3ada6 100644
--- a/src/ImageSharp/Processing/PositionAwarePixelShader.cs
+++ b/src/ImageSharp/Processing/PositionAwarePixelShader.cs
@@ -3,7 +3,6 @@
using System;
using System.Numerics;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor.cs
index caedf87ba..287853979 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
{
diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor{TPixel}.cs
index cdea1780f..262e9d024 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor{TPixel}.cs
@@ -6,7 +6,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
{
diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor.cs
index 6a2ee7623..1626bbe80 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor.cs
@@ -5,7 +5,6 @@ using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
{
diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor{TPixel}.cs
index 64fb617c6..66b92d1ce 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor{TPixel}.cs
@@ -6,7 +6,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
{
diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
index 102232b13..7bfb02446 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
{
diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs
index 45cb1d9f7..380ce64d2 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs
@@ -6,7 +6,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
{
diff --git a/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs b/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs
index 3b88cf7f0..92c84a945 100644
--- a/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors
{
diff --git a/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs
index 780bec22c..c539861f9 100644
--- a/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs
@@ -2,10 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Collections.Generic;
-using System.Linq;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs
index 477c3da9a..6bb02f1d1 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs
index 6ffda59a8..316579da7 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs
@@ -11,10 +11,7 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Convolution.Parameters;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs
index 94ecce9d1..7ca4b6c6f 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs
index f127fc1a8..095c91bac 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor{TPixel}.cs
index 44faf3eb1..c2b85a4ab 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor{TPixel}.cs
@@ -8,8 +8,6 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs
index 5182d90b1..32bdf6bc5 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs
@@ -8,8 +8,6 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs
index 661ab523d..34b085fc6 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs
@@ -3,8 +3,6 @@
using System;
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
internal static class ConvolutionProcessorHelpers
diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs
index 6f0e7914b..285bcab27 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs
@@ -8,8 +8,6 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs
index dbd82191c..31c4fad79 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs
@@ -2,9 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs
index f3940bb73..c1897bed8 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs
@@ -9,9 +9,7 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor.cs
index f369d60dd..eb7f07905 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor{TPixel}.cs
index e6411f8cb..ce19ba82d 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor{TPixel}.cs
@@ -2,9 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Filters;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs
index bdba8f4ca..9f511a754 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor{TPixel}.cs
index 2ccd8d577..3c1f82caa 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor{TPixel}.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs
index d1b2b3072..b1f47863d 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor{TPixel}.cs
index d61d8e6c5..f4f27a42d 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor{TPixel}.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
diff --git a/src/ImageSharp/Processing/Processors/Convolution/KayyaliProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/KayyaliProcessor.cs
index cc29be983..90ed15aa3 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/KayyaliProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/KayyaliProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/CompassKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/CompassKernels.cs
index f44de9105..423fc6591 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/CompassKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/CompassKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
internal abstract class CompassKernels
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/KayyaliKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/KayyaliKernels.cs
index dd4d02302..50d5bfafe 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/KayyaliKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/KayyaliKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/KirschKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/KirschKernels.cs
index 882b87075..58568ce40 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/KirschKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/KirschKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernelFactory.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernelFactory.cs
index 19f2d1161..8371212fe 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernelFactory.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernelFactory.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernels.cs
index e7b7f965b..f72e95ee8 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/LaplacianKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/PrewittKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/PrewittKernels.cs
index 381e028d4..cae9ecb5b 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/PrewittKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/PrewittKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobertsCrossKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobertsCrossKernels.cs
index f61220e1e..8ffd624d2 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobertsCrossKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobertsCrossKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobinsonKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobinsonKernels.cs
index 699d669ec..ba60bfdf6 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobinsonKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/RobinsonKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/ScharrKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/ScharrKernels.cs
index f0662c667..ec583862f 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/ScharrKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/ScharrKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/SobelKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/SobelKernels.cs
index 113957c83..3dbd54a2c 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/SobelKernels.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/SobelKernels.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/KirschProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/KirschProcessor.cs
index 182a30c08..7207f95c4 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/KirschProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/KirschProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Laplacian3x3Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/Laplacian3x3Processor.cs
index 163420f3d..b147a87cc 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Laplacian3x3Processor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Laplacian3x3Processor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Laplacian5x5Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/Laplacian5x5Processor.cs
index 77cfffced..663ebf051 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Laplacian5x5Processor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Laplacian5x5Processor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/LaplacianOfGaussianProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/LaplacianOfGaussianProcessor.cs
index a8d3ff6f1..8b0cfc6ff 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/LaplacianOfGaussianProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/LaplacianOfGaussianProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelData.cs b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelData.cs
index 4338bcf6b..5f03396ba 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelData.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelData.cs
@@ -3,8 +3,6 @@
using System.Numerics;
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution.Parameters
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/PrewittProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/PrewittProcessor.cs
index dcb20573a..7fc54ff96 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/PrewittProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/PrewittProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossProcessor.cs
index 84b685467..74d5094f5 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/RobinsonProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/RobinsonProcessor.cs
index 34c4ab35a..18ac90614 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/RobinsonProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/RobinsonProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/ScharrProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/ScharrProcessor.cs
index 76a4ae08d..24248204b 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/ScharrProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/ScharrProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Convolution/SobelProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/SobelProcessor.cs
index 185ac891d..1ab56d120 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/SobelProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/SobelProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/AtkinsonDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/AtkinsonDiffuser.cs
index f167ac5cb..9cf10ce59 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/AtkinsonDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/AtkinsonDiffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/BurksDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/BurksDiffuser.cs
index 3c1ff75f4..152704ec2 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/BurksDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/BurksDiffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffuser.cs
index 7911c6ca9..d6ccfb369 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffuser.cs
@@ -6,7 +6,6 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor.cs
index 48ad546f2..059816065 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor{TPixel}.cs
index ff4b6de52..f0c8610ed 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/FloydSteinbergDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/FloydSteinbergDiffuser.cs
index ca0e3c647..b3137337b 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/FloydSteinbergDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/FloydSteinbergDiffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/JarvisJudiceNinkeDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/JarvisJudiceNinkeDiffuser.cs
index 682db8352..40cf79266 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/JarvisJudiceNinkeDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/JarvisJudiceNinkeDiffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs
index 174732f80..34eff4fe9 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs
index 4b93c4259..f4835f421 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor.cs
index d66ce2192..e28c662f8 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor{TPixel}.cs
index 6568033ea..29baa9750 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor.cs b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor.cs
index a8f46f3ad..0a1552c11 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor.cs
@@ -4,7 +4,6 @@
using System;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs
index 10c9a421e..c9f09fc62 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs
@@ -8,7 +8,6 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
diff --git a/src/ImageSharp/Processing/Processors/Dithering/Sierra2Diffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/Sierra2Diffuser.cs
index 03791bff2..001df19af 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/Sierra2Diffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/Sierra2Diffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/Sierra3Diffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/Sierra3Diffuser.cs
index c7d7acc82..3e56c63b3 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/Sierra3Diffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/Sierra3Diffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/SierraLiteDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/SierraLiteDiffuser.cs
index e969f1b70..763695d66 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/SierraLiteDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/SierraLiteDiffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/StevensonArceDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/StevensonArceDiffuser.cs
index 61727325a..72ff30c11 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/StevensonArceDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/StevensonArceDiffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Dithering/StuckiDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/StuckiDiffuser.cs
index 76203201c..78e8fb4e4 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/StuckiDiffuser.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/StuckiDiffuser.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Dithering
{
///
diff --git a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs
index e1dbefdb6..032a0aab0 100644
--- a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Drawing
{
diff --git a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs
index 55f72c7fc..a8b9093e5 100644
--- a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs
+++ b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs
@@ -6,7 +6,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Drawing
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs
index 0e11020eb..a35e4d828 100644
--- a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs
index f143e5643..3bc6e7eac 100644
--- a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs
@@ -8,7 +8,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor.cs
index 2d43fd53c..fef80dfc4 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs b/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs
index 9cee3779d..681f44651 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs
@@ -7,7 +7,6 @@ using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor{TPixel}.cs
index a4338423e..244cfe3a7 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using System;
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs
index 9b67545e5..a71f8424f 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor{TPixel}.cs
index d15bfc007..df85afc5e 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor{TPixel}.cs
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Common;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor.cs
index 46d2e31cf..7494f6ffc 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor{TPixel}.cs
index db2d85bfc..a539b5105 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using System;
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
diff --git a/src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs
index 028060f66..1542c6836 100644
--- a/src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Filters
{
diff --git a/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs
index 86d990a38..28a5837de 100644
--- a/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs
@@ -6,8 +6,6 @@ using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Filters
{
diff --git a/src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs
index 8836bd62c..3c150d7eb 100644
--- a/src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Filters
{
///
diff --git a/src/ImageSharp/Processing/Processors/Filters/LomographProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Filters/LomographProcessor{TPixel}.cs
index 30731fcbf..8e3759fba 100644
--- a/src/ImageSharp/Processing/Processors/Filters/LomographProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Filters/LomographProcessor{TPixel}.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Filters
{
diff --git a/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs
index 9a8c2b518..a5cf26862 100644
--- a/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Filters
{
///
diff --git a/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor{TPixel}.cs
index 08235e1bf..24ee16296 100644
--- a/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor{TPixel}.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Filters
{
diff --git a/src/ImageSharp/Processing/Processors/ICloningImageProcessor.cs b/src/ImageSharp/Processing/Processors/ICloningImageProcessor.cs
index 7ffa5bcc0..ad8051e6b 100644
--- a/src/ImageSharp/Processing/Processors/ICloningImageProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/ICloningImageProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors
{
diff --git a/src/ImageSharp/Processing/Processors/IImageProcessor.cs b/src/ImageSharp/Processing/Processors/IImageProcessor.cs
index 6b9b82b10..a9d5b20ec 100644
--- a/src/ImageSharp/Processing/Processors/IImageProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/IImageProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors
{
diff --git a/src/ImageSharp/Processing/Processors/ImageProcessorExtensions.cs b/src/ImageSharp/Processing/Processors/ImageProcessorExtensions.cs
index 7956ecd9a..6f486e74b 100644
--- a/src/ImageSharp/Processing/Processors/ImageProcessorExtensions.cs
+++ b/src/ImageSharp/Processing/Processors/ImageProcessorExtensions.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors
{
diff --git a/src/ImageSharp/Processing/Processors/ImageProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/ImageProcessor{TPixel}.cs
index 21d245a11..be8bc8e12 100644
--- a/src/ImageSharp/Processing/Processors/ImageProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/ImageProcessor{TPixel}.cs
@@ -2,9 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors
{
diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor.cs
index 6d8ccdca3..1fdb10661 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
///
diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs
index 0e664a598..b5b8cfe56 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs
@@ -11,8 +11,6 @@ using System.Threading.Tasks;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor.cs
index cd29b18b9..ff8a6b73d 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
///
diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs
index 901668e1f..987e4e392 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs
@@ -11,8 +11,6 @@ using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
diff --git a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor.cs b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor.cs
index 288b59d6b..3b984578b 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
///
diff --git a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs
index f75655006..ff34457fb 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs
@@ -11,8 +11,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
diff --git a/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor.cs b/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor.cs
index 7c1969ae2..8bd619095 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
diff --git a/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor{TPixel}.cs
index 8c25448d1..d7d72d4c8 100644
--- a/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor{TPixel}.cs
@@ -6,7 +6,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{
diff --git a/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs
index 6531c7461..c9123bbbf 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
{
diff --git a/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor{TPixel}.cs
index 0d9ee263a..1c974612e 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor{TPixel}.cs
@@ -8,7 +8,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
{
diff --git a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
index 13936232a..4f7ce7ba7 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
{
diff --git a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs
index 3f52a1c88..d6aa6f894 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs
@@ -9,7 +9,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
{
diff --git a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
index ebec16062..9915a5f52 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
{
diff --git a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs
index 41f11f5af..fd782261b 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs
@@ -9,7 +9,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
{
diff --git a/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor.cs
index 0ac6b9b9c..8e1dffeed 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Quantization
{
diff --git a/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor{TPixel}.cs
index 29b4c70c1..5e732982c 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Quantization
{
diff --git a/src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs
index cbea82c1f..4938f0e12 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs
@@ -6,7 +6,6 @@ using System.Buffers;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Processing.Processors.Quantization
{
diff --git a/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs
index ee2751eaf..9b5e89427 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs
@@ -9,7 +9,6 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
// TODO: Isn't an AOS ("array of structures") layout more efficient & more readable than SOA ("structure of arrays") for this particular use case?
// (T, R, G, B, A, M2) could be grouped together! Investigate a ColorMoment struct.
diff --git a/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs
index ffd5bc2d7..849f06166 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor{TPixel}.cs
index 9251b95fc..1b9ff82bf 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor{TPixel}.cs
@@ -6,7 +6,6 @@ using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs
index e17588cd0..a059fb819 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor{TPixel}.cs
index ebc81b604..90edcfac5 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using System;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs
index 39f00e9a1..9aa21e4dc 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
///
diff --git a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs
index b63036a01..a286e8fa2 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs
index fdba6ed4f..d5aaaf515 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor{TPixel}.cs
index 62cd24fa0..74d719fbe 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor{TPixel}.cs
@@ -5,7 +5,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Binarization;
using SixLabors.ImageSharp.Processing.Processors.Convolution;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs
index 455edf668..60e22e2d0 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor{TPixel}.cs
index cbae932b8..d3afc7205 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor{TPixel}.cs
@@ -7,7 +7,6 @@ using System.Buffers;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs
index 93ff800c8..d8a9c3ed9 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor{TPixel}.cs
index f924ef3c9..56df606a7 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor{TPixel}.cs
@@ -7,7 +7,6 @@ using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs
index eacd3834f..de44d32e4 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs
@@ -3,7 +3,6 @@
using System;
using System.Numerics;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.PeriodicKernelMap.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.PeriodicKernelMap.cs
index 6d6e22a6a..be2546369 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.PeriodicKernelMap.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.PeriodicKernelMap.cs
@@ -1,7 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs
index 64c74a8b4..1b653a92c 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs
@@ -7,7 +7,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor.cs
index 87b202ff7..ec1f94c14 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
///
diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs
index 24752ae48..2e94f88ac 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs
@@ -7,8 +7,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs
index 52faac0cd..4f5faa38e 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs
@@ -9,8 +9,6 @@ using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs
index 016395317..aae66e9ea 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor{TPixel}.cs
index 6adab8bdf..8f1cf28ce 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor{TPixel}.cs
@@ -7,7 +7,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs
index fb2114e03..4d0733334 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/TransformKernelMap.cs b/src/ImageSharp/Processing/Processors/Transforms/TransformKernelMap.cs
index 573120888..a0d44cb7a 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/TransformKernelMap.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/TransformKernelMap.cs
@@ -7,7 +7,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/TransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/TransformProcessor.cs
index 513e6962e..3a0a7e54e 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/TransformProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/TransformProcessor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/TransformProcessorHelpers.cs b/src/ImageSharp/Processing/Processors/Transforms/TransformProcessorHelpers.cs
index abc8c9d43..14eeca7cc 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/TransformProcessorHelpers.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/TransformProcessorHelpers.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs b/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs
index 794645550..e0fb55438 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs
@@ -4,7 +4,6 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
diff --git a/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs b/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs
index c29941d07..0ff693d81 100644
--- a/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs
+++ b/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Numerics;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/src/ImageSharp/Processing/ResizeOptions.cs b/src/ImageSharp/Processing/ResizeOptions.cs
index ef88dc35b..b54d2eae1 100644
--- a/src/ImageSharp/Processing/ResizeOptions.cs
+++ b/src/ImageSharp/Processing/ResizeOptions.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
{
diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props
index 22c634d9b..3d8286971 100644
--- a/tests/Directory.Build.props
+++ b/tests/Directory.Build.props
@@ -28,6 +28,9 @@
+
+
+
diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets
index 26baee07e..9ee9c226d 100644
--- a/tests/Directory.Build.targets
+++ b/tests/Directory.Build.targets
@@ -25,7 +25,7 @@
-
+
true
true
opencover
diff --git a/tests/ImageSharp.Benchmarks/Codecs/DecodeBmp.cs b/tests/ImageSharp.Benchmarks/Codecs/DecodeBmp.cs
index 1ab5ed309..6be1998fb 100644
--- a/tests/ImageSharp.Benchmarks/Codecs/DecodeBmp.cs
+++ b/tests/ImageSharp.Benchmarks/Codecs/DecodeBmp.cs
@@ -1,13 +1,12 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Drawing;
using System.IO;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests;
-using CoreSize = SixLabors.Primitives.Size;
using SDImage = System.Drawing.Image;
+using SDSize = System.Drawing.Size;
namespace SixLabors.ImageSharp.Benchmarks.Codecs
{
@@ -31,7 +30,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
public string TestImage { get; set; }
[Benchmark(Baseline = true, Description = "System.Drawing Bmp")]
- public Size BmpSystemDrawing()
+ public SDSize BmpSystemDrawing()
{
using (var memoryStream = new MemoryStream(this.bmpBytes))
{
@@ -43,15 +42,15 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
}
[Benchmark(Description = "ImageSharp Bmp")]
- public CoreSize BmpCore()
+ public Size BmpCore()
{
using (var memoryStream = new MemoryStream(this.bmpBytes))
{
using (var image = Image.Load(memoryStream))
{
- return new CoreSize(image.Width, image.Height);
+ return new Size(image.Width, image.Height);
}
}
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/ImageSharp.Benchmarks/Codecs/DecodeFilteredPng.cs b/tests/ImageSharp.Benchmarks/Codecs/DecodeFilteredPng.cs
index cc946e05a..e4723d3a0 100644
--- a/tests/ImageSharp.Benchmarks/Codecs/DecodeFilteredPng.cs
+++ b/tests/ImageSharp.Benchmarks/Codecs/DecodeFilteredPng.cs
@@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests;
-using CoreSize = SixLabors.Primitives.Size;
+using CoreSize = SixLabors.ImageSharp.Size;
namespace SixLabors.ImageSharp.Benchmarks.Codecs
{
diff --git a/tests/ImageSharp.Benchmarks/Codecs/DecodeGif.cs b/tests/ImageSharp.Benchmarks/Codecs/DecodeGif.cs
index be7e85300..82dd57c29 100644
--- a/tests/ImageSharp.Benchmarks/Codecs/DecodeGif.cs
+++ b/tests/ImageSharp.Benchmarks/Codecs/DecodeGif.cs
@@ -1,13 +1,12 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Drawing;
using System.IO;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests;
-using CoreSize = SixLabors.Primitives.Size;
using SDImage = System.Drawing.Image;
+using SDSize = System.Drawing.Size;
namespace SixLabors.ImageSharp.Benchmarks.Codecs
{
@@ -31,7 +30,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
public string TestImage { get; set; }
[Benchmark(Baseline = true, Description = "System.Drawing Gif")]
- public Size GifSystemDrawing()
+ public SDSize GifSystemDrawing()
{
using (var memoryStream = new MemoryStream(this.gifBytes))
{
@@ -43,13 +42,13 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
}
[Benchmark(Description = "ImageSharp Gif")]
- public CoreSize GifCore()
+ public Size GifCore()
{
using (var memoryStream = new MemoryStream(this.gifBytes))
{
using (var image = Image.Load(memoryStream))
{
- return new CoreSize(image.Width, image.Height);
+ return new Size(image.Width, image.Height);
}
}
}
diff --git a/tests/ImageSharp.Benchmarks/Codecs/DecodePng.cs b/tests/ImageSharp.Benchmarks/Codecs/DecodePng.cs
index a19d8fa91..b69dd36d7 100644
--- a/tests/ImageSharp.Benchmarks/Codecs/DecodePng.cs
+++ b/tests/ImageSharp.Benchmarks/Codecs/DecodePng.cs
@@ -1,13 +1,12 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Drawing;
using System.IO;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests;
-using CoreSize = SixLabors.Primitives.Size;
using SDImage = System.Drawing.Image;
+using SDSize = System.Drawing.Size;
namespace SixLabors.ImageSharp.Benchmarks.Codecs
{
@@ -31,7 +30,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
}
[Benchmark(Baseline = true, Description = "System.Drawing Png")]
- public Size PngSystemDrawing()
+ public SDSize PngSystemDrawing()
{
using (var memoryStream = new MemoryStream(this.pngBytes))
{
@@ -43,7 +42,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
}
[Benchmark(Description = "ImageSharp Png")]
- public CoreSize PngCore()
+ public Size PngCore()
{
using (var memoryStream = new MemoryStream(this.pngBytes))
{
diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs
index f40c15cc1..5b783dddc 100644
--- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs
+++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs
@@ -1,11 +1,11 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using BenchmarkDotNet.Attributes;
-using System.Drawing;
using System.IO;
+using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Tests;
+using SDSize = System.Drawing.Size;
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
{
@@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
}
[Benchmark(Baseline = true, Description = "System.Drawing FULL")]
- public Size JpegSystemDrawing()
+ public SDSize JpegSystemDrawing()
{
using (var memoryStream = new MemoryStream(this.jpegBytes))
{
diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs
index 17ad79e58..6a2040afc 100644
--- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs
+++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Drawing;
using System.IO;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
@@ -12,8 +11,8 @@ using BenchmarkDotNet.Jobs;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests;
-using CoreSize = SixLabors.Primitives.Size;
using SDImage = System.Drawing.Image;
+using SDSize = System.Drawing.Size;
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
@@ -72,7 +71,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
}
[Benchmark(Baseline = true, Description = "Decode Jpeg - System.Drawing")]
- public Size JpegSystemDrawing()
+ public SDSize JpegSystemDrawing()
{
using (var memoryStream = new MemoryStream(this.jpegBytes))
{
@@ -84,13 +83,13 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
}
[Benchmark(Description = "Decode Jpeg - ImageSharp")]
- public CoreSize JpegImageSharp()
+ public Size JpegImageSharp()
{
using (var memoryStream = new MemoryStream(this.jpegBytes))
{
using (var image = Image.Load(memoryStream, new JpegDecoder { IgnoreMetadata = true }))
{
- return new CoreSize(image.Width, image.Height);
+ return new Size(image.Width, image.Height);
}
}
}
diff --git a/tests/ImageSharp.Benchmarks/General/Array2D.cs b/tests/ImageSharp.Benchmarks/General/Array2D.cs
index 1f8961fcd..fe7fd2090 100644
--- a/tests/ImageSharp.Benchmarks/General/Array2D.cs
+++ b/tests/ImageSharp.Benchmarks/General/Array2D.cs
@@ -5,7 +5,7 @@ using System;
using BenchmarkDotNet.Attributes;
-using SixLabors.ImageSharp.Primitives;
+using SixLabors.ImageSharp;
namespace SixLabors.ImageSharp.Benchmarks.General
{
diff --git a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs
index ce4e16c44..4241a12f6 100644
--- a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs
+++ b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs
@@ -13,7 +13,7 @@ using SixLabors.ImageSharp.PixelFormats.PixelBlenders;
namespace SixLabors.ImageSharp.Benchmarks
{
- using CoreSize = SixLabors.Primitives.Size;
+ using CoreSize = SixLabors.ImageSharp.Size;
public class PorterDuffBulkVsPixel : BenchmarkBase
{
diff --git a/tests/ImageSharp.Benchmarks/Samplers/Crop.cs b/tests/ImageSharp.Benchmarks/Samplers/Crop.cs
index 4fe7a365f..e60ff8f02 100644
--- a/tests/ImageSharp.Benchmarks/Samplers/Crop.cs
+++ b/tests/ImageSharp.Benchmarks/Samplers/Crop.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
@@ -9,14 +9,16 @@ using System.Drawing.Drawing2D;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.Processing;
-using CoreSize = SixLabors.Primitives.Size;
+using SDImage = System.Drawing.Image;
+using SDSize = System.Drawing.Size;
+using SDRectangle = System.Drawing.Rectangle;
namespace SixLabors.ImageSharp.Benchmarks
{
public class Crop : BenchmarkBase
{
[Benchmark(Baseline = true, Description = "System.Drawing Crop")]
- public Size CropSystemDrawing()
+ public SDSize CropSystemDrawing()
{
using (var source = new Bitmap(800, 800))
using (var destination = new Bitmap(100, 100))
@@ -25,19 +27,19 @@ namespace SixLabors.ImageSharp.Benchmarks
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
- graphics.DrawImage(source, new Rectangle(0, 0, 100, 100), 0, 0, 100, 100, GraphicsUnit.Pixel);
+ graphics.DrawImage(source, new SDRectangle(0, 0, 100, 100), 0, 0, 100, 100, GraphicsUnit.Pixel);
return destination.Size;
}
}
[Benchmark(Description = "ImageSharp Crop")]
- public CoreSize CropResizeCore()
+ public Size CropResizeCore()
{
using (var image = new Image(800, 800))
{
image.Mutate(x => x.Crop(100, 100));
- return new CoreSize(image.Width, image.Height);
+ return new Size(image.Width, image.Height);
}
}
}
diff --git a/tests/ImageSharp.Benchmarks/Samplers/Diffuse.cs b/tests/ImageSharp.Benchmarks/Samplers/Diffuse.cs
index c2b9cdc19..e5b12a0a2 100644
--- a/tests/ImageSharp.Benchmarks/Samplers/Diffuse.cs
+++ b/tests/ImageSharp.Benchmarks/Samplers/Diffuse.cs
@@ -1,7 +1,7 @@
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
+using SixLabors.ImageSharp;
namespace SixLabors.ImageSharp.Benchmarks.Samplers
{
diff --git a/tests/ImageSharp.Benchmarks/Samplers/Rotate.cs b/tests/ImageSharp.Benchmarks/Samplers/Rotate.cs
index 69ff1549b..244a0bb41 100644
--- a/tests/ImageSharp.Benchmarks/Samplers/Rotate.cs
+++ b/tests/ImageSharp.Benchmarks/Samplers/Rotate.cs
@@ -4,7 +4,7 @@
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
+using SixLabors.ImageSharp;
namespace SixLabors.ImageSharp.Benchmarks.Samplers
{
diff --git a/tests/ImageSharp.Benchmarks/Samplers/Skew.cs b/tests/ImageSharp.Benchmarks/Samplers/Skew.cs
index 559e49704..4061120b7 100644
--- a/tests/ImageSharp.Benchmarks/Samplers/Skew.cs
+++ b/tests/ImageSharp.Benchmarks/Samplers/Skew.cs
@@ -4,7 +4,7 @@
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
+using SixLabors.ImageSharp;
namespace SixLabors.ImageSharp.Benchmarks.Samplers
{
diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs
index 202cd04c9..d1fb54703 100644
--- a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs
@@ -7,7 +7,6 @@ using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs
index 4c3fe3149..ccb57c35f 100644
--- a/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs
@@ -2,10 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.IO;
-using System.Linq;
-
-using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Bmp;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs
index 1e2846910..ba3587a7a 100644
--- a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs
+++ b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs
@@ -14,7 +14,7 @@ namespace SixLabors.ImageSharp.Tests
using System.Reflection;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
- using SixLabors.Memory;
+ using SixLabors.ImageSharp.Memory;
public class GeneralFormatTests : FileTestBase
{
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs
index 4b1abf909..6b803c3ae 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs
@@ -7,8 +7,6 @@
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils;
-using SixLabors.Memory;
-using SixLabors.Primitives;
using Xunit;
using Xunit.Abstractions;
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
index a9cddebc8..009f86483 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
@@ -6,7 +6,7 @@ using System.IO;
using System.Linq;
using SixLabors.ImageSharp.Formats.Jpeg;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs
index 1d7ca746f..44545092f 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs
@@ -7,7 +7,6 @@ using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder;
using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils;
-using SixLabors.Primitives;
using Xunit;
using Xunit.Abstractions;
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs
index 91cd80d14..a4929fe80 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs
@@ -9,7 +9,6 @@ using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
{
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs
index 296f424fa..16fd352a9 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs
@@ -3,7 +3,6 @@ using System.Linq;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
using Xunit;
using Xunit.Abstractions;
diff --git a/tests/ImageSharp.Tests/Helpers/ImageMathsTests.cs b/tests/ImageSharp.Tests/Helpers/ImageMathsTests.cs
index 817672f34..16a27a9ce 100644
--- a/tests/ImageSharp.Tests/Helpers/ImageMathsTests.cs
+++ b/tests/ImageSharp.Tests/Helpers/ImageMathsTests.cs
@@ -4,9 +4,6 @@
using System;
using System.Numerics;
-using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-
using Xunit;
namespace SixLabors.ImageSharp.Tests.Helpers
diff --git a/tests/ImageSharp.Tests/Helpers/ParallelHelperTests.cs b/tests/ImageSharp.Tests/Helpers/ParallelHelperTests.cs
index 4b5c87c7f..93ddaefe6 100644
--- a/tests/ImageSharp.Tests/Helpers/ParallelHelperTests.cs
+++ b/tests/ImageSharp.Tests/Helpers/ParallelHelperTests.cs
@@ -10,8 +10,6 @@ using System.Threading;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
-using SixLabors.Primitives;
using Xunit;
using Xunit.Abstractions;
diff --git a/tests/ImageSharp.Tests/IO/DoubleBufferedStreamReaderTests.cs b/tests/ImageSharp.Tests/IO/DoubleBufferedStreamReaderTests.cs
index 2d5e81173..57e9dbad6 100644
--- a/tests/ImageSharp.Tests/IO/DoubleBufferedStreamReaderTests.cs
+++ b/tests/ImageSharp.Tests/IO/DoubleBufferedStreamReaderTests.cs
@@ -4,7 +4,7 @@
using System;
using System.IO;
using SixLabors.ImageSharp.IO;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
using Xunit;
namespace SixLabors.ImageSharp.Tests.IO
diff --git a/tests/ImageSharp.Tests/Image/ImageRotationTests.cs b/tests/ImageSharp.Tests/Image/ImageRotationTests.cs
index e1c4a419e..28196c0da 100644
--- a/tests/ImageSharp.Tests/Image/ImageRotationTests.cs
+++ b/tests/ImageSharp.Tests/Image/ImageRotationTests.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs
index 4d3a229c5..39795fbf3 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs
@@ -6,7 +6,6 @@ using System;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs
index 19887d9bc..0632d7440 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs
@@ -6,7 +6,6 @@ using System;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs
index 980ed17ce..d9d1eb7c4 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs
@@ -7,7 +7,6 @@ using System.IO;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs b/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs
index 04d05f6dc..a018af6ed 100644
--- a/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs
+++ b/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs
@@ -11,7 +11,6 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
using Xunit;
// ReSharper disable InconsistentNaming
@@ -41,7 +40,7 @@ namespace SixLabors.ImageSharp.Tests
}
this.bitmap = bitmap;
- var rectangle = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
+ var rectangle = new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height);
this.bmpData = bitmap.LockBits(rectangle, ImageLockMode.ReadWrite, bitmap.PixelFormat);
this.length = bitmap.Width * bitmap.Height;
}
diff --git a/tests/ImageSharp.Tests/ImageInfoTests.cs b/tests/ImageSharp.Tests/ImageInfoTests.cs
index 67804a18f..bde5f7b6a 100644
--- a/tests/ImageSharp.Tests/ImageInfoTests.cs
+++ b/tests/ImageSharp.Tests/ImageInfoTests.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Metadata;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
index 41e6749be..4aabc2f4e 100644
--- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
+++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
@@ -8,6 +8,8 @@
SixLabors.ImageSharp.Tests
AnyCPU;x64;x86
SixLabors.ImageSharp.Tests
+
+ true
diff --git a/tests/ImageSharp.Tests/Memory/Alocators/ArrayPoolMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Alocators/ArrayPoolMemoryAllocatorTests.cs
new file mode 100644
index 000000000..d38b5b9dd
--- /dev/null
+++ b/tests/ImageSharp.Tests/Memory/Alocators/ArrayPoolMemoryAllocatorTests.cs
@@ -0,0 +1,260 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+// ReSharper disable InconsistentNaming
+using System;
+using System.Buffers;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using SixLabors.ImageSharp.Tests;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Memory.Tests
+{
+ // TODO: Re-enable memory-intensive tests with arcade RemoteExecutor:
+ // https://github.com/dotnet/runtime/blob/master/docs/project/writing-tests.md#remoteexecutor
+ public class ArrayPoolMemoryAllocatorTests
+ {
+ private const int MaxPooledBufferSizeInBytes = 2048;
+
+ private const int PoolSelectorThresholdInBytes = MaxPooledBufferSizeInBytes / 2;
+
+ private MemoryAllocator MemoryAllocator { get; set; } =
+ new ArrayPoolMemoryAllocator(MaxPooledBufferSizeInBytes, PoolSelectorThresholdInBytes);
+
+ ///
+ /// Rent a buffer -> return it -> re-rent -> verify if it's span points to the previous location.
+ ///
+ private bool CheckIsRentingPooledBuffer(int length)
+ where T : struct
+ {
+ IMemoryOwner buffer = this.MemoryAllocator.Allocate(length);
+ ref T ptrToPrevPosition0 = ref buffer.GetReference();
+ buffer.Dispose();
+
+ buffer = this.MemoryAllocator.Allocate(length);
+ bool sameBuffers = Unsafe.AreSame(ref ptrToPrevPosition0, ref buffer.GetReference());
+ buffer.Dispose();
+
+ return sameBuffers;
+ }
+
+ public class BufferTests : BufferTestSuite
+ {
+ public BufferTests()
+ : base(new ArrayPoolMemoryAllocator(MaxPooledBufferSizeInBytes, PoolSelectorThresholdInBytes))
+ {
+ }
+ }
+
+ public class Constructor
+ {
+ [Fact]
+ public void WhenBothParametersPassedByUser()
+ {
+ var mgr = new ArrayPoolMemoryAllocator(1111, 666);
+ Assert.Equal(1111, mgr.MaxPoolSizeInBytes);
+ Assert.Equal(666, mgr.PoolSelectorThresholdInBytes);
+ }
+
+ [Fact]
+ public void WhenPassedOnly_MaxPooledBufferSizeInBytes_SmallerThresholdValueIsAutoCalculated()
+ {
+ var mgr = new ArrayPoolMemoryAllocator(5000);
+ Assert.Equal(5000, mgr.MaxPoolSizeInBytes);
+ Assert.True(mgr.PoolSelectorThresholdInBytes < mgr.MaxPoolSizeInBytes);
+ }
+
+ [Fact]
+ public void When_PoolSelectorThresholdInBytes_IsGreaterThan_MaxPooledBufferSizeInBytes_ExceptionIsThrown()
+ {
+ Assert.ThrowsAny(() => new ArrayPoolMemoryAllocator(100, 200));
+ }
+ }
+
+ [Theory]
+ [InlineData(32)]
+ [InlineData(512)]
+ [InlineData(MaxPooledBufferSizeInBytes - 1)]
+ public void SmallBuffersArePooled_OfByte(int size)
+ {
+ Assert.True(this.CheckIsRentingPooledBuffer(size));
+ }
+
+ [Theory(Skip = "Should be executed from a separate process.")]
+ [InlineData(128 * 1024 * 1024)]
+ [InlineData(MaxPooledBufferSizeInBytes + 1)]
+ public void LargeBuffersAreNotPooled_OfByte(int size)
+ {
+ if (!TestEnvironment.Is64BitProcess)
+ {
+ // can lead to OutOfMemoryException
+ return;
+ }
+
+ Assert.False(this.CheckIsRentingPooledBuffer(size));
+ }
+
+ [Fact]
+ public unsafe void SmallBuffersArePooled_OfBigValueType()
+ {
+ int count = (MaxPooledBufferSizeInBytes / sizeof(LargeStruct)) - 1;
+
+ Assert.True(this.CheckIsRentingPooledBuffer(count));
+ }
+
+ [Fact(Skip = "Should be executed from a separate process.")]
+ public unsafe void LaregeBuffersAreNotPooled_OfBigValueType()
+ {
+ if (!TestEnvironment.Is64BitProcess)
+ {
+ // can lead to OutOfMemoryException
+ return;
+ }
+
+ int count = (MaxPooledBufferSizeInBytes / sizeof(LargeStruct)) + 1;
+
+ Assert.False(this.CheckIsRentingPooledBuffer(count));
+ }
+
+ [Theory]
+ [InlineData(AllocationOptions.None)]
+ [InlineData(AllocationOptions.Clean)]
+ public void CleaningRequests_AreControlledByAllocationParameter_Clean(AllocationOptions options)
+ {
+ using (IMemoryOwner firstAlloc = this.MemoryAllocator.Allocate(42))
+ {
+ firstAlloc.GetSpan().Fill(666);
+ }
+
+ using (IMemoryOwner secondAlloc = this.MemoryAllocator.Allocate(42, options))
+ {
+ int expected = options == AllocationOptions.Clean ? 0 : 666;
+ Assert.Equal(expected, secondAlloc.GetSpan()[0]);
+ }
+ }
+
+ [Theory]
+ [InlineData(false)]
+ [InlineData(true)]
+ public void ReleaseRetainedResources_ReplacesInnerArrayPool(bool keepBufferAlive)
+ {
+ IMemoryOwner buffer = this.MemoryAllocator.Allocate(32);
+ ref int ptrToPrev0 = ref MemoryMarshal.GetReference(buffer.GetSpan());
+
+ if (!keepBufferAlive)
+ {
+ buffer.Dispose();
+ }
+
+ this.MemoryAllocator.ReleaseRetainedResources();
+
+ buffer = this.MemoryAllocator.Allocate(32);
+
+ Assert.False(Unsafe.AreSame(ref ptrToPrev0, ref buffer.GetReference()));
+ }
+
+ [Fact]
+ public void ReleaseRetainedResources_DisposingPreviouslyAllocatedBuffer_IsAllowed()
+ {
+ IMemoryOwner buffer = this.MemoryAllocator.Allocate(32);
+ this.MemoryAllocator.ReleaseRetainedResources();
+ buffer.Dispose();
+ }
+
+
+ [Fact(Skip = "Should be executed from a separate process.")]
+ public void AllocationOverLargeArrayThreshold_UsesDifferentPool()
+ {
+ if (!TestEnvironment.Is64BitProcess)
+ {
+ // can lead to OutOfMemoryException
+ return;
+ }
+
+ const int ArrayLengthThreshold = PoolSelectorThresholdInBytes / sizeof(int);
+
+ IMemoryOwner small = this.MemoryAllocator.Allocate(ArrayLengthThreshold - 1);
+ ref int ptr2Small = ref small.GetReference();
+ small.Dispose();
+
+ IMemoryOwner large = this.MemoryAllocator.Allocate(ArrayLengthThreshold + 1);
+
+ Assert.False(Unsafe.AreSame(ref ptr2Small, ref large.GetReference()));
+ }
+
+ [Fact(Skip = "Should be executed from a separate process.")]
+ public void CreateWithAggressivePooling()
+ {
+ if (!TestEnvironment.Is64BitProcess)
+ {
+ // can lead to OutOfMemoryException
+ return;
+ }
+
+ this.MemoryAllocator = ArrayPoolMemoryAllocator.CreateWithAggressivePooling();
+
+ Assert.True(this.CheckIsRentingPooledBuffer(4096 * 4096));
+ }
+
+ [Fact(Skip = "Should be executed from a separate process.")]
+ public void CreateDefault()
+ {
+ if (!TestEnvironment.Is64BitProcess)
+ {
+ // can lead to OutOfMemoryException
+ return;
+ }
+
+ this.MemoryAllocator = ArrayPoolMemoryAllocator.CreateDefault();
+
+ Assert.False(this.CheckIsRentingPooledBuffer(2 * 4096 * 4096));
+ Assert.True(this.CheckIsRentingPooledBuffer(2048 * 2048));
+ }
+
+ [Fact]
+ public void CreateWithModeratePooling()
+ {
+ if (!TestEnvironment.Is64BitProcess)
+ {
+ // can lead to OutOfMemoryException
+ return;
+ }
+
+ this.MemoryAllocator = ArrayPoolMemoryAllocator.CreateWithModeratePooling();
+
+ Assert.False(this.CheckIsRentingPooledBuffer(2048 * 2048));
+ Assert.True(this.CheckIsRentingPooledBuffer(1024 * 16));
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct Rgba32
+ {
+ private readonly uint dummy;
+ }
+
+ private const int SizeOfLargeStruct = MaxPooledBufferSizeInBytes / 5;
+
+ [StructLayout(LayoutKind.Explicit, Size = SizeOfLargeStruct)]
+ private struct LargeStruct
+ {
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ [InlineData((int.MaxValue / SizeOfLargeStruct) + 1)]
+ public void AllocateIncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length)
+ {
+ ArgumentOutOfRangeException ex = Assert.Throws(() => this.MemoryAllocator.Allocate(length));
+ Assert.Equal("length", ex.ParamName);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ public void AllocateManagedByteBuffer_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length)
+ {
+ ArgumentOutOfRangeException ex = Assert.Throws(() => this.MemoryAllocator.AllocateManagedByteBuffer(length));
+ Assert.Equal("length", ex.ParamName);
+ }
+ }
+}
diff --git a/tests/ImageSharp.Tests/Memory/Alocators/BufferExtensions.cs b/tests/ImageSharp.Tests/Memory/Alocators/BufferExtensions.cs
new file mode 100644
index 000000000..8073d069d
--- /dev/null
+++ b/tests/ImageSharp.Tests/Memory/Alocators/BufferExtensions.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Buffers;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace SixLabors.ImageSharp.Memory.Tests
+{
+ internal static class BufferExtensions
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Span GetSpan(this IMemoryOwner buffer)
+ => buffer.Memory.Span;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int Length(this IMemoryOwner buffer)
+ => buffer.GetSpan().Length;
+
+ public static ref T GetReference(this IMemoryOwner buffer)
+ where T : struct =>
+ ref MemoryMarshal.GetReference(buffer.GetSpan());
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Memory/Alocators/BufferTestSuite.cs b/tests/ImageSharp.Tests/Memory/Alocators/BufferTestSuite.cs
new file mode 100644
index 000000000..4590bbe97
--- /dev/null
+++ b/tests/ImageSharp.Tests/Memory/Alocators/BufferTestSuite.cs
@@ -0,0 +1,318 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Buffers;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using Xunit;
+
+// ReSharper disable InconsistentNaming
+namespace SixLabors.ImageSharp.Memory.Tests
+{
+ ///
+ /// Inherit this class to test an implementation (provided by ).
+ ///
+ public abstract class BufferTestSuite
+ {
+ protected BufferTestSuite(MemoryAllocator memoryAllocator)
+ {
+ this.MemoryAllocator = memoryAllocator;
+ }
+
+ protected MemoryAllocator MemoryAllocator { get; }
+
+ public struct CustomStruct : IEquatable
+ {
+ public long A;
+
+ public byte B;
+
+ public float C;
+
+ public CustomStruct(long a, byte b, float c)
+ {
+ this.A = a;
+ this.B = b;
+ this.C = c;
+ }
+
+ public bool Equals(CustomStruct other)
+ {
+ return this.A == other.A && this.B == other.B && this.C.Equals(other.C);
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is CustomStruct other && this.Equals(other);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = this.A.GetHashCode();
+ hashCode = (hashCode * 397) ^ this.B.GetHashCode();
+ hashCode = (hashCode * 397) ^ this.C.GetHashCode();
+ return hashCode;
+ }
+ }
+ }
+
+ public static readonly TheoryData LenthValues = new TheoryData { 0, 1, 7, 1023, 1024 };
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void HasCorrectLength_byte(int desiredLength)
+ {
+ this.TestHasCorrectLength(desiredLength);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void HasCorrectLength_float(int desiredLength)
+ {
+ this.TestHasCorrectLength(desiredLength);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void HasCorrectLength_CustomStruct(int desiredLength)
+ {
+ this.TestHasCorrectLength(desiredLength);
+ }
+
+ private void TestHasCorrectLength(int desiredLength)
+ where T : struct
+ {
+ using (IMemoryOwner buffer = this.MemoryAllocator.Allocate(desiredLength))
+ {
+ Assert.Equal(desiredLength, buffer.GetSpan().Length);
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void CanAllocateCleanBuffer_byte(int desiredLength)
+ {
+ this.TestCanAllocateCleanBuffer(desiredLength, false);
+ this.TestCanAllocateCleanBuffer(desiredLength, true);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void CanAllocateCleanBuffer_double(int desiredLength)
+ {
+ this.TestCanAllocateCleanBuffer(desiredLength);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void CanAllocateCleanBuffer_CustomStruct(int desiredLength)
+ {
+ this.TestCanAllocateCleanBuffer(desiredLength);
+ }
+
+ private IMemoryOwner Allocate(int desiredLength, AllocationOptions options, bool managedByteBuffer)
+ where T : struct
+ {
+ if (managedByteBuffer)
+ {
+ if (!(this.MemoryAllocator.AllocateManagedByteBuffer(desiredLength, options) is IMemoryOwner buffer))
+ {
+ throw new InvalidOperationException("typeof(T) != typeof(byte)");
+ }
+
+ return buffer;
+ }
+
+ return this.MemoryAllocator.Allocate(desiredLength, options);
+ }
+
+ private void TestCanAllocateCleanBuffer(int desiredLength, bool testManagedByteBuffer = false)
+ where T : struct, IEquatable
+ {
+ ReadOnlySpan expected = new T[desiredLength];
+
+ for (int i = 0; i < 10; i++)
+ {
+ using (IMemoryOwner buffer = this.Allocate(desiredLength, AllocationOptions.Clean, testManagedByteBuffer))
+ {
+ Assert.True(buffer.GetSpan().SequenceEqual(expected));
+ }
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void SpanPropertyIsAlwaysTheSame_int(int desiredLength)
+ {
+ this.TestSpanPropertyIsAlwaysTheSame(desiredLength);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void SpanPropertyIsAlwaysTheSame_byte(int desiredLength)
+ {
+ this.TestSpanPropertyIsAlwaysTheSame(desiredLength, false);
+ this.TestSpanPropertyIsAlwaysTheSame(desiredLength, true);
+ }
+
+ private void TestSpanPropertyIsAlwaysTheSame(int desiredLength, bool testManagedByteBuffer = false)
+ where T : struct
+ {
+ using (IMemoryOwner buffer = this.Allocate(desiredLength, AllocationOptions.None, testManagedByteBuffer))
+ {
+ ref T a = ref MemoryMarshal.GetReference(buffer.GetSpan());
+ ref T b = ref MemoryMarshal.GetReference(buffer.GetSpan());
+ ref T c = ref MemoryMarshal.GetReference(buffer.GetSpan());
+
+ Assert.True(Unsafe.AreSame(ref a, ref b));
+ Assert.True(Unsafe.AreSame(ref b, ref c));
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void WriteAndReadElements_float(int desiredLength)
+ {
+ this.TestWriteAndReadElements(desiredLength, x => x * 1.2f);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void WriteAndReadElements_byte(int desiredLength)
+ {
+ this.TestWriteAndReadElements(desiredLength, x => (byte)(x + 1), false);
+ this.TestWriteAndReadElements(desiredLength, x => (byte)(x + 1), true);
+ }
+
+ private void TestWriteAndReadElements(int desiredLength, Func getExpectedValue, bool testManagedByteBuffer = false)
+ where T : struct
+ {
+ using (IMemoryOwner buffer = this.Allocate(desiredLength, AllocationOptions.None, testManagedByteBuffer))
+ {
+ T[] expectedVals = new T[buffer.Length()];
+
+ for (int i = 0; i < buffer.Length(); i++)
+ {
+ Span span = buffer.GetSpan();
+ expectedVals[i] = getExpectedValue(i);
+ span[i] = expectedVals[i];
+ }
+
+ for (int i = 0; i < buffer.Length(); i++)
+ {
+ Span span = buffer.GetSpan();
+ Assert.Equal(expectedVals[i], span[i]);
+ }
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void IndexingSpan_WhenOutOfRange_Throws_byte(int desiredLength)
+ {
+ this.TestIndexOutOfRangeShouldThrow(desiredLength, false);
+ this.TestIndexOutOfRangeShouldThrow(desiredLength, true);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void IndexingSpan_WhenOutOfRange_Throws_long(int desiredLength)
+ {
+ this.TestIndexOutOfRangeShouldThrow(desiredLength);
+ }
+
+ [Theory]
+ [MemberData(nameof(LenthValues))]
+ public void IndexingSpan_WhenOutOfRange_Throws_CustomStruct(int desiredLength)
+ {
+ this.TestIndexOutOfRangeShouldThrow(desiredLength);
+ }
+
+ private T TestIndexOutOfRangeShouldThrow(int desiredLength, bool testManagedByteBuffer = false)
+ where T : struct, IEquatable
+ {
+ var dummy = default(T);
+
+ using (IMemoryOwner buffer = this.Allocate(desiredLength, AllocationOptions.None, testManagedByteBuffer))
+ {
+ Assert.ThrowsAny(
+ () =>
+ {
+ Span span = buffer.GetSpan();
+ dummy = span[desiredLength];
+ });
+
+ Assert.ThrowsAny(
+ () =>
+ {
+ Span span = buffer.GetSpan();
+ dummy = span[desiredLength + 1];
+ });
+
+ Assert.ThrowsAny(
+ () =>
+ {
+ Span span = buffer.GetSpan();
+ dummy = span[desiredLength + 42];
+ });
+ }
+
+ return dummy;
+ }
+
+ [Theory]
+ [InlineData(1)]
+ [InlineData(7)]
+ [InlineData(1024)]
+ [InlineData(6666)]
+ public void ManagedByteBuffer_ArrayIsCorrect(int desiredLength)
+ {
+ using (IManagedByteBuffer buffer = this.MemoryAllocator.AllocateManagedByteBuffer(desiredLength))
+ {
+ ref byte array0 = ref buffer.Array[0];
+ ref byte span0 = ref buffer.GetReference();
+
+ Assert.True(Unsafe.AreSame(ref span0, ref array0));
+ Assert.True(buffer.Array.Length >= buffer.GetSpan().Length);
+ }
+ }
+
+ [Fact]
+ public void GetMemory_ReturnsValidMemory()
+ {
+ using (IMemoryOwner buffer = this.MemoryAllocator.Allocate(42))
+ {
+ Span span0 = buffer.GetSpan();
+ span0[10].A = 30;
+ Memory memory = buffer.Memory;
+
+ Assert.Equal(42, memory.Length);
+ Span span1 = memory.Span;
+
+ Assert.Equal(42, span1.Length);
+ Assert.Equal(30, span1[10].A);
+ }
+ }
+
+ [Fact]
+ public unsafe void GetMemory_ResultIsPinnable()
+ {
+ using (IMemoryOwner buffer = this.MemoryAllocator.Allocate(42))
+ {
+ Span span0 = buffer.GetSpan();
+ span0[10] = 30;
+
+ Memory memory = buffer.Memory;
+
+ using (MemoryHandle h = memory.Pin())
+ {
+ int* ptr = (int*)h.Pointer;
+ Assert.Equal(30, ptr[10]);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Memory/Alocators/SimpleGcMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Alocators/SimpleGcMemoryAllocatorTests.cs
new file mode 100644
index 000000000..8e3b82be5
--- /dev/null
+++ b/tests/ImageSharp.Tests/Memory/Alocators/SimpleGcMemoryAllocatorTests.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Runtime.InteropServices;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Memory.Tests
+{
+ public class SimpleGcMemoryAllocatorTests
+ {
+ public class BufferTests : BufferTestSuite
+ {
+ public BufferTests()
+ : base(new SimpleGcMemoryAllocator())
+ {
+ }
+ }
+
+ protected SimpleGcMemoryAllocator MemoryAllocator { get; } = new SimpleGcMemoryAllocator();
+
+ [Theory]
+ [InlineData(-1)]
+ public void Allocate_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length)
+ {
+ ArgumentOutOfRangeException ex = Assert.Throws(() => this.MemoryAllocator.Allocate(length));
+ Assert.Equal("length", ex.ParamName);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ public void AllocateManagedByteBuffer_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length)
+ {
+ ArgumentOutOfRangeException ex = Assert.Throws(() => this.MemoryAllocator.AllocateManagedByteBuffer(length));
+ Assert.Equal("length", ex.ParamName);
+ }
+
+ [StructLayout(LayoutKind.Explicit, Size = 512)]
+ private struct BigStruct
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs b/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs
index a0e4f54ac..3b296f926 100644
--- a/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs
+++ b/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs
@@ -7,8 +7,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Memory;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs
index 919279862..7c93128b4 100644
--- a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs
+++ b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.Memory;
-using SixLabors.Primitives;
using Xunit;
// ReSharper disable InconsistentNaming
diff --git a/tests/ImageSharp.Tests/Memory/MemorySourceTests.cs b/tests/ImageSharp.Tests/Memory/MemorySourceTests.cs
index 535204e8d..d940aa987 100644
--- a/tests/ImageSharp.Tests/Memory/MemorySourceTests.cs
+++ b/tests/ImageSharp.Tests/Memory/MemorySourceTests.cs
@@ -5,7 +5,6 @@ using System;
using System.Buffers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Memory;
using Xunit;
// ReSharper disable InconsistentNaming
diff --git a/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs b/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs
index bdca87ef7..60d791e91 100644
--- a/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs
+++ b/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs
@@ -4,7 +4,6 @@
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs
index 9c86d060a..d2448f3d2 100644
--- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs
+++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs
@@ -2,16 +2,13 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Reflection;
using System.Text;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs
index d015fefc4..5d8770acf 100644
--- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs
+++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs
@@ -1,5 +1,4 @@
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
-using SixLabors.ImageSharp.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Exif.Values
diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MatrixTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MatrixTests.cs
index 15bf762e2..3667fda14 100644
--- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MatrixTests.cs
+++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MatrixTests.cs
@@ -8,7 +8,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Icc
{
- using SixLabors.ImageSharp.Primitives;
+ using SixLabors.ImageSharp;
public class IccDataWriterMatrixTests
{
diff --git a/tests/ImageSharp.Tests/Numerics/RationalTests.cs b/tests/ImageSharp.Tests/Numerics/RationalTests.cs
index 7cdae7f60..7b3bd86fc 100644
--- a/tests/ImageSharp.Tests/Numerics/RationalTests.cs
+++ b/tests/ImageSharp.Tests/Numerics/RationalTests.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
using Xunit;
namespace SixLabors.ImageSharp.Tests
diff --git a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
index f828cf74f..2931ab391 100644
--- a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
+++ b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
-
using Xunit;
namespace SixLabors.ImageSharp.Tests
diff --git a/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs
index 2fbe260ec..80fcb4370 100644
--- a/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs
+++ b/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs
@@ -1,6 +1,5 @@
using System;
using System.Globalization;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs
index d684198fa..3e37cb30b 100644
--- a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs
+++ b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.ImageSharp.Primitives;
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Primitives
diff --git a/tests/ImageSharp.Tests/Primitives/PointFTests.cs b/tests/ImageSharp.Tests/Primitives/PointFTests.cs
new file mode 100644
index 000000000..2bb4cc6dd
--- /dev/null
+++ b/tests/ImageSharp.Tests/Primitives/PointFTests.cs
@@ -0,0 +1,213 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Globalization;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests
+{
+ public class PointFTests
+ {
+ private static readonly ApproximateFloatComparer ApproximateFloatComparer =
+ new ApproximateFloatComparer(1e-6f);
+
+ [Fact]
+ public void CanReinterpretCastFromVector2()
+ {
+ var vector = new Vector2(1, 2);
+
+ PointF point = Unsafe.As(ref vector);
+
+ Assert.Equal(vector.X, point.X);
+ Assert.Equal(vector.Y, point.Y);
+ }
+
+ [Fact]
+ public void DefaultConstructorTest()
+ {
+ Assert.Equal(default, PointF.Empty);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(float.MinValue, float.MaxValue)]
+ [InlineData(0.0, 0.0)]
+ public void NonDefaultConstructorTest(float x, float y)
+ {
+ var p1 = new PointF(x, y);
+
+ Assert.Equal(x, p1.X);
+ Assert.Equal(y, p1.Y);
+ }
+
+ [Fact]
+ public void IsEmptyDefaultsTest()
+ {
+ Assert.True(PointF.Empty.IsEmpty);
+ Assert.True(default(PointF).IsEmpty);
+ Assert.True(new PointF(0, 0).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ public void IsEmptyRandomTest(float x, float y)
+ {
+ Assert.False(new PointF(x, y).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void CoordinatesTest(float x, float y)
+ {
+ var p = new PointF(x, y);
+ Assert.Equal(x, p.X);
+ Assert.Equal(y, p.Y);
+
+ p.X = 10;
+ Assert.Equal(10, p.X);
+
+ p.Y = -10.123f;
+ Assert.Equal(-10.123, p.Y, 3);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(float.MinValue, float.MaxValue, int.MinValue, int.MaxValue)]
+ [InlineData(0, 0, 0, 0)]
+ public void ArithmeticTestWithSize(float x, float y, int x1, int y1)
+ {
+ var p = new PointF(x, y);
+ var s = new Size(x1, y1);
+
+ var addExpected = new PointF(x + x1, y + y1);
+ var subExpected = new PointF(x - x1, y - y1);
+ Assert.Equal(addExpected, p + s);
+ Assert.Equal(subExpected, p - s);
+ Assert.Equal(addExpected, PointF.Add(p, s));
+ Assert.Equal(subExpected, PointF.Subtract(p, s));
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void ArithmeticTestWithSizeF(float x, float y)
+ {
+ var p = new PointF(x, y);
+ var s = new SizeF(y, x);
+
+ var addExpected = new PointF(x + y, y + x);
+ var subExpected = new PointF(x - y, y - x);
+ Assert.Equal(addExpected, p + s);
+ Assert.Equal(subExpected, p - s);
+ Assert.Equal(addExpected, PointF.Add(p, s));
+ Assert.Equal(subExpected, PointF.Subtract(p, s));
+ }
+
+ [Fact]
+ public void RotateTest()
+ {
+ var p = new PointF(13, 17);
+ Matrix3x2 matrix = Matrix3x2Extensions.CreateRotationDegrees(45, PointF.Empty);
+
+ var pout = PointF.Transform(p, matrix);
+
+ Assert.Equal(-2.82842732F, pout.X, ApproximateFloatComparer);
+ Assert.Equal(21.2132034F, pout.Y, ApproximateFloatComparer);
+ }
+
+ [Fact]
+ public void SkewTest()
+ {
+ var p = new PointF(13, 17);
+ Matrix3x2 matrix = Matrix3x2Extensions.CreateSkewDegrees(45, 45, PointF.Empty);
+
+ var pout = PointF.Transform(p, matrix);
+ Assert.Equal(new PointF(30, 30), pout);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MaxValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void EqualityTest(float x, float y)
+ {
+ var pLeft = new PointF(x, y);
+ var pRight = new PointF(y, x);
+
+ if (x == y)
+ {
+ Assert.True(pLeft == pRight);
+ Assert.False(pLeft != pRight);
+ Assert.True(pLeft.Equals(pRight));
+ Assert.True(pLeft.Equals((object)pRight));
+ Assert.Equal(pLeft.GetHashCode(), pRight.GetHashCode());
+ return;
+ }
+
+ Assert.True(pLeft != pRight);
+ Assert.False(pLeft == pRight);
+ Assert.False(pLeft.Equals(pRight));
+ Assert.False(pLeft.Equals((object)pRight));
+ }
+
+ [Fact]
+ public void EqualityTest_NotPointF()
+ {
+ var point = new PointF(0, 0);
+ Assert.False(point.Equals(null));
+ Assert.False(point.Equals(0));
+
+ // If PointF implements IEquatable (e.g. in .NET Core), then structs that are implicitly
+ // convertible to var can potentially be equal.
+ // See https://github.com/dotnet/corefx/issues/5255.
+ bool expectsImplicitCastToPointF = typeof(IEquatable).IsAssignableFrom(point.GetType());
+ Assert.Equal(expectsImplicitCastToPointF, point.Equals(new Point(0, 0)));
+
+ Assert.False(point.Equals((object)new Point(0, 0))); // No implicit cast
+ }
+
+ [Fact]
+ public void GetHashCodeTest()
+ {
+ var point = new PointF(10, 10);
+ Assert.Equal(point.GetHashCode(), new PointF(10, 10).GetHashCode());
+ Assert.NotEqual(point.GetHashCode(), new PointF(20, 10).GetHashCode());
+ Assert.NotEqual(point.GetHashCode(), new PointF(10, 20).GetHashCode());
+ }
+
+ [Fact]
+ public void ToStringTest()
+ {
+ var p = new PointF(5.1F, -5.123F);
+ Assert.Equal(string.Format(CultureInfo.CurrentCulture, "PointF [ X={0}, Y={1} ]", p.X, p.Y), p.ToString());
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void DeconstructTest(float x, float y)
+ {
+ PointF p = new PointF(x, y);
+
+ (float deconstructedX, float deconstructedY) = p;
+
+ Assert.Equal(x, deconstructedX);
+ Assert.Equal(y, deconstructedY);
+ }
+ }
+}
diff --git a/tests/ImageSharp.Tests/Primitives/PointTests.cs b/tests/ImageSharp.Tests/Primitives/PointTests.cs
new file mode 100644
index 000000000..8e86c7218
--- /dev/null
+++ b/tests/ImageSharp.Tests/Primitives/PointTests.cs
@@ -0,0 +1,258 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Globalization;
+using System.Numerics;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests
+{
+ public class PointTests
+ {
+ [Fact]
+ public void DefaultConstructorTest()
+ {
+ Assert.Equal(default, Point.Empty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void NonDefaultConstructorTest(int x, int y)
+ {
+ var p1 = new Point(x, y);
+ var p2 = new Point(new Size(x, y));
+
+ Assert.Equal(p1, p2);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue)]
+ [InlineData(int.MinValue)]
+ [InlineData(0)]
+ public void SingleIntConstructorTest(int x)
+ {
+ var p1 = new Point(x);
+ var p2 = new Point(unchecked((short)(x & 0xFFFF)), unchecked((short)((x >> 16) & 0xFFFF)));
+
+ Assert.Equal(p1, p2);
+ }
+
+ [Fact]
+ public void IsEmptyDefaultsTest()
+ {
+ Assert.True(Point.Empty.IsEmpty);
+ Assert.True(default(Point).IsEmpty);
+ Assert.True(new Point(0, 0).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ public void IsEmptyRandomTest(int x, int y)
+ {
+ Assert.False(new Point(x, y).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void CoordinatesTest(int x, int y)
+ {
+ var p = new Point(x, y);
+ Assert.Equal(x, p.X);
+ Assert.Equal(y, p.Y);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void PointFConversionTest(int x, int y)
+ {
+ PointF p = new Point(x, y);
+ Assert.Equal(new PointF(x, y), p);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void SizeConversionTest(int x, int y)
+ {
+ var sz = (Size)new Point(x, y);
+ Assert.Equal(new Size(x, y), sz);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void ArithmeticTest(int x, int y)
+ {
+ Point addExpected, subExpected, p = new Point(x, y);
+ var s = new Size(y, x);
+
+ unchecked
+ {
+ addExpected = new Point(x + y, y + x);
+ subExpected = new Point(x - y, y - x);
+ }
+
+ Assert.Equal(addExpected, p + s);
+ Assert.Equal(subExpected, p - s);
+ Assert.Equal(addExpected, Point.Add(p, s));
+ Assert.Equal(subExpected, Point.Subtract(p, s));
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void PointFMathematicalTest(float x, float y)
+ {
+ var pf = new PointF(x, y);
+ Point pCeiling, pTruncate, pRound;
+
+ unchecked
+ {
+ pCeiling = new Point((int)MathF.Ceiling(x), (int)MathF.Ceiling(y));
+ pTruncate = new Point((int)x, (int)y);
+ pRound = new Point((int)MathF.Round(x), (int)MathF.Round(y));
+ }
+
+ Assert.Equal(pCeiling, Point.Ceiling(pf));
+ Assert.Equal(pRound, Point.Round(pf));
+ Assert.Equal(pTruncate, (Point)pf);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void OffsetTest(int x, int y)
+ {
+ var p1 = new Point(x, y);
+ var p2 = new Point(y, x);
+
+ p1.Offset(p2);
+
+ Assert.Equal(unchecked(p2.X + p2.Y), p1.X);
+ Assert.Equal(p1.X, p1.Y);
+
+ p2.Offset(x, y);
+ Assert.Equal(p1, p2);
+ }
+
+ [Fact]
+ public void RotateTest()
+ {
+ var p = new Point(13, 17);
+ Matrix3x2 matrix = Matrix3x2Extensions.CreateRotationDegrees(45, Point.Empty);
+
+ var pout = Point.Transform(p, matrix);
+
+ Assert.Equal(new Point(-3, 21), pout);
+ }
+
+ [Fact]
+ public void SkewTest()
+ {
+ var p = new Point(13, 17);
+ Matrix3x2 matrix = Matrix3x2Extensions.CreateSkewDegrees(45, 45, Point.Empty);
+
+ var pout = Point.Transform(p, matrix);
+ Assert.Equal(new Point(30, 30), pout);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void EqualityTest(int x, int y)
+ {
+ var p1 = new Point(x, y);
+ var p2 = new Point((x / 2) - 1, (y / 2) - 1);
+ var p3 = new Point(x, y);
+
+ Assert.True(p1 == p3);
+ Assert.True(p1 != p2);
+ Assert.True(p2 != p3);
+
+ Assert.True(p1.Equals(p3));
+ Assert.False(p1.Equals(p2));
+ Assert.False(p2.Equals(p3));
+
+ Assert.True(p1.Equals((object)p3));
+ Assert.False(p1.Equals((object)p2));
+ Assert.False(p2.Equals((object)p3));
+
+ Assert.Equal(p1.GetHashCode(), p3.GetHashCode());
+ }
+
+ [Fact]
+ public void EqualityTest_NotPoint()
+ {
+ var point = new Point(0, 0);
+ Assert.False(point.Equals(null));
+ Assert.False(point.Equals(0));
+ Assert.False(point.Equals(new PointF(0, 0)));
+ }
+
+ [Fact]
+ public void GetHashCodeTest()
+ {
+ var point = new Point(10, 10);
+ Assert.Equal(point.GetHashCode(), new Point(10, 10).GetHashCode());
+ Assert.NotEqual(point.GetHashCode(), new Point(20, 10).GetHashCode());
+ Assert.NotEqual(point.GetHashCode(), new Point(10, 20).GetHashCode());
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(1, -2, 3, -4)]
+ public void ConversionTest(int x, int y, int width, int height)
+ {
+ var rect = new Rectangle(x, y, width, height);
+ RectangleF rectF = rect;
+ Assert.Equal(x, rectF.X);
+ Assert.Equal(y, rectF.Y);
+ Assert.Equal(width, rectF.Width);
+ Assert.Equal(height, rectF.Height);
+ }
+
+ [Fact]
+ public void ToStringTest()
+ {
+ var p = new Point(5, -5);
+ Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Point [ X={0}, Y={1} ]", p.X, p.Y), p.ToString());
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void DeconstructTest(int x, int y)
+ {
+ Point p = new Point(x, y);
+
+ (int deconstructedX, int deconstructedY) = p;
+
+ Assert.Equal(x, deconstructedX);
+ Assert.Equal(y, deconstructedY);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs b/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs
new file mode 100644
index 000000000..f0ba75716
--- /dev/null
+++ b/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs
@@ -0,0 +1,285 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Globalization;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests
+{
+ ///
+ /// Tests the struct.
+ ///
+ public class RectangleFTests
+ {
+ [Fact]
+ public void DefaultConstructorTest()
+ {
+ Assert.Equal(default, RectangleF.Empty);
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, 0, 0, float.MaxValue)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void NonDefaultConstructorTest(float x, float y, float width, float height)
+ {
+ var rect1 = new RectangleF(x, y, width, height);
+ var p = new PointF(x, y);
+ var s = new SizeF(width, height);
+ var rect2 = new RectangleF(p, s);
+
+ Assert.Equal(rect1, rect2);
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, 0, 0, float.MaxValue)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void FromLTRBTest(float left, float top, float right, float bottom)
+ {
+ var expected = new RectangleF(left, top, right - left, bottom - top);
+ var actual = RectangleF.FromLTRB(left, top, right, bottom);
+
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, 0, 0, float.MaxValue)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void DimensionsTest(float x, float y, float width, float height)
+ {
+ var rect = new RectangleF(x, y, width, height);
+ var p = new PointF(x, y);
+ var s = new SizeF(width, height);
+
+ Assert.Equal(p, rect.Location);
+ Assert.Equal(s, rect.Size);
+ Assert.Equal(x, rect.X);
+ Assert.Equal(y, rect.Y);
+ Assert.Equal(width, rect.Width);
+ Assert.Equal(height, rect.Height);
+ Assert.Equal(x, rect.Left);
+ Assert.Equal(y, rect.Top);
+ Assert.Equal(x + width, rect.Right);
+ Assert.Equal(y + height, rect.Bottom);
+ }
+
+ [Fact]
+ public void IsEmptyTest()
+ {
+ Assert.True(RectangleF.Empty.IsEmpty);
+ Assert.True(default(RectangleF).IsEmpty);
+ Assert.True(new RectangleF(1, -2, -10, 10).IsEmpty);
+ Assert.True(new RectangleF(1, -2, 10, -10).IsEmpty);
+ Assert.True(new RectangleF(1, -2, 0, 0).IsEmpty);
+
+ Assert.False(new RectangleF(0, 0, 10, 10).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(0, 0)]
+ [InlineData(float.MaxValue, float.MinValue)]
+ public void LocationSetTest(float x, float y)
+ {
+ var point = new PointF(x, y);
+ var rect = new RectangleF(10, 10, 10, 10) { Location = point };
+ Assert.Equal(point, rect.Location);
+ Assert.Equal(point.X, rect.X);
+ Assert.Equal(point.Y, rect.Y);
+ }
+
+ [Theory]
+ [InlineData(0, 0)]
+ [InlineData(float.MaxValue, float.MinValue)]
+ public void SizeSetTest(float x, float y)
+ {
+ var size = new SizeF(x, y);
+ var rect = new RectangleF(10, 10, 10, 10) { Size = size };
+ Assert.Equal(size, rect.Size);
+ Assert.Equal(size.Width, rect.Width);
+ Assert.Equal(size.Height, rect.Height);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, 0, 0, float.MaxValue)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void EqualityTest(float x, float y, float width, float height)
+ {
+ var rect1 = new RectangleF(x, y, width, height);
+ var rect2 = new RectangleF(width, height, x, y);
+
+ Assert.True(rect1 != rect2);
+ Assert.False(rect1 == rect2);
+ Assert.False(rect1.Equals(rect2));
+ Assert.False(rect1.Equals((object)rect2));
+ }
+
+ [Fact]
+ public void EqualityTestNotRectangleF()
+ {
+ var rectangle = new RectangleF(0, 0, 0, 0);
+ Assert.False(rectangle.Equals(null));
+ Assert.False(rectangle.Equals(0));
+
+ // If RectangleF implements IEquatable (e.g. in .NET Core), then classes that are implicitly
+ // convertible to RectangleF can potentially be equal.
+ // See https://github.com/dotnet/corefx/issues/5255.
+ bool expectsImplicitCastToRectangleF = typeof(IEquatable).IsAssignableFrom(rectangle.GetType());
+ Assert.Equal(expectsImplicitCastToRectangleF, rectangle.Equals(new Rectangle(0, 0, 0, 0)));
+
+ Assert.False(rectangle.Equals((object)new Rectangle(0, 0, 0, 0))); // No implicit cast
+ }
+
+ [Fact]
+ public void GetHashCodeTest()
+ {
+ var rect1 = new RectangleF(10, 10, 10, 10);
+ var rect2 = new RectangleF(10, 10, 10, 10);
+ Assert.Equal(rect1.GetHashCode(), rect2.GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new RectangleF(20, 10, 10, 10).GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new RectangleF(10, 20, 10, 10).GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new RectangleF(10, 10, 20, 10).GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new RectangleF(10, 10, 10, 20).GetHashCode());
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void ContainsTest(float x, float y, float width, float height)
+ {
+ var rect = new RectangleF(x, y, width, height);
+ float x1 = (x + width) / 2;
+ float y1 = (y + height) / 2;
+ var p = new PointF(x1, y1);
+ var r = new RectangleF(x1, y1, width / 2, height / 2);
+
+ Assert.False(rect.Contains(x1, y1));
+ Assert.False(rect.Contains(p));
+ Assert.False(rect.Contains(r));
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(float.MaxValue / 2, float.MinValue / 2, float.MinValue / 2, float.MaxValue / 2)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void InflateTest(float x, float y, float width, float height)
+ {
+ var rect = new RectangleF(x, y, width, height);
+ var inflatedRect = new RectangleF(x - width, y - height, width + (2 * width), height + (2 * height));
+
+ rect.Inflate(width, height);
+ Assert.Equal(inflatedRect, rect);
+
+ var s = new SizeF(x, y);
+ inflatedRect = RectangleF.Inflate(rect, x, y);
+
+ rect.Inflate(s);
+ Assert.Equal(inflatedRect, rect);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue, float.MaxValue / 2, float.MinValue / 2)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void IntersectTest(float x, float y, float width, float height)
+ {
+ var rect1 = new RectangleF(x, y, width, height);
+ var rect2 = new RectangleF(y, x, width, height);
+ var expectedRect = RectangleF.Intersect(rect1, rect2);
+ rect1.Intersect(rect2);
+ Assert.Equal(expectedRect, rect1);
+ Assert.False(rect1.IntersectsWith(expectedRect));
+ }
+
+ [Fact]
+ public void IntersectIntersectingRectsTest()
+ {
+ var rect1 = new RectangleF(0, 0, 5, 5);
+ var rect2 = new RectangleF(1, 1, 3, 3);
+ var expected = new RectangleF(1, 1, 3, 3);
+
+ Assert.Equal(expected, RectangleF.Intersect(rect1, rect2));
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, 0, 0, float.MaxValue)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void UnionTest(float x, float y, float width, float height)
+ {
+ var a = new RectangleF(x, y, width, height);
+ var b = new RectangleF(width, height, x, y);
+
+ float x1 = Math.Min(a.X, b.X);
+ float x2 = Math.Max(a.X + a.Width, b.X + b.Width);
+ float y1 = Math.Min(a.Y, b.Y);
+ float y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);
+
+ var expectedRectangle = new RectangleF(x1, y1, x2 - x1, y2 - y1);
+
+ Assert.Equal(expectedRectangle, RectangleF.Union(a, b));
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, 0, 0, float.MaxValue)]
+ [InlineData(0, float.MinValue, float.MaxValue, 0)]
+ public void OffsetTest(float x, float y, float width, float height)
+ {
+ var r1 = new RectangleF(x, y, width, height);
+ var expectedRect = new RectangleF(x + width, y + height, width, height);
+ var p = new PointF(width, height);
+
+ r1.Offset(p);
+ Assert.Equal(expectedRect, r1);
+
+ expectedRect.Offset(p);
+ r1.Offset(width, height);
+ Assert.Equal(expectedRect, r1);
+ }
+
+ [Fact]
+ public void ToStringTest()
+ {
+ var r = new RectangleF(5, 5.1F, 1.3F, 1);
+ Assert.Equal(string.Format(CultureInfo.CurrentCulture, "RectangleF [ X={0}, Y={1}, Width={2}, Height={3} ]", r.X, r.Y, r.Width, r.Height), r.ToString());
+ }
+
+ [Theory]
+ [InlineData(float.MinValue, float.MaxValue, float.MaxValue, float.MaxValue)]
+ [InlineData(float.MinValue, float.MaxValue, float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MaxValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MinValue, float.MaxValue, float.MinValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue, float.MaxValue, float.MaxValue)]
+ [InlineData(float.MinValue, float.MinValue, float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MinValue, float.MinValue, float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue)]
+ [InlineData(float.MaxValue, float.MaxValue, float.MaxValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, float.MaxValue, float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MinValue, float.MaxValue, float.MaxValue)]
+ [InlineData(float.MaxValue, float.MinValue, float.MaxValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue)]
+ [InlineData(float.MaxValue, float.MinValue, float.MinValue, float.MinValue)]
+ [InlineData(0, 0, 0, 0)]
+ public void DeconstructTest(float x, float y, float width, float height)
+ {
+ RectangleF r = new RectangleF(x, y, width, height);
+
+ (float dx, float dy, float dw, float dh) = r;
+
+ Assert.Equal(x, dx);
+ Assert.Equal(y, dy);
+ Assert.Equal(width, dw);
+ Assert.Equal(height, dh);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Primitives/RectangleTests.cs b/tests/ImageSharp.Tests/Primitives/RectangleTests.cs
new file mode 100644
index 000000000..acfbe9e61
--- /dev/null
+++ b/tests/ImageSharp.Tests/Primitives/RectangleTests.cs
@@ -0,0 +1,336 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Globalization;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests
+{
+ ///
+ /// Tests the struct.
+ ///
+ public class RectangleTests
+ {
+ [Fact]
+ public void DefaultConstructorTest()
+ {
+ Assert.Equal(default, Rectangle.Empty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MaxValue, 0, int.MinValue, 0)]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(0, int.MinValue, 0, int.MaxValue)]
+ public void NonDefaultConstructorTest(int x, int y, int width, int height)
+ {
+ var rect1 = new Rectangle(x, y, width, height);
+ var rect2 = new Rectangle(new Point(x, y), new Size(width, height));
+
+ Assert.Equal(rect1, rect2);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MaxValue, 0, int.MinValue, 0)]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(0, int.MinValue, 0, int.MaxValue)]
+ public void FromLTRBTest(int left, int top, int right, int bottom)
+ {
+ var rect1 = new Rectangle(left, top, unchecked(right - left), unchecked(bottom - top));
+ var rect2 = Rectangle.FromLTRB(left, top, right, bottom);
+
+ Assert.Equal(rect1, rect2);
+ }
+
+ [Fact]
+ public void EmptyTest()
+ {
+ Assert.True(Rectangle.Empty.IsEmpty);
+ Assert.True(default(Rectangle).IsEmpty);
+ Assert.True(new Rectangle(0, 0, 0, 0).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MaxValue, 0, int.MinValue, 0)]
+ [InlineData(int.MinValue, int.MaxValue, int.MinValue, int.MaxValue)]
+ [InlineData(0, int.MinValue, 0, int.MaxValue)]
+ public void NonEmptyTest(int x, int y, int width, int height)
+ {
+ Assert.False(new Rectangle(x, y, width, height).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MaxValue, 0, int.MinValue, 0)]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(0, int.MinValue, 0, int.MaxValue)]
+ [InlineData(int.MinValue, int.MaxValue, int.MinValue, int.MaxValue)]
+ public void DimensionsTest(int x, int y, int width, int height)
+ {
+ var rect = new Rectangle(x, y, width, height);
+ Assert.Equal(new Point(x, y), rect.Location);
+ Assert.Equal(new Size(width, height), rect.Size);
+
+ Assert.Equal(x, rect.X);
+ Assert.Equal(y, rect.Y);
+ Assert.Equal(width, rect.Width);
+ Assert.Equal(height, rect.Height);
+ Assert.Equal(x, rect.Left);
+ Assert.Equal(y, rect.Top);
+ Assert.Equal(unchecked(x + width), rect.Right);
+ Assert.Equal(unchecked(y + height), rect.Bottom);
+
+ var p = new Point(width, height);
+ var s = new Size(x, y);
+ rect.Location = p;
+ rect.Size = s;
+
+ Assert.Equal(p, rect.Location);
+ Assert.Equal(s, rect.Size);
+
+ Assert.Equal(width, rect.X);
+ Assert.Equal(height, rect.Y);
+ Assert.Equal(x, rect.Width);
+ Assert.Equal(y, rect.Height);
+ Assert.Equal(width, rect.Left);
+ Assert.Equal(height, rect.Top);
+ Assert.Equal(unchecked(x + width), rect.Right);
+ Assert.Equal(unchecked(y + height), rect.Bottom);
+ }
+
+ [Theory]
+ [InlineData(0, 0)]
+ [InlineData(int.MaxValue, int.MinValue)]
+ public void LocationSetTest(int x, int y)
+ {
+ var point = new Point(x, y);
+ var rect = new Rectangle(10, 10, 10, 10) { Location = point };
+ Assert.Equal(point, rect.Location);
+ Assert.Equal(point.X, rect.X);
+ Assert.Equal(point.Y, rect.Y);
+ }
+
+ [Theory]
+ [InlineData(0, 0)]
+ [InlineData(int.MaxValue, int.MinValue)]
+ public void SizeSetTest(int x, int y)
+ {
+ var size = new Size(x, y);
+ var rect = new Rectangle(10, 10, 10, 10) { Size = size };
+ Assert.Equal(size, rect.Size);
+ Assert.Equal(size.Width, rect.Width);
+ Assert.Equal(size.Height, rect.Height);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MaxValue, 0, int.MinValue, 0)]
+ [InlineData(0, int.MinValue, 0, int.MaxValue)]
+ [InlineData(int.MinValue, int.MaxValue, int.MinValue, int.MaxValue)]
+ public void EqualityTest(int x, int y, int width, int height)
+ {
+ var rect1 = new Rectangle(x, y, width, height);
+ var rect2 = new Rectangle(width / 2, height / 2, x, y);
+
+ Assert.True(rect1 != rect2);
+ Assert.False(rect1 == rect2);
+ Assert.False(rect1.Equals(rect2));
+ Assert.False(rect1.Equals((object)rect2));
+ }
+
+ [Fact]
+ public void EqualityTestNotRectangle()
+ {
+ var rectangle = new Rectangle(0, 0, 0, 0);
+ Assert.False(rectangle.Equals(null));
+ Assert.False(rectangle.Equals(0));
+ Assert.False(rectangle.Equals(new RectangleF(0, 0, 0, 0)));
+ }
+
+ [Fact]
+ public void GetHashCodeTest()
+ {
+ var rect1 = new Rectangle(10, 10, 10, 10);
+ var rect2 = new Rectangle(10, 10, 10, 10);
+ Assert.Equal(rect1.GetHashCode(), rect2.GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new Rectangle(20, 10, 10, 10).GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new Rectangle(10, 20, 10, 10).GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new Rectangle(10, 10, 20, 10).GetHashCode());
+ Assert.NotEqual(rect1.GetHashCode(), new Rectangle(10, 10, 10, 20).GetHashCode());
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue, float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MaxValue, float.MinValue, float.MaxValue)]
+ [InlineData(0, 0, 0, 0)]
+ public void RectangleFConversionTest(float x, float y, float width, float height)
+ {
+ var rect = new RectangleF(x, y, width, height);
+ Rectangle rCeiling, rTruncate, rRound;
+
+ unchecked
+ {
+ rCeiling = new Rectangle(
+ (int)Math.Ceiling(x),
+ (int)Math.Ceiling(y),
+ (int)Math.Ceiling(width),
+ (int)Math.Ceiling(height));
+
+ rTruncate = new Rectangle((int)x, (int)y, (int)width, (int)height);
+
+ rRound = new Rectangle(
+ (int)Math.Round(x),
+ (int)Math.Round(y),
+ (int)Math.Round(width),
+ (int)Math.Round(height));
+ }
+
+ Assert.Equal(rCeiling, Rectangle.Ceiling(rect));
+ Assert.Equal(rTruncate, Rectangle.Truncate(rect));
+ Assert.Equal(rRound, Rectangle.Round(rect));
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue, int.MinValue, int.MaxValue)]
+ [InlineData(0, int.MinValue, int.MaxValue, 0)]
+ public void ContainsTest(int x, int y, int width, int height)
+ {
+ var rect = new Rectangle(unchecked((2 * x) - width), unchecked((2 * y) - height), width, height);
+ var p = new Point(x, y);
+ var r = new Rectangle(x, y, width / 2, height / 2);
+
+ Assert.False(rect.Contains(x, y));
+ Assert.False(rect.Contains(p));
+ Assert.False(rect.Contains(r));
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(int.MaxValue, int.MinValue, int.MinValue, int.MaxValue)]
+ [InlineData(0, int.MinValue, int.MaxValue, 0)]
+ public void InflateTest(int x, int y, int width, int height)
+ {
+ Rectangle inflatedRect, rect = new Rectangle(x, y, width, height);
+ unchecked
+ {
+ inflatedRect = new Rectangle(x - width, y - height, width + (2 * width), height + (2 * height));
+ }
+
+ Assert.Equal(inflatedRect, Rectangle.Inflate(rect, width, height));
+
+ rect.Inflate(width, height);
+ Assert.Equal(inflatedRect, rect);
+
+ var s = new Size(x, y);
+ unchecked
+ {
+ inflatedRect = new Rectangle(rect.X - x, rect.Y - y, rect.Width + (2 * x), rect.Height + (2 * y));
+ }
+
+ rect.Inflate(s);
+ Assert.Equal(inflatedRect, rect);
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(int.MaxValue, int.MinValue, int.MinValue, int.MaxValue)]
+ [InlineData(0, int.MinValue, int.MaxValue, 0)]
+ public void IntersectTest(int x, int y, int width, int height)
+ {
+ var rect = new Rectangle(x, y, width, height);
+ var expectedRect = Rectangle.Intersect(rect, rect);
+ rect.Intersect(rect);
+ Assert.Equal(expectedRect, rect);
+ Assert.False(rect.IntersectsWith(expectedRect));
+ }
+
+ [Fact]
+ public void IntersectIntersectingRectsTest()
+ {
+ var rect1 = new Rectangle(0, 0, 5, 5);
+ var rect2 = new Rectangle(1, 1, 3, 3);
+ var expected = new Rectangle(1, 1, 3, 3);
+
+ Assert.Equal(expected, Rectangle.Intersect(rect1, rect2));
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(int.MaxValue, int.MinValue, int.MinValue, int.MaxValue)]
+ [InlineData(int.MaxValue, 0, 0, int.MaxValue)]
+ [InlineData(0, int.MinValue, int.MaxValue, 0)]
+ public void UnionTest(int x, int y, int width, int height)
+ {
+ var a = new Rectangle(x, y, width, height);
+ var b = new Rectangle(width, height, x, y);
+
+ int x1 = Math.Min(a.X, b.X);
+ int x2 = Math.Max(a.X + a.Width, b.X + b.Width);
+ int y1 = Math.Min(a.Y, b.Y);
+ int y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);
+
+ var expectedRectangle = new Rectangle(x1, y1, x2 - x1, y2 - y1);
+
+ Assert.Equal(expectedRectangle, Rectangle.Union(a, b));
+ }
+
+ [Theory]
+ [InlineData(0, 0, 0, 0)]
+ [InlineData(int.MaxValue, int.MinValue, int.MinValue, int.MaxValue)]
+ [InlineData(int.MaxValue, 0, 0, int.MaxValue)]
+ [InlineData(0, int.MinValue, int.MaxValue, 0)]
+ public void OffsetTest(int x, int y, int width, int height)
+ {
+ var r1 = new Rectangle(x, y, width, height);
+ var expectedRect = new Rectangle(x + width, y + height, width, height);
+ var p = new Point(width, height);
+
+ r1.Offset(p);
+ Assert.Equal(expectedRect, r1);
+
+ expectedRect.Offset(p);
+ r1.Offset(width, height);
+ Assert.Equal(expectedRect, r1);
+ }
+
+ [Fact]
+ public void ToStringTest()
+ {
+ var r = new Rectangle(5, -5, 0, 1);
+ Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Rectangle [ X={0}, Y={1}, Width={2}, Height={3} ]", r.X, r.Y, r.Width, r.Height), r.ToString());
+ }
+
+ [Theory]
+ [InlineData(int.MinValue, int.MaxValue, int.MaxValue, int.MaxValue)]
+ [InlineData(int.MinValue, int.MaxValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MaxValue, int.MinValue, int.MaxValue)]
+ [InlineData(int.MinValue, int.MaxValue, int.MinValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue)]
+ [InlineData(int.MinValue, int.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue, int.MinValue, int.MaxValue)]
+ [InlineData(int.MinValue, int.MinValue, int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue)]
+ [InlineData(int.MaxValue, int.MaxValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue, int.MinValue, int.MaxValue)]
+ [InlineData(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MinValue, int.MaxValue, int.MaxValue)]
+ [InlineData(int.MaxValue, int.MinValue, int.MaxValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MinValue, int.MinValue, int.MaxValue)]
+ [InlineData(int.MaxValue, int.MinValue, int.MinValue, int.MinValue)]
+ [InlineData(0, 0, 0, 0)]
+ public void DeconstructTest(int x, int y, int width, int height)
+ {
+ var r = new Rectangle(x, y, width, height);
+
+ (int dx, int dy, int dw, int dh) = r;
+
+ Assert.Equal(x, dx);
+ Assert.Equal(y, dy);
+ Assert.Equal(width, dw);
+ Assert.Equal(height, dh);
+ }
+ }
+}
diff --git a/tests/ImageSharp.Tests/Primitives/SizeFTests.cs b/tests/ImageSharp.Tests/Primitives/SizeFTests.cs
new file mode 100644
index 000000000..8cda5d4eb
--- /dev/null
+++ b/tests/ImageSharp.Tests/Primitives/SizeFTests.cs
@@ -0,0 +1,249 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Globalization;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests
+{
+ public class SizeFTests
+ {
+ [Fact]
+ public void DefaultConstructorTest()
+ {
+ Assert.Equal(default, SizeF.Empty);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void NonDefaultConstructorAndDimensionsTest(float width, float height)
+ {
+ var s1 = new SizeF(width, height);
+ var p1 = new PointF(width, height);
+ var s2 = new SizeF(s1);
+
+ Assert.Equal(s1, s2);
+ Assert.Equal(s1, new SizeF(p1));
+ Assert.Equal(s2, new SizeF(p1));
+
+ Assert.Equal(width, s1.Width);
+ Assert.Equal(height, s1.Height);
+
+ s1.Width = 10;
+ Assert.Equal(10, s1.Width);
+
+ s1.Height = -10.123f;
+ Assert.Equal(-10.123, s1.Height, 3);
+ }
+
+ [Fact]
+ public void IsEmptyDefaultsTest()
+ {
+ Assert.True(SizeF.Empty.IsEmpty);
+ Assert.True(default(SizeF).IsEmpty);
+ Assert.True(new SizeF(0, 0).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ public void IsEmptyRandomTest(float width, float height)
+ {
+ Assert.False(new SizeF(width, height).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void ArithmeticTest(float width, float height)
+ {
+ var s1 = new SizeF(width, height);
+ var s2 = new SizeF(height, width);
+ var addExpected = new SizeF(width + height, width + height);
+ var subExpected = new SizeF(width - height, height - width);
+
+ Assert.Equal(addExpected, s1 + s2);
+ Assert.Equal(addExpected, SizeF.Add(s1, s2));
+
+ Assert.Equal(subExpected, s1 - s2);
+ Assert.Equal(subExpected, SizeF.Subtract(s1, s2));
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void EqualityTest(float width, float height)
+ {
+ var sLeft = new SizeF(width, height);
+ var sRight = new SizeF(height, width);
+
+ if (width == height)
+ {
+ Assert.True(sLeft == sRight);
+ Assert.False(sLeft != sRight);
+ Assert.True(sLeft.Equals(sRight));
+ Assert.True(sLeft.Equals((object)sRight));
+ Assert.Equal(sLeft.GetHashCode(), sRight.GetHashCode());
+ return;
+ }
+
+ Assert.True(sLeft != sRight);
+ Assert.False(sLeft == sRight);
+ Assert.False(sLeft.Equals(sRight));
+ Assert.False(sLeft.Equals((object)sRight));
+ }
+
+ [Fact]
+ public void EqualityTest_NotSizeF()
+ {
+ var size = new SizeF(0, 0);
+ Assert.False(size.Equals(null));
+ Assert.False(size.Equals(0));
+
+ // If SizeF implements IEquatable (e.g in .NET Core), then classes that are implicitly
+ // convertible to SizeF can potentially be equal.
+ // See https://github.com/dotnet/corefx/issues/5255.
+ bool expectsImplicitCastToSizeF = typeof(IEquatable).IsAssignableFrom(size.GetType());
+ Assert.Equal(expectsImplicitCastToSizeF, size.Equals(new Size(0, 0)));
+
+ Assert.False(size.Equals((object)new Size(0, 0))); // No implicit cast
+ }
+
+ [Fact]
+ public void GetHashCodeTest()
+ {
+ var size = new SizeF(10, 10);
+ Assert.Equal(size.GetHashCode(), new SizeF(10, 10).GetHashCode());
+ Assert.NotEqual(size.GetHashCode(), new SizeF(20, 10).GetHashCode());
+ Assert.NotEqual(size.GetHashCode(), new SizeF(10, 20).GetHashCode());
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void ConversionTest(float width, float height)
+ {
+ var s1 = new SizeF(width, height);
+ var p1 = (PointF)s1;
+ var s2 = new Size(unchecked((int)width), unchecked((int)height));
+
+ Assert.Equal(new PointF(width, height), p1);
+ Assert.Equal(p1, (PointF)s1);
+ Assert.Equal(s2, (Size)s1);
+ }
+
+ [Fact]
+ public void ToStringTest()
+ {
+ var sz = new SizeF(10, 5);
+ Assert.Equal(string.Format(CultureInfo.CurrentCulture, "SizeF [ Width={0}, Height={1} ]", sz.Width, sz.Height), sz.ToString());
+ }
+
+ [Theory]
+ [InlineData(1000.234f, 0.0f)]
+ [InlineData(1000.234f, 1.0f)]
+ [InlineData(1000.234f, 2400.933f)]
+ [InlineData(1000.234f, float.MaxValue)]
+ [InlineData(1000.234f, -1.0f)]
+ [InlineData(1000.234f, -2400.933f)]
+ [InlineData(1000.234f, float.MinValue)]
+ [InlineData(float.MaxValue, 0.0f)]
+ [InlineData(float.MaxValue, 1.0f)]
+ [InlineData(float.MaxValue, 2400.933f)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(float.MaxValue, -1.0f)]
+ [InlineData(float.MaxValue, -2400.933f)]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, 0.0f)]
+ [InlineData(float.MinValue, 1.0f)]
+ [InlineData(float.MinValue, 2400.933f)]
+ [InlineData(float.MinValue, float.MaxValue)]
+ [InlineData(float.MinValue, -1.0f)]
+ [InlineData(float.MinValue, -2400.933f)]
+ [InlineData(float.MinValue, float.MinValue)]
+ public void MultiplicationTest(float dimension, float multiplier)
+ {
+ SizeF sz1 = new SizeF(dimension, dimension);
+ SizeF mulExpected;
+
+ mulExpected = new SizeF(dimension * multiplier, dimension * multiplier);
+
+ Assert.Equal(mulExpected, sz1 * multiplier);
+ Assert.Equal(mulExpected, multiplier * sz1);
+ }
+
+ [Theory]
+ [InlineData(1111.1111f, 2222.2222f, 3333.3333f)]
+ public void MultiplicationTestWidthHeightMultiplier(float width, float height, float multiplier)
+ {
+ SizeF sz1 = new SizeF(width, height);
+ SizeF mulExpected;
+
+ mulExpected = new SizeF(width * multiplier, height * multiplier);
+
+ Assert.Equal(mulExpected, sz1 * multiplier);
+ Assert.Equal(mulExpected, multiplier * sz1);
+ }
+
+ [Theory]
+ [InlineData(0.0f, 1.0f)]
+ [InlineData(1.0f, 1.0f)]
+ [InlineData(-1.0f, 1.0f)]
+ [InlineData(1.0f, -1.0f)]
+ [InlineData(-1.0f, -1.0f)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MaxValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, 1.0f)]
+ [InlineData(float.MinValue, 1.0f)]
+ [InlineData(float.MaxValue, -1.0f)]
+ [InlineData(float.MinValue, -1.0f)]
+ [InlineData(float.MinValue, 0.0f)]
+ [InlineData(1.0f, float.MinValue)]
+ [InlineData(1.0f, float.MaxValue)]
+ [InlineData(-1.0f, float.MinValue)]
+ [InlineData(-1.0f, float.MaxValue)]
+ public void DivideTestSizeFloat(float dimension, float divisor)
+ {
+ SizeF size = new SizeF(dimension, dimension);
+ SizeF expected = new SizeF(dimension / divisor, dimension / divisor);
+ Assert.Equal(expected, size / divisor);
+ }
+
+ [Theory]
+ [InlineData(-111.111f, 222.222f, 333.333f)]
+ public void DivideTestSizeFloatWidthHeightDivisor(float width, float height, float divisor)
+ {
+ SizeF size = new SizeF(width, height);
+ SizeF expected = new SizeF(width / divisor, height / divisor);
+ Assert.Equal(expected, size / divisor);
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void DeconstructTest(float width, float height)
+ {
+ SizeF s = new SizeF(width, height);
+
+ (float deconstructedWidth, float deconstructedHeight) = s;
+
+ Assert.Equal(width, deconstructedWidth);
+ Assert.Equal(height, deconstructedHeight);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Primitives/SizeTests.cs b/tests/ImageSharp.Tests/Primitives/SizeTests.cs
new file mode 100644
index 000000000..4aea06036
--- /dev/null
+++ b/tests/ImageSharp.Tests/Primitives/SizeTests.cs
@@ -0,0 +1,379 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Globalization;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests
+{
+ ///
+ /// Tests the struct.
+ ///
+ public class SizeTests
+ {
+ [Fact]
+ public void DefaultConstructorTest()
+ {
+ Assert.Equal(default, Size.Empty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void NonDefaultConstructorTest(int width, int height)
+ {
+ var s1 = new Size(width, height);
+ var s2 = new Size(new Point(width, height));
+
+ Assert.Equal(s1, s2);
+
+ s1.Width = 10;
+ Assert.Equal(10, s1.Width);
+
+ s1.Height = -10;
+ Assert.Equal(-10, s1.Height);
+ }
+
+ [Fact]
+ public void IsEmptyDefaultsTest()
+ {
+ Assert.True(Size.Empty.IsEmpty);
+ Assert.True(default(Size).IsEmpty);
+ Assert.True(new Size(0, 0).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ public void IsEmptyRandomTest(int width, int height)
+ {
+ Assert.False(new Size(width, height).IsEmpty);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void DimensionsTest(int width, int height)
+ {
+ var p = new Size(width, height);
+ Assert.Equal(width, p.Width);
+ Assert.Equal(height, p.Height);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void PointFConversionTest(int width, int height)
+ {
+ SizeF sz = new Size(width, height);
+ Assert.Equal(new SizeF(width, height), sz);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void SizeConversionTest(int width, int height)
+ {
+ var sz = (Point)new Size(width, height);
+ Assert.Equal(new Point(width, height), sz);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void ArithmeticTest(int width, int height)
+ {
+ var sz1 = new Size(width, height);
+ var sz2 = new Size(height, width);
+ Size addExpected, subExpected;
+
+ unchecked
+ {
+ addExpected = new Size(width + height, height + width);
+ subExpected = new Size(width - height, height - width);
+ }
+
+ Assert.Equal(addExpected, sz1 + sz2);
+ Assert.Equal(subExpected, sz1 - sz2);
+ Assert.Equal(addExpected, Size.Add(sz1, sz2));
+ Assert.Equal(subExpected, Size.Subtract(sz1, sz2));
+ }
+
+ [Theory]
+ [InlineData(float.MaxValue, float.MinValue)]
+ [InlineData(float.MinValue, float.MinValue)]
+ [InlineData(float.MaxValue, float.MaxValue)]
+ [InlineData(0, 0)]
+ public void PointFMathematicalTest(float width, float height)
+ {
+ var szF = new SizeF(width, height);
+ Size pCeiling, pTruncate, pRound;
+
+ unchecked
+ {
+ pCeiling = new Size((int)MathF.Ceiling(width), (int)MathF.Ceiling(height));
+ pTruncate = new Size((int)width, (int)height);
+ pRound = new Size((int)MathF.Round(width), (int)MathF.Round(height));
+ }
+
+ Assert.Equal(pCeiling, Size.Ceiling(szF));
+ Assert.Equal(pRound, Size.Round(szF));
+ Assert.Equal(pTruncate, (Size)szF);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void EqualityTest(int width, int height)
+ {
+ var p1 = new Size(width, height);
+ var p2 = new Size(unchecked(width - 1), unchecked(height - 1));
+ var p3 = new Size(width, height);
+
+ Assert.True(p1 == p3);
+ Assert.True(p1 != p2);
+ Assert.True(p2 != p3);
+
+ Assert.True(p1.Equals(p3));
+ Assert.False(p1.Equals(p2));
+ Assert.False(p2.Equals(p3));
+
+ Assert.True(p1.Equals((object)p3));
+ Assert.False(p1.Equals((object)p2));
+ Assert.False(p2.Equals((object)p3));
+
+ Assert.Equal(p1.GetHashCode(), p3.GetHashCode());
+ }
+
+ [Fact]
+ public void EqualityTest_NotSize()
+ {
+ var size = new Size(0, 0);
+ Assert.False(size.Equals(null));
+ Assert.False(size.Equals(0));
+ Assert.False(size.Equals(new SizeF(0, 0)));
+ }
+
+ [Fact]
+ public void GetHashCodeTest()
+ {
+ var size = new Size(10, 10);
+ Assert.Equal(size.GetHashCode(), new Size(10, 10).GetHashCode());
+ Assert.NotEqual(size.GetHashCode(), new Size(20, 10).GetHashCode());
+ Assert.NotEqual(size.GetHashCode(), new Size(10, 20).GetHashCode());
+ }
+
+ [Fact]
+ public void ToStringTest()
+ {
+ var sz = new Size(10, 5);
+ Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Size [ Width={0}, Height={1} ]", sz.Width, sz.Height), sz.ToString());
+ }
+
+ [Theory]
+ [InlineData(1000, 0)]
+ [InlineData(1000, 1)]
+ [InlineData(1000, 2400)]
+ [InlineData(1000, int.MaxValue)]
+ [InlineData(1000, -1)]
+ [InlineData(1000, -2400)]
+ [InlineData(1000, int.MinValue)]
+ [InlineData(int.MaxValue, 0)]
+ [InlineData(int.MaxValue, 1)]
+ [InlineData(int.MaxValue, 2400)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(int.MaxValue, -1)]
+ [InlineData(int.MaxValue, -2400)]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, 0)]
+ [InlineData(int.MinValue, 1)]
+ [InlineData(int.MinValue, 2400)]
+ [InlineData(int.MinValue, int.MaxValue)]
+ [InlineData(int.MinValue, -1)]
+ [InlineData(int.MinValue, -2400)]
+ [InlineData(int.MinValue, int.MinValue)]
+ public void MultiplicationTestSizeInt(int dimension, int multiplier)
+ {
+ Size sz1 = new Size(dimension, dimension);
+ Size mulExpected;
+
+ unchecked
+ {
+ mulExpected = new Size(dimension * multiplier, dimension * multiplier);
+ }
+
+ Assert.Equal(mulExpected, sz1 * multiplier);
+ Assert.Equal(mulExpected, multiplier * sz1);
+ }
+
+ [Theory]
+ [InlineData(1000, 2000, 3000)]
+ public void MultiplicationTestSizeIntWidthHeightMultiplier(int width, int height, int multiplier)
+ {
+ Size sz1 = new Size(width, height);
+ Size mulExpected;
+
+ unchecked
+ {
+ mulExpected = new Size(width * multiplier, height * multiplier);
+ }
+
+ Assert.Equal(mulExpected, sz1 * multiplier);
+ Assert.Equal(mulExpected, multiplier * sz1);
+ }
+
+ [Theory]
+ [InlineData(1000, 0.0f)]
+ [InlineData(1000, 1.0f)]
+ [InlineData(1000, 2400.933f)]
+ [InlineData(1000, float.MaxValue)]
+ [InlineData(1000, -1.0f)]
+ [InlineData(1000, -2400.933f)]
+ [InlineData(1000, float.MinValue)]
+ [InlineData(int.MaxValue, 0.0f)]
+ [InlineData(int.MaxValue, 1.0f)]
+ [InlineData(int.MaxValue, 2400.933f)]
+ [InlineData(int.MaxValue, float.MaxValue)]
+ [InlineData(int.MaxValue, -1.0f)]
+ [InlineData(int.MaxValue, -2400.933f)]
+ [InlineData(int.MaxValue, float.MinValue)]
+ [InlineData(int.MinValue, 0.0f)]
+ [InlineData(int.MinValue, 1.0f)]
+ [InlineData(int.MinValue, 2400.933f)]
+ [InlineData(int.MinValue, float.MaxValue)]
+ [InlineData(int.MinValue, -1.0f)]
+ [InlineData(int.MinValue, -2400.933f)]
+ [InlineData(int.MinValue, float.MinValue)]
+ public void MultiplicationTestSizeFloat(int dimension, float multiplier)
+ {
+ Size sz1 = new Size(dimension, dimension);
+ SizeF mulExpected;
+
+ mulExpected = new SizeF(dimension * multiplier, dimension * multiplier);
+
+ Assert.Equal(mulExpected, sz1 * multiplier);
+ Assert.Equal(mulExpected, multiplier * sz1);
+ }
+
+ [Theory]
+ [InlineData(1000, 2000, 30.33f)]
+ public void MultiplicationTestSizeFloatWidthHeightMultiplier(int width, int height, float multiplier)
+ {
+ Size sz1 = new Size(width, height);
+ SizeF mulExpected;
+
+ mulExpected = new SizeF(width * multiplier, height * multiplier);
+
+ Assert.Equal(mulExpected, sz1 * multiplier);
+ Assert.Equal(mulExpected, multiplier * sz1);
+ }
+
+ [Fact]
+ public void DivideByZeroChecks()
+ {
+ Size size = new Size(100, 100);
+ Assert.Throws(() => size / 0);
+
+ SizeF expectedSizeF = new SizeF(float.PositiveInfinity, float.PositiveInfinity);
+ Assert.Equal(expectedSizeF, size / 0.0f);
+ }
+
+ [Theory]
+ [InlineData(0, 1)]
+ [InlineData(1, 1)]
+ [InlineData(-1, 1)]
+ [InlineData(1, -1)]
+ [InlineData(-1, -1)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MaxValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, 1)]
+ [InlineData(int.MinValue, 1)]
+ [InlineData(int.MaxValue, -1)]
+ public void DivideTestSizeInt(int dimension, int divisor)
+ {
+ Size size = new Size(dimension, dimension);
+ Size expected;
+
+ expected = new Size(dimension / divisor, dimension / divisor);
+
+ Assert.Equal(expected, size / divisor);
+ }
+
+ [Theory]
+ [InlineData(1111, 2222, 3333)]
+ public void DivideTestSizeIntWidthHeightDivisor(int width, int height, int divisor)
+ {
+ Size size = new Size(width, height);
+ Size expected;
+
+ expected = new Size(width / divisor, height / divisor);
+
+ Assert.Equal(expected, size / divisor);
+ }
+
+ [Theory]
+ [InlineData(0, 1.0f)]
+ [InlineData(1, 1.0f)]
+ [InlineData(-1, 1.0f)]
+ [InlineData(1, -1.0f)]
+ [InlineData(-1, -1.0f)]
+ [InlineData(int.MaxValue, float.MaxValue)]
+ [InlineData(int.MaxValue, float.MinValue)]
+ [InlineData(int.MinValue, float.MaxValue)]
+ [InlineData(int.MinValue, float.MinValue)]
+ [InlineData(int.MaxValue, 1.0f)]
+ [InlineData(int.MinValue, 1.0f)]
+ [InlineData(int.MaxValue, -1.0f)]
+ [InlineData(int.MinValue, -1.0f)]
+ public void DivideTestSizeFloat(int dimension, float divisor)
+ {
+ SizeF size = new SizeF(dimension, dimension);
+ SizeF expected;
+
+ expected = new SizeF(dimension / divisor, dimension / divisor);
+ Assert.Equal(expected, size / divisor);
+ }
+
+ [Theory]
+ [InlineData(1111, 2222, -333.33f)]
+ public void DivideTestSizeFloatWidthHeightDivisor(int width, int height, float divisor)
+ {
+ SizeF size = new SizeF(width, height);
+ SizeF expected;
+
+ expected = new SizeF(width / divisor, height / divisor);
+ Assert.Equal(expected, size / divisor);
+ }
+
+ [Theory]
+ [InlineData(int.MaxValue, int.MinValue)]
+ [InlineData(int.MinValue, int.MinValue)]
+ [InlineData(int.MaxValue, int.MaxValue)]
+ [InlineData(0, 0)]
+ public void DeconstructTest(int width, int height)
+ {
+ Size s = new Size(width, height);
+
+ (int deconstructedWidth, int deconstructedHeight) = s;
+
+ Assert.Equal(width, deconstructedWidth);
+ Assert.Equal(height, deconstructedHeight);
+ }
+ }
+}
diff --git a/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs b/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs
index e97978198..82c22245d 100644
--- a/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs
+++ b/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs
@@ -4,7 +4,6 @@
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs
index c98f91046..680db5a15 100644
--- a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs
index 8b3524fe6..7dc0ff567 100644
--- a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Convolution;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs b/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs
index aecac22c0..bd7c0245b 100644
--- a/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs
+++ b/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs
@@ -6,7 +6,6 @@ using System.Linq;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing
{
diff --git a/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs b/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs
index 6c2a142af..1c6a1c7dd 100644
--- a/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs
+++ b/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs
@@ -5,7 +5,6 @@ using Moq;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing
diff --git a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs
index 32c4c6fe7..f7d6eba97 100644
--- a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs
@@ -2,11 +2,9 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Tests.TestUtilities;
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Overlays
diff --git a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs
index ebf4fee31..da11edf73 100644
--- a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs
@@ -1,11 +1,9 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Tests.TestUtilities;
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Overlays
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs
index d3507ed4c..13be1dd2d 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs
@@ -5,7 +5,6 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
// ReSharper disable InconsistentNaming
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs
index 4ae5d6051..4fe501237 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs
@@ -3,8 +3,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs
index 0a10d0755..05595eece 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs
@@ -4,7 +4,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs
index cf97ae4af..cd3f74f8e 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs
@@ -8,10 +8,8 @@ using System.Linq;
using System.Text.RegularExpressions;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Convolution;
-using SixLabors.Primitives;
using Xunit;
using Xunit.Abstractions;
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs
index a7cf9360c..66e9ba2df 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs
index 05524b20b..0e8013a64 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs
@@ -4,7 +4,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
// ReSharper disable InconsistentNaming
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs
index 24ed090d8..d1a3baa5a 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs
index 96d223ee9..535520cb8 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs
index 68daa80ea..eca3da58a 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs
@@ -7,7 +7,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
- using SixLabors.ImageSharp.Primitives;
+ using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
[GroupOutput("Filters")]
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs
index 5462a8b2d..e6a960f9e 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Overlays
{
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs b/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs
index c1c6bbd7c..0c09b6872 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs
@@ -4,7 +4,6 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs
index 9448feefe..470f48f78 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Overlays
{
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs
index 50217e892..b49ac3ea9 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs
@@ -6,7 +6,6 @@ using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs
index b351ec235..cdc96f042 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
index c683a51dc..763db47f9 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
@@ -12,7 +12,6 @@ using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
using SixLabors.ImageSharp.Tests.Memory;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs
index 70159e18a..42017f3af 100644
--- a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs
@@ -3,7 +3,6 @@
using System.Numerics;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{
diff --git a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs
index ed6d3ef2b..1c63d923a 100644
--- a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs
@@ -6,7 +6,6 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
using Xunit.Abstractions;
diff --git a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs
index 5350bd4a3..edf6a6440 100644
--- a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs
@@ -5,7 +5,6 @@ using System;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Transforms
diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs
index d82cd1689..309a73fb4 100644
--- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs
@@ -3,7 +3,6 @@
using System.Numerics;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{
diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs
index f268eda86..f87e17e06 100644
--- a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs
@@ -3,7 +3,6 @@
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Transforms
diff --git a/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs b/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs
index 71e3b7179..c13d4affd 100644
--- a/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs
+++ b/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs
@@ -4,7 +4,6 @@
using System;
using System.Numerics;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs
index 799794ca4..c8ddc8f75 100644
--- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs
+++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs
@@ -5,7 +5,7 @@ using System.Numerics;
namespace SixLabors.ImageSharp.Tests
{
- using SixLabors.ImageSharp.Primitives;
+ using SixLabors.ImageSharp;
internal static class IccTestDataMatrix
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/ApproximateFloatComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ApproximateFloatComparer.cs
index 872a935ff..2ed4d9382 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ApproximateFloatComparer.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ApproximateFloatComparer.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Numerics;
-using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Tests
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs
index 59167cc88..f5f709ce8 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs
@@ -3,8 +3,6 @@ using System.Collections.Generic;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
{
public class ExactImageComparer : ImageComparer
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs
index 024c2ee21..c44b89568 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs
@@ -1,8 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
{
public class ImageDimensionsMismatchException : ImagesSimilarityException
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs
index 38dada063..95b3eb024 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs
@@ -6,8 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
{
public abstract class ImageComparer
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/PixelDifference.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/PixelDifference.cs
index 1ffeb60ad..30380218c 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/PixelDifference.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/PixelDifference.cs
@@ -1,5 +1,4 @@
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs
index 8bed3a715..cbcc6b845 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs
@@ -5,8 +5,6 @@ using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.Primitives;
-
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
{
public class TolerantImageComparer : ImageComparer
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs
index e44de307f..7da9707ef 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs
@@ -4,7 +4,6 @@
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests
diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs
index 79c19f2be..1547edeeb 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
int w = bmp.Width;
int h = bmp.Height;
- var fullRect = new Rectangle(0, 0, w, h);
+ var fullRect = new System.Drawing.Rectangle(0, 0, w, h);
if (bmp.PixelFormat != PixelFormat.Format32bppArgb)
{
@@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
int w = bmp.Width;
int h = bmp.Height;
- var fullRect = new Rectangle(0, 0, w, h);
+ var fullRect = new System.Drawing.Rectangle(0, 0, w, h);
if (bmp.PixelFormat != PixelFormat.Format24bppRgb)
{
@@ -139,7 +139,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
int h = image.Height;
var resultBitmap = new Bitmap(w, h, PixelFormat.Format32bppArgb);
- var fullRect = new Rectangle(0, 0, w, h);
+ var fullRect = new System.Drawing.Rectangle(0, 0, w, h);
BitmapData data = resultBitmap.LockBits(fullRect, ImageLockMode.ReadWrite, resultBitmap.PixelFormat);
try
{
@@ -171,4 +171,4 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
return resultBitmap;
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
index f2bb7bdee..dcbc4f0c3 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
@@ -14,7 +14,6 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs b/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs
index e1209a0c6..fcda2eaa1 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Numerics;
using System.Runtime.InteropServices;
-using SixLabors.Memory;
+using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Tests.Memory
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
index a6ca00899..9ac8054ea 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
@@ -12,7 +12,6 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs
index 61db99298..97c87d486 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs
@@ -6,7 +6,6 @@ using Moq;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.Primitives;
using Xunit;
using Xunit.Abstractions;
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
index 07523f617..30a47062b 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
@@ -3,8 +3,6 @@
using System;
using System.IO;
-
-using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.Formats.Gif;