diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs b/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs
index 54602380f..5706d907d 100644
--- a/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs
+++ b/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs
@@ -5,12 +5,13 @@
namespace ImageSharp
{
+ using System;
///
/// An interface that represents a packed pixel type.
///
/// The packed format. uint, long, float.
public interface IPackedPixel : IPackedVector, IPackedBytes
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
}
}
diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedVector.cs b/src/ImageSharp/Colors/PackedPixel/IPackedVector.cs
index cdf250a01..32f06e271 100644
--- a/src/ImageSharp/Colors/PackedPixel/IPackedVector.cs
+++ b/src/ImageSharp/Colors/PackedPixel/IPackedVector.cs
@@ -5,6 +5,7 @@
namespace ImageSharp
{
+ using System;
using System.Numerics;
///
@@ -13,7 +14,7 @@ namespace ImageSharp
///
/// The packed format. uint, long, float.
public interface IPackedVector : IPackedVector
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
///
/// Gets or sets the packed representation of the value.
diff --git a/src/ImageSharp/Common/Extensions/ArrayExtensions.cs b/src/ImageSharp/Common/Extensions/ArrayExtensions.cs
index 57ca37217..8a1a641b4 100644
--- a/src/ImageSharp/Common/Extensions/ArrayExtensions.cs
+++ b/src/ImageSharp/Common/Extensions/ArrayExtensions.cs
@@ -5,6 +5,8 @@
namespace ImageSharp
{
+ using System;
+
///
/// Extension methods for arrays.
///
@@ -21,7 +23,7 @@ namespace ImageSharp
/// The
public static PixelAccessor Lock(this TColor[] pixels, int width, int height)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return new PixelAccessor(width, height, pixels);
}
diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs
index 9b3c62382..d11da5e34 100644
--- a/src/ImageSharp/Common/Helpers/ImageMaths.cs
+++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs
@@ -166,7 +166,7 @@ namespace ImageSharp
///
public static Rectangle GetFilteredBoundingRectangle(ImageBase bitmap, float componentValue, RgbaComponent channel = RgbaComponent.B)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
const float Epsilon = .00001f;
int width = bitmap.Width;
diff --git a/src/ImageSharp/Drawing/Brushes/Brushes`2.cs b/src/ImageSharp/Drawing/Brushes/Brushes`2.cs
index 65097f9e4..5d2f81dc8 100644
--- a/src/ImageSharp/Drawing/Brushes/Brushes`2.cs
+++ b/src/ImageSharp/Drawing/Brushes/Brushes`2.cs
@@ -3,6 +3,8 @@
// Licensed under the Apache License, Version 2.0.
//
+using System;
+
namespace ImageSharp.Drawing.Brushes
{
///
@@ -13,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes
/// A Brush
public class Brushes
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
///
/// Percent10 Hatch Pattern
diff --git a/src/ImageSharp/Drawing/Brushes/IBrush.cs b/src/ImageSharp/Drawing/Brushes/IBrush.cs
index fc7e14ed6..5dc79dc38 100644
--- a/src/ImageSharp/Drawing/Brushes/IBrush.cs
+++ b/src/ImageSharp/Drawing/Brushes/IBrush.cs
@@ -5,6 +5,8 @@
namespace ImageSharp.Drawing
{
+ using System;
+
using Processors;
///
@@ -18,7 +20,7 @@ namespace ImageSharp.Drawing
///
public interface IBrush
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
///
/// Creates the applicator for this brush.
diff --git a/src/ImageSharp/Drawing/Brushes/ImageBrush`2.cs b/src/ImageSharp/Drawing/Brushes/ImageBrush`2.cs
index c6cf7837f..19e0591a9 100644
--- a/src/ImageSharp/Drawing/Brushes/ImageBrush`2.cs
+++ b/src/ImageSharp/Drawing/Brushes/ImageBrush`2.cs
@@ -17,7 +17,7 @@ namespace ImageSharp.Drawing.Brushes
/// The packed format. uint, long, float.
public class ImageBrush : IBrush
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
///
/// The image to paint.
diff --git a/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs b/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs
index 0cf96460a..203fa85cd 100644
--- a/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs
+++ b/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.Drawing.Brushes
using System.Numerics;
using Processors;
+ using System;
///
/// Provides an implementation of a pattern brush for painting patterns.
@@ -43,7 +44,7 @@ namespace ImageSharp.Drawing.Brushes
/// The packed format. uint, long, float.
public class PatternBrush : IBrush
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
///
/// The pattern.
diff --git a/src/ImageSharp/Drawing/Brushes/Processors/IBrushApplicator.cs b/src/ImageSharp/Drawing/Brushes/Processors/IBrushApplicator.cs
index fa23c52d5..d762638b8 100644
--- a/src/ImageSharp/Drawing/Brushes/Processors/IBrushApplicator.cs
+++ b/src/ImageSharp/Drawing/Brushes/Processors/IBrushApplicator.cs
@@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Processors
///
public interface IBrushApplicator : IDisposable // disposable will be required if/when there is an ImageBrush
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
///
/// Gets the color for a single pixel.
diff --git a/src/ImageSharp/Drawing/Brushes/SolidBrush`2.cs b/src/ImageSharp/Drawing/Brushes/SolidBrush`2.cs
index 8a17a0c07..f882d59b3 100644
--- a/src/ImageSharp/Drawing/Brushes/SolidBrush`2.cs
+++ b/src/ImageSharp/Drawing/Brushes/SolidBrush`2.cs
@@ -5,6 +5,7 @@
namespace ImageSharp.Drawing.Brushes
{
+ using System;
using System.Numerics;
using Processors;
@@ -16,7 +17,7 @@ namespace ImageSharp.Drawing.Brushes
/// The packed format. uint, long, float.
public class SolidBrush : IBrush
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
///
/// The color to paint.
diff --git a/src/ImageSharp/Drawing/Draw.cs b/src/ImageSharp/Drawing/Draw.cs
index 8259ad3a0..e3d1be350 100644
--- a/src/ImageSharp/Drawing/Draw.cs
+++ b/src/ImageSharp/Drawing/Draw.cs
@@ -5,6 +5,7 @@
namespace ImageSharp
{
+ using System;
using System.Numerics;
using Drawing;
using Drawing.Brushes;
@@ -32,7 +33,7 @@ namespace ImageSharp
///
public static Image DrawPolygon(this Image source, IPen pen, IShape shape, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.Process(new DrawPathProcessor(pen, shape, options));
}
@@ -48,7 +49,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPolygon(this Image source, IPen pen, IShape shape)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(pen, shape, GraphicsOptions.Default);
}
@@ -68,7 +69,7 @@ namespace ImageSharp
///
public static Image DrawPolygon(this Image source, IBrush brush, float thickness, IShape shape, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new Pen(brush, thickness), shape, options);
}
@@ -85,7 +86,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPolygon(this Image source, IBrush brush, float thickness, IShape shape)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new Pen(brush, thickness), shape);
}
@@ -105,7 +106,7 @@ namespace ImageSharp
///
public static Image DrawPolygon(this Image source, TColor color, float thickness, IShape shape, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new SolidBrush(color), thickness, shape, options);
}
@@ -122,7 +123,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPolygon(this Image source, TColor color, float thickness, IShape shape)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new SolidBrush(color), thickness, shape);
}
@@ -142,7 +143,7 @@ namespace ImageSharp
///
public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options);
}
@@ -159,7 +160,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)));
}
@@ -176,7 +177,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new SolidBrush(color), thickness, points);
}
@@ -196,7 +197,7 @@ namespace ImageSharp
///
public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(new SolidBrush(color), thickness, points, options);
}
@@ -215,7 +216,7 @@ namespace ImageSharp
///
public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(pen, new Polygon(new LinearLineSegment(points)), options);
}
@@ -230,7 +231,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPolygon(pen, new Polygon(new LinearLineSegment(points)));
}
@@ -249,7 +250,7 @@ namespace ImageSharp
///
public static Image DrawPath(this Image source, IPen pen, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.Process(new DrawPathProcessor(pen, path, options));
}
@@ -265,7 +266,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPath(this Image source, IPen pen, IPath path)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.Process(new DrawPathProcessor(pen, path, GraphicsOptions.Default));
}
@@ -285,7 +286,7 @@ namespace ImageSharp
///
public static Image DrawPath(this Image source, IBrush brush, float thickness, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new Pen(brush, thickness), path, options);
}
@@ -302,7 +303,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPath(this Image source, IBrush brush, float thickness, IPath path)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new Pen(brush, thickness), path);
}
@@ -322,7 +323,7 @@ namespace ImageSharp
///
public static Image DrawPath(this Image source, TColor color, float thickness, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new SolidBrush(color), thickness, path, options);
}
@@ -339,7 +340,7 @@ namespace ImageSharp
/// The Image
public static Image DrawPath(this Image source, TColor color, float thickness, IPath path)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new SolidBrush(color), thickness, path);
}
@@ -359,7 +360,7 @@ namespace ImageSharp
///
public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options);
}
@@ -376,7 +377,7 @@ namespace ImageSharp
/// The Image
public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new Pen(brush, thickness), new Path(new LinearLineSegment(points)));
}
@@ -393,7 +394,7 @@ namespace ImageSharp
/// The Image
public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawLines(new SolidBrush(color), thickness, points);
}
@@ -413,7 +414,7 @@ namespace ImageSharp
///
public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawLines(new SolidBrush(color), thickness, points, options);
}
@@ -432,7 +433,7 @@ namespace ImageSharp
///
public static Image DrawLines(this Image source, IPen pen, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(pen, new Path(new LinearLineSegment(points)), options);
}
@@ -448,7 +449,7 @@ namespace ImageSharp
/// The Image
public static Image DrawLines(this Image source, IPen pen, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(pen, new Path(new LinearLineSegment(points)));
}
@@ -468,7 +469,7 @@ namespace ImageSharp
///
public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new Pen(brush, thickness), new Path(new BezierLineSegment(points)), options);
}
@@ -485,7 +486,7 @@ namespace ImageSharp
/// The Image
public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(new Pen(brush, thickness), new Path(new BezierLineSegment(points)));
}
@@ -502,7 +503,7 @@ namespace ImageSharp
/// The Image
public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawBeziers(new SolidBrush(color), thickness, points);
}
@@ -522,7 +523,7 @@ namespace ImageSharp
///
public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawBeziers(new SolidBrush(color), thickness, points, options);
}
@@ -541,7 +542,7 @@ namespace ImageSharp
///
public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(pen, new Path(new BezierLineSegment(points)), options);
}
@@ -557,7 +558,7 @@ namespace ImageSharp
/// The Image
public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return source.DrawPath(pen, new Path(new BezierLineSegment(points)));
}
diff --git a/src/ImageSharp/Drawing/DrawImage.cs b/src/ImageSharp/Drawing/DrawImage.cs
index 7196f1abb..d29415d37 100644
--- a/src/ImageSharp/Drawing/DrawImage.cs
+++ b/src/ImageSharp/Drawing/DrawImage.cs
@@ -5,6 +5,8 @@
namespace ImageSharp
{
+ using System;
+
using Processors;
///
@@ -23,7 +25,7 @@ namespace ImageSharp
/// The .
public static Image Blend(this Image source, Image image, int percent = 50)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
return DrawImage(source, image, percent, default(Size), default(Point));
}
@@ -41,7 +43,7 @@ namespace ImageSharp
/// The .
public static Image DrawImage(this Image source, Image image, int percent, Size size, Point location)
where TColor : struct, IPackedPixel
- where TPacked : struct
+ where TPacked : struct, IEquatable
{
if (size == default(Size))
{
diff --git a/src/ImageSharp/Drawing/Fill.cs b/src/ImageSharp/Drawing/Fill.cs
index ebd15a614..65b506f5e 100644
--- a/src/ImageSharp/Drawing/Fill.cs
+++ b/src/ImageSharp/Drawing/Fill.cs
@@ -5,13 +5,13 @@
namespace ImageSharp
{
+ using System;
using System.Numerics;
using Drawing;
using Drawing.Brushes;
using Drawing.Paths;
using Drawing.Processors;
using Drawing.Shapes;
- using Processors;
///
/// Extension methods for the type.
@@ -28,7 +28,7 @@ namespace ImageSharp
/// The Image
public static Image Fill(this Image