From 9afc73d2b47b4002d4ff92389fbf9d08dd19adaf Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 17 Dec 2016 21:51:58 +1100 Subject: [PATCH] Update TPacked signature Removes boxing allocation when comparing generic packed value. --- .../Colors/PackedPixel/IPackedPixel.cs | 3 +- .../Colors/PackedPixel/IPackedVector.cs | 3 +- .../Common/Extensions/ArrayExtensions.cs | 4 +- src/ImageSharp/Common/Helpers/ImageMaths.cs | 2 +- src/ImageSharp/Drawing/Brushes/Brushes`2.cs | 4 +- src/ImageSharp/Drawing/Brushes/IBrush.cs | 4 +- .../Drawing/Brushes/ImageBrush`2.cs | 2 +- .../Drawing/Brushes/PatternBrush`2.cs | 3 +- .../Brushes/Processors/IBrushApplicator.cs | 2 +- .../Drawing/Brushes/SolidBrush`2.cs | 3 +- src/ImageSharp/Drawing/Draw.cs | 61 ++++++++++--------- src/ImageSharp/Drawing/DrawImage.cs | 6 +- src/ImageSharp/Drawing/Fill.cs | 22 +++---- src/ImageSharp/Drawing/Pens/IPen.cs | 2 +- src/ImageSharp/Drawing/Pens/Pen.cs | 4 +- src/ImageSharp/Drawing/Pens/Pens.cs | 4 +- .../Pens/Processors/ColoredPointInfo.cs | 8 ++- .../Drawing/Pens/Processors/IPenApplicator.cs | 2 +- .../Drawing/Processors/DrawImageProcessor.cs | 2 +- .../Drawing/Processors/DrawPathProcessor.cs | 2 +- .../Drawing/Processors/FillProcessor.cs | 2 +- .../Drawing/Processors/FillShapeProcessor.cs | 2 +- .../Filters/Binarization/BinaryThreshold.cs | 6 +- .../Filters/ColorMatrix/BlackWhite.cs | 6 +- .../Filters/ColorMatrix/ColorBlindness.cs | 6 +- .../Filters/ColorMatrix/Grayscale.cs | 6 +- src/ImageSharp/Filters/ColorMatrix/Hue.cs | 6 +- .../Filters/ColorMatrix/Kodachrome.cs | 6 +- .../Filters/ColorMatrix/Lomograph.cs | 6 +- .../Filters/ColorMatrix/Polaroid.cs | 6 +- .../Filters/ColorMatrix/Saturation.cs | 6 +- src/ImageSharp/Filters/ColorMatrix/Sepia.cs | 6 +- src/ImageSharp/Filters/Convolution/BoxBlur.cs | 6 +- .../Filters/Convolution/DetectEdges.cs | 14 +++-- .../Filters/Convolution/GaussianBlur.cs | 6 +- .../Filters/Convolution/GaussianSharpen.cs | 6 +- src/ImageSharp/Filters/Effects/Alpha.cs | 6 +- .../Filters/Effects/BackgroundColor.cs | 4 +- src/ImageSharp/Filters/Effects/Brightness.cs | 6 +- src/ImageSharp/Filters/Effects/Contrast.cs | 6 +- src/ImageSharp/Filters/Effects/Invert.cs | 6 +- src/ImageSharp/Filters/Effects/OilPainting.cs | 4 +- src/ImageSharp/Filters/Effects/Pixelate.cs | 4 +- src/ImageSharp/Filters/Overlays/Glow.cs | 12 ++-- src/ImageSharp/Filters/Overlays/Vignette.cs | 12 ++-- .../Binarization/BinaryThresholdProcessor.cs | 2 +- .../ColorMatrix/BlackWhiteProcessor.cs | 3 +- .../ColorBlindness/AchromatomalyProcessor.cs | 3 +- .../ColorBlindness/AchromatopsiaProcessor.cs | 3 +- .../ColorBlindness/DeuteranomalyProcessor.cs | 3 +- .../ColorBlindness/DeuteranopiaProcessor.cs | 3 +- .../ColorBlindness/ProtanomalyProcessor.cs | 3 +- .../ColorBlindness/ProtanopiaProcessor.cs | 3 +- .../ColorBlindness/TritanomalyProcessor.cs | 3 +- .../ColorBlindness/TritanopiaProcessor.cs | 3 +- .../ColorMatrix/ColorMatrixFilter.cs | 2 +- .../ColorMatrix/GrayscaleBt601Processor.cs | 3 +- .../ColorMatrix/GrayscaleBt709Processor.cs | 3 +- .../Processors/ColorMatrix/HueProcessor.cs | 2 +- .../ColorMatrix/IColorMatrixFilter.cs | 3 +- .../ColorMatrix/KodachromeProcessor.cs | 3 +- .../ColorMatrix/LomographProcessor.cs | 3 +- .../ColorMatrix/PolaroidProcessor.cs | 3 +- .../ColorMatrix/SaturationProcessor.cs | 3 +- .../Processors/ColorMatrix/SepiaProcessor.cs | 3 +- .../Convolution/BoxBlurProcessor.cs | 4 +- .../Convolution/Convolution2DProcessor.cs | 2 +- .../Convolution/Convolution2PassProcessor.cs | 3 +- .../Convolution/ConvolutionProcessor.cs | 3 +- .../EdgeDetection/EdgeDetector2DProcessor.cs | 4 +- .../EdgeDetectorCompassProcessor.cs | 2 +- .../EdgeDetection/EdgeDetectorProcessor.cs | 4 +- .../EdgeDetection/IEdgeDetectorProcessor.cs | 4 +- .../EdgeDetection/KayyaliProcessor.cs | 3 +- .../EdgeDetection/KirschProcessor.cs | 3 +- .../EdgeDetection/Laplacian3X3Processor.cs | 3 +- .../EdgeDetection/Laplacian5X5Processor.cs | 3 +- .../LaplacianOfGaussianProcessor.cs | 3 +- .../EdgeDetection/PrewittProcessor.cs | 3 +- .../EdgeDetection/RobertsCrossProcessor.cs | 3 +- .../EdgeDetection/RobinsonProcessor.cs | 3 +- .../EdgeDetection/ScharrProcessor.cs | 3 +- .../EdgeDetection/SobelProcessor.cs | 3 +- .../Convolution/GaussianBlurProcessor.cs | 2 +- .../Convolution/GaussianSharpenProcessor.cs | 2 +- .../Processors/Effects/AlphaProcessor.cs | 2 +- .../Effects/BackgroundColorProcessor.cs | 2 +- .../Processors/Effects/BrightnessProcessor.cs | 2 +- .../Processors/Effects/ContrastProcessor.cs | 2 +- .../Processors/Effects/InvertProcessor.cs | 2 +- .../Effects/OilPaintingProcessor.cs | 2 +- .../Processors/Effects/PixelateProcessor.cs | 2 +- .../Processors/IImageFilteringProcessor.cs | 4 +- .../Processors/ImageFilteringProcessor.cs | 2 +- .../Processors/Overlays/GlowProcessor.cs | 2 +- .../Processors/Overlays/VignetteProcessor.cs | 2 +- .../Transforms/CompandingResizeProcessor.cs | 2 +- .../Processors/Transforms/CropProcessor.cs | 2 +- .../Transforms/EntropyCropProcessor.cs | 4 +- .../Processors/Transforms/FlipProcessor.cs | 2 +- .../Transforms/Matrix3x2Processor.cs | 3 +- .../Transforms/ResamplingWeightedProcessor.cs | 2 +- .../Processors/Transforms/ResizeProcessor.cs | 2 +- .../Processors/Transforms/RotateProcessor.cs | 2 +- .../Processors/Transforms/SkewProcessor.cs | 2 +- .../Filters/Transforms/AutoOrient.cs | 6 +- src/ImageSharp/Filters/Transforms/Crop.cs | 6 +- .../Filters/Transforms/EntropyCrop.cs | 4 +- src/ImageSharp/Filters/Transforms/Flip.cs | 4 +- .../Transforms/Options/ResizeHelper.cs | 12 ++-- src/ImageSharp/Filters/Transforms/Pad.cs | 4 +- src/ImageSharp/Filters/Transforms/Resize.cs | 14 +++-- src/ImageSharp/Filters/Transforms/Rotate.cs | 8 ++- .../Filters/Transforms/RotateFlip.cs | 4 +- src/ImageSharp/Filters/Transforms/Skew.cs | 6 +- src/ImageSharp/Formats/Bmp/BmpDecoder.cs | 2 +- src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs | 10 +-- src/ImageSharp/Formats/Bmp/BmpEncoder.cs | 2 +- src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs | 9 +-- src/ImageSharp/Formats/Gif/GifDecoder.cs | 2 +- src/ImageSharp/Formats/Gif/GifDecoderCore.cs | 2 +- src/ImageSharp/Formats/Gif/GifEncoder.cs | 2 +- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 14 ++--- src/ImageSharp/Formats/IImageDecoder.cs | 3 +- src/ImageSharp/Formats/IImageEncoder.cs | 3 +- src/ImageSharp/Formats/Jpg/JpegDecoder.cs | 2 +- src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs | 18 +++--- src/ImageSharp/Formats/Jpg/JpegEncoder.cs | 2 +- src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs | 12 ++-- src/ImageSharp/Formats/Png/PngDecoder.cs | 2 +- src/ImageSharp/Formats/Png/PngDecoderCore.cs | 16 ++--- src/ImageSharp/Formats/Png/PngEncoder.cs | 2 +- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 16 ++--- src/ImageSharp/Image/IImageBase.cs | 4 +- src/ImageSharp/Image/IImageFrame.cs | 4 +- src/ImageSharp/Image/Image.cs | 4 +- src/ImageSharp/Image/ImageBase.cs | 2 +- src/ImageSharp/Image/ImageFrame.cs | 4 +- src/ImageSharp/Image/ImageIOExtensions.cs | 9 +-- .../Image/ImageProcessingExtensions.cs | 6 +- src/ImageSharp/Image/PixelAccessor.cs | 2 +- src/ImageSharp/Image/PixelArea.cs | 2 +- src/ImageSharp/ImageProcessor.cs | 3 +- src/ImageSharp/Profiles/Exif/ExifProfile.cs | 3 +- src/ImageSharp/Quantizers/IQuantizer.cs | 4 +- .../Quantizers/Octree/OctreeQuantizer.cs | 2 +- src/ImageSharp/Quantizers/Octree/Quantizer.cs | 3 +- .../Quantizers/Palette/PaletteQuantizer.cs | 2 +- src/ImageSharp/Quantizers/Quantize.cs | 6 +- src/ImageSharp/Quantizers/QuantizedImage.cs | 2 +- src/ImageSharp/Quantizers/Wu/WuQuantizer.cs | 2 +- .../Image/PixelAccessorTests.cs | 20 +++--- 152 files changed, 434 insertions(+), 298 deletions(-) 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 source, IBrush brush) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(new FillProcessor(brush)); } @@ -43,7 +43,7 @@ namespace ImageSharp /// The Image public static Image Fill(this Image source, TColor color) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Fill(new SolidBrush(color)); } @@ -59,7 +59,7 @@ namespace ImageSharp /// The Image public static Image Fill(this Image source, IBrush brush, IShape shape, GraphicsOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(new FillShapeProcessor(brush, shape, options)); } @@ -75,7 +75,7 @@ namespace ImageSharp /// The Image public static Image Fill(this Image source, IBrush brush, IShape shape) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(new FillShapeProcessor(brush, shape, GraphicsOptions.Default)); } @@ -94,7 +94,7 @@ namespace ImageSharp /// public static Image Fill(this Image source, TColor color, IShape shape, GraphicsOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Fill(new SolidBrush(color), shape, options); } @@ -110,7 +110,7 @@ namespace ImageSharp /// The Image public static Image Fill(this Image source, TColor color, IShape shape) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Fill(new SolidBrush(color), shape); } @@ -129,7 +129,7 @@ namespace ImageSharp /// public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points, GraphicsOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // using Polygon directly instead of LinearPolygon as its will have less indirection return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options); @@ -146,7 +146,7 @@ namespace ImageSharp /// The Image public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // using Polygon directly instead of LinearPolygon as its will have less indirection return source.Fill(brush, new Polygon(new LinearLineSegment(points))); @@ -166,7 +166,7 @@ namespace ImageSharp /// public static Image FillPolygon(this Image source, TColor color, Vector2[] points, GraphicsOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // using Polygon directly instead of LinearPolygon as its will have less indirection return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options); @@ -183,7 +183,7 @@ namespace ImageSharp /// The Image public static Image FillPolygon(this Image source, TColor color, Vector2[] points) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // using Polygon directly instead of LinearPolygon as its will have less indirection return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points))); diff --git a/src/ImageSharp/Drawing/Pens/IPen.cs b/src/ImageSharp/Drawing/Pens/IPen.cs index 38b9056aa..02476976d 100644 --- a/src/ImageSharp/Drawing/Pens/IPen.cs +++ b/src/ImageSharp/Drawing/Pens/IPen.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Pens /// The type of the packed. public interface IPen where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Creates the applicator for applying this pen to an Image diff --git a/src/ImageSharp/Drawing/Pens/Pen.cs b/src/ImageSharp/Drawing/Pens/Pen.cs index 591707efa..c4dcaf38c 100644 --- a/src/ImageSharp/Drawing/Pens/Pen.cs +++ b/src/ImageSharp/Drawing/Pens/Pen.cs @@ -72,9 +72,9 @@ namespace ImageSharp.Drawing.Pens /// section 3 will be width/2 long and will be filled /// the the pattern will imidiatly repeat without gap. /// - public partial class Pen : IPen + public class Pen : IPen where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { private static readonly float[] EmptyPattern = new float[0]; private readonly float[] pattern; diff --git a/src/ImageSharp/Drawing/Pens/Pens.cs b/src/ImageSharp/Drawing/Pens/Pens.cs index 2ab4ef040..4b1b4a2e1 100644 --- a/src/ImageSharp/Drawing/Pens/Pens.cs +++ b/src/ImageSharp/Drawing/Pens/Pens.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Pens { + using System; + /// /// Common Pen styles /// @@ -108,7 +110,7 @@ namespace ImageSharp.Drawing.Pens /// The type of the packed. public partial class Pens where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f }; private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f }; diff --git a/src/ImageSharp/Drawing/Pens/Processors/ColoredPointInfo.cs b/src/ImageSharp/Drawing/Pens/Processors/ColoredPointInfo.cs index 64c0e4715..86f54a143 100644 --- a/src/ImageSharp/Drawing/Pens/Processors/ColoredPointInfo.cs +++ b/src/ImageSharp/Drawing/Pens/Processors/ColoredPointInfo.cs @@ -5,14 +5,16 @@ namespace ImageSharp.Drawing.Pens.Processors { + using System; + /// - /// Returns details about how far awau from the inside of a shape and the color the pixel could be. + /// Returns details about how far away from the inside of a shape and the color the pixel could be. /// /// The type of the color. /// The type of the packed. public struct ColoredPointInfo - where TColor : struct, IPackedPixel - where TPacked : struct + where TColor : struct, IPackedPixel + where TPacked : struct, IEquatable { /// /// The color diff --git a/src/ImageSharp/Drawing/Pens/Processors/IPenApplicator.cs b/src/ImageSharp/Drawing/Pens/Processors/IPenApplicator.cs index 968240b6a..f3b244140 100644 --- a/src/ImageSharp/Drawing/Pens/Processors/IPenApplicator.cs +++ b/src/ImageSharp/Drawing/Pens/Processors/IPenApplicator.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Pens.Processors /// The type of the packed. public interface IPenApplicator : IDisposable where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Gets the required region. diff --git a/src/ImageSharp/Drawing/Processors/DrawImageProcessor.cs b/src/ImageSharp/Drawing/Processors/DrawImageProcessor.cs index 0c2f0ba2e..37921e8d2 100644 --- a/src/ImageSharp/Drawing/Processors/DrawImageProcessor.cs +++ b/src/ImageSharp/Drawing/Processors/DrawImageProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class DrawImageProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs b/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs index 2fba6eb4f..b1b3e8dc9 100644 --- a/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs +++ b/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs @@ -24,7 +24,7 @@ namespace ImageSharp.Drawing.Processors /// public class DrawPathProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { private const float AntialiasFactor = 1f; private const int PaddingFactor = 1; // needs to been the same or greater than AntialiasFactor diff --git a/src/ImageSharp/Drawing/Processors/FillProcessor.cs b/src/ImageSharp/Drawing/Processors/FillProcessor.cs index 58c4f8e21..6d2eff972 100644 --- a/src/ImageSharp/Drawing/Processors/FillProcessor.cs +++ b/src/ImageSharp/Drawing/Processors/FillProcessor.cs @@ -19,7 +19,7 @@ namespace ImageSharp.Drawing.Processors /// The packed format. uint, long, float. public class FillProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { private const float Epsilon = 0.001f; diff --git a/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs b/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs index 69cc451db..6ced979e5 100644 --- a/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs +++ b/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs @@ -20,7 +20,7 @@ namespace ImageSharp.Drawing.Processors /// public class FillShapeProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { private const float Epsilon = 0.001f; diff --git a/src/ImageSharp/Filters/Binarization/BinaryThreshold.cs b/src/ImageSharp/Filters/Binarization/BinaryThreshold.cs index d97441fe2..e868764c4 100644 --- a/src/ImageSharp/Filters/Binarization/BinaryThreshold.cs +++ b/src/ImageSharp/Filters/Binarization/BinaryThreshold.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image BinaryThreshold(this Image source, float threshold) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return BinaryThreshold(source, threshold, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image BinaryThreshold(this Image source, float threshold, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new BinaryThresholdProcessor(threshold)); } diff --git a/src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs b/src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs index 7e6c6601e..753a1f1a4 100644 --- a/src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs +++ b/src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image BlackWhite(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return BlackWhite(source, source.Bounds); } @@ -38,7 +40,7 @@ namespace ImageSharp /// The . public static Image BlackWhite(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new BlackWhiteProcessor()); } diff --git a/src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs b/src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs index 30f5fefd4..129de9517 100644 --- a/src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs +++ b/src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return ColorBlindness(source, colorBlindness, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { IImageFilteringProcessor processor; diff --git a/src/ImageSharp/Filters/ColorMatrix/Grayscale.cs b/src/ImageSharp/Filters/ColorMatrix/Grayscale.cs index 1a68e3e04..125553827 100644 --- a/src/ImageSharp/Filters/ColorMatrix/Grayscale.cs +++ b/src/ImageSharp/Filters/ColorMatrix/Grayscale.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image Grayscale(this Image source, GrayscaleMode mode = GrayscaleMode.Bt709) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Grayscale(source, source.Bounds, mode); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image Grayscale(this Image source, Rectangle rectangle, GrayscaleMode mode = GrayscaleMode.Bt709) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { IImageFilteringProcessor processor = mode == GrayscaleMode.Bt709 ? (IImageFilteringProcessor)new GrayscaleBt709Processor() diff --git a/src/ImageSharp/Filters/ColorMatrix/Hue.cs b/src/ImageSharp/Filters/ColorMatrix/Hue.cs index c146667a0..c91ba4418 100644 --- a/src/ImageSharp/Filters/ColorMatrix/Hue.cs +++ b/src/ImageSharp/Filters/ColorMatrix/Hue.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image Hue(this Image source, float degrees) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Hue(source, degrees, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image Hue(this Image source, float degrees, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new HueProcessor(degrees)); } diff --git a/src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs b/src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs index f47bfa5c3..1ba240b46 100644 --- a/src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs +++ b/src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Kodachrome(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Kodachrome(source, source.Bounds); } @@ -38,7 +40,7 @@ namespace ImageSharp /// The . public static Image Kodachrome(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new KodachromeProcessor()); } diff --git a/src/ImageSharp/Filters/ColorMatrix/Lomograph.cs b/src/ImageSharp/Filters/ColorMatrix/Lomograph.cs index 84fccd374..7d4054ccc 100644 --- a/src/ImageSharp/Filters/ColorMatrix/Lomograph.cs +++ b/src/ImageSharp/Filters/ColorMatrix/Lomograph.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Lomograph(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Lomograph(source, source.Bounds); } @@ -38,7 +40,7 @@ namespace ImageSharp /// The . public static Image Lomograph(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new LomographProcessor()); } diff --git a/src/ImageSharp/Filters/ColorMatrix/Polaroid.cs b/src/ImageSharp/Filters/ColorMatrix/Polaroid.cs index f77c95a4b..5605aea17 100644 --- a/src/ImageSharp/Filters/ColorMatrix/Polaroid.cs +++ b/src/ImageSharp/Filters/ColorMatrix/Polaroid.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Polaroid(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Polaroid(source, source.Bounds); } @@ -38,7 +40,7 @@ namespace ImageSharp /// The . public static Image Polaroid(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new PolaroidProcessor()); } diff --git a/src/ImageSharp/Filters/ColorMatrix/Saturation.cs b/src/ImageSharp/Filters/ColorMatrix/Saturation.cs index 6fb0a463c..a6d89be51 100644 --- a/src/ImageSharp/Filters/ColorMatrix/Saturation.cs +++ b/src/ImageSharp/Filters/ColorMatrix/Saturation.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image Saturation(this Image source, int amount) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Saturation(source, amount, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image Saturation(this Image source, int amount, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new SaturationProcessor(amount)); } diff --git a/src/ImageSharp/Filters/ColorMatrix/Sepia.cs b/src/ImageSharp/Filters/ColorMatrix/Sepia.cs index 6bd070cc8..c7215390f 100644 --- a/src/ImageSharp/Filters/ColorMatrix/Sepia.cs +++ b/src/ImageSharp/Filters/ColorMatrix/Sepia.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Sepia(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Sepia(source, source.Bounds); } @@ -38,7 +40,7 @@ namespace ImageSharp /// The . public static Image Sepia(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new SepiaProcessor()); } diff --git a/src/ImageSharp/Filters/Convolution/BoxBlur.cs b/src/ImageSharp/Filters/Convolution/BoxBlur.cs index 4c0aa8d1f..cdc92e1cf 100644 --- a/src/ImageSharp/Filters/Convolution/BoxBlur.cs +++ b/src/ImageSharp/Filters/Convolution/BoxBlur.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image BoxBlur(this Image source, int radius = 7) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return BoxBlur(source, radius, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image BoxBlur(this Image source, int radius, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new BoxBlurProcessor(radius)); } diff --git a/src/ImageSharp/Filters/Convolution/DetectEdges.cs b/src/ImageSharp/Filters/Convolution/DetectEdges.cs index 3ddcc6672..86c850360 100644 --- a/src/ImageSharp/Filters/Convolution/DetectEdges.cs +++ b/src/ImageSharp/Filters/Convolution/DetectEdges.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image DetectEdges(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return DetectEdges(source, source.Bounds, new SobelProcessor { Grayscale = true }); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image DetectEdges(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return DetectEdges(source, rectangle, new SobelProcessor { Grayscale = true }); } @@ -56,7 +58,7 @@ namespace ImageSharp /// The . public static Image DetectEdges(this Image source, EdgeDetection filter, bool grayscale = true) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return DetectEdges(source, filter, source.Bounds, grayscale); } @@ -75,7 +77,7 @@ namespace ImageSharp /// The . public static Image DetectEdges(this Image source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { IEdgeDetectorProcessor processor; @@ -135,7 +137,7 @@ namespace ImageSharp /// The . public static Image DetectEdges(this Image source, IEdgeDetectorProcessor filter) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return DetectEdges(source, source.Bounds, filter); } @@ -153,7 +155,7 @@ namespace ImageSharp /// The . public static Image DetectEdges(this Image source, Rectangle rectangle, IEdgeDetectorProcessor filter) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, filter); } diff --git a/src/ImageSharp/Filters/Convolution/GaussianBlur.cs b/src/ImageSharp/Filters/Convolution/GaussianBlur.cs index 9bc814c5c..e1e7a74ea 100644 --- a/src/ImageSharp/Filters/Convolution/GaussianBlur.cs +++ b/src/ImageSharp/Filters/Convolution/GaussianBlur.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image GaussianBlur(this Image source, float sigma = 3f) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return GaussianBlur(source, sigma, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image GaussianBlur(this Image source, float sigma, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new GaussianBlurProcessor(sigma)); } diff --git a/src/ImageSharp/Filters/Convolution/GaussianSharpen.cs b/src/ImageSharp/Filters/Convolution/GaussianSharpen.cs index b3b5efa3f..57e5174ef 100644 --- a/src/ImageSharp/Filters/Convolution/GaussianSharpen.cs +++ b/src/ImageSharp/Filters/Convolution/GaussianSharpen.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image GaussianSharpen(this Image source, float sigma = 3f) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return GaussianSharpen(source, sigma, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image GaussianSharpen(this Image source, float sigma, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new GaussianSharpenProcessor(sigma)); } diff --git a/src/ImageSharp/Filters/Effects/Alpha.cs b/src/ImageSharp/Filters/Effects/Alpha.cs index a985165ad..c45deb176 100644 --- a/src/ImageSharp/Filters/Effects/Alpha.cs +++ b/src/ImageSharp/Filters/Effects/Alpha.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image Alpha(this Image source, int percent) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Alpha(source, percent, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image Alpha(this Image source, int percent, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new AlphaProcessor(percent)); } diff --git a/src/ImageSharp/Filters/Effects/BackgroundColor.cs b/src/ImageSharp/Filters/Effects/BackgroundColor.cs index 47cbee4fb..fe5884acf 100644 --- a/src/ImageSharp/Filters/Effects/BackgroundColor.cs +++ b/src/ImageSharp/Filters/Effects/BackgroundColor.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image BackgroundColor(this Image source, TColor color) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(source.Bounds, new BackgroundColorProcessor(color)); } diff --git a/src/ImageSharp/Filters/Effects/Brightness.cs b/src/ImageSharp/Filters/Effects/Brightness.cs index 2e167c54f..2d2a42247 100644 --- a/src/ImageSharp/Filters/Effects/Brightness.cs +++ b/src/ImageSharp/Filters/Effects/Brightness.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image Brightness(this Image source, int amount) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Brightness(source, amount, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image Brightness(this Image source, int amount, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new BrightnessProcessor(amount)); } diff --git a/src/ImageSharp/Filters/Effects/Contrast.cs b/src/ImageSharp/Filters/Effects/Contrast.cs index 6f9c45cc6..279e874f1 100644 --- a/src/ImageSharp/Filters/Effects/Contrast.cs +++ b/src/ImageSharp/Filters/Effects/Contrast.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The . public static Image Contrast(this Image source, int amount) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Contrast(source, amount, source.Bounds); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The . public static Image Contrast(this Image source, int amount, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new ContrastProcessor(amount)); } diff --git a/src/ImageSharp/Filters/Effects/Invert.cs b/src/ImageSharp/Filters/Effects/Invert.cs index a948c511d..148e9c7d8 100644 --- a/src/ImageSharp/Filters/Effects/Invert.cs +++ b/src/ImageSharp/Filters/Effects/Invert.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Invert(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Invert(source, source.Bounds); } @@ -38,7 +40,7 @@ namespace ImageSharp /// The . public static Image Invert(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Process(rectangle, new InvertProcessor()); } diff --git a/src/ImageSharp/Filters/Effects/OilPainting.cs b/src/ImageSharp/Filters/Effects/OilPainting.cs index 338921d7d..e31f51178 100644 --- a/src/ImageSharp/Filters/Effects/OilPainting.cs +++ b/src/ImageSharp/Filters/Effects/OilPainting.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The . public static Image OilPaint(this Image source, int levels = 10, int brushSize = 15) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return OilPaint(source, levels, brushSize, source.Bounds); } @@ -44,7 +44,7 @@ namespace ImageSharp /// The . public static Image OilPaint(this Image source, int levels, int brushSize, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Guard.MustBeGreaterThan(levels, 0, nameof(levels)); diff --git a/src/ImageSharp/Filters/Effects/Pixelate.cs b/src/ImageSharp/Filters/Effects/Pixelate.cs index 84afb00cb..a221d7fc0 100644 --- a/src/ImageSharp/Filters/Effects/Pixelate.cs +++ b/src/ImageSharp/Filters/Effects/Pixelate.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The . public static Image Pixelate(this Image source, int size = 4) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Pixelate(source, size, source.Bounds); } @@ -42,7 +42,7 @@ namespace ImageSharp /// The . public static Image Pixelate(this Image source, int size, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { if (size <= 0 || size > source.Height || size > source.Width) { diff --git a/src/ImageSharp/Filters/Overlays/Glow.cs b/src/ImageSharp/Filters/Overlays/Glow.cs index 1b829850d..ed2d8ffbb 100644 --- a/src/ImageSharp/Filters/Overlays/Glow.cs +++ b/src/ImageSharp/Filters/Overlays/Glow.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Glow(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Glow(source, default(TColor), source.Bounds.Width * .5F, source.Bounds); } @@ -36,7 +38,7 @@ namespace ImageSharp /// The . public static Image Glow(this Image source, TColor color) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Glow(source, color, source.Bounds.Width * .5F, source.Bounds); } @@ -51,7 +53,7 @@ namespace ImageSharp /// The . public static Image Glow(this Image source, float radius) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Glow(source, default(TColor), radius, source.Bounds); } @@ -68,7 +70,7 @@ namespace ImageSharp /// The . public static Image Glow(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Glow(source, default(TColor), 0, rectangle); } @@ -87,7 +89,7 @@ namespace ImageSharp /// The . public static Image Glow(this Image source, TColor color, float radius, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { GlowProcessor processor = new GlowProcessor { Radius = radius, }; diff --git a/src/ImageSharp/Filters/Overlays/Vignette.cs b/src/ImageSharp/Filters/Overlays/Vignette.cs index b8f10b27a..31fe1c5b6 100644 --- a/src/ImageSharp/Filters/Overlays/Vignette.cs +++ b/src/ImageSharp/Filters/Overlays/Vignette.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Vignette(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Vignette(source, default(TColor), source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); } @@ -36,7 +38,7 @@ namespace ImageSharp /// The . public static Image Vignette(this Image source, TColor color) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Vignette(source, color, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); } @@ -52,7 +54,7 @@ namespace ImageSharp /// The . public static Image Vignette(this Image source, float radiusX, float radiusY) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Vignette(source, default(TColor), radiusX, radiusY, source.Bounds); } @@ -69,7 +71,7 @@ namespace ImageSharp /// The . public static Image Vignette(this Image source, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Vignette(source, default(TColor), 0, 0, rectangle); } @@ -89,7 +91,7 @@ namespace ImageSharp /// The . public static Image Vignette(this Image source, TColor color, float radiusX, float radiusY, Rectangle rectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { VignetteProcessor processor = new VignetteProcessor { RadiusX = radiusX, RadiusY = radiusY }; diff --git a/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs index 64aa72401..84b88222b 100644 --- a/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class BinaryThresholdProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs index 1721805b8..f59cd34e7 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class BlackWhiteProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs index e3e1379d7..6d15e094d 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class AchromatomalyProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs index 71a2fff6e..96dc756de 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class AchromatopsiaProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs index 308f528c0..7445460f8 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class DeuteranomalyProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs index ac0a5baba..95e301954 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class DeuteranopiaProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs index 75b011f04..7d6ad7397 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class ProtanomalyProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs index a9881e42f..511b3c89d 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class ProtanopiaProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs index 06da2a6ee..52aca09e0 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class TritanomalyProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs index c698a909e..0a121c3ed 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class TritanopiaProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs index 4c4868a01..f250b5a42 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class ColorMatrixFilter : ImageFilteringProcessor, IColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public abstract Matrix4x4 Matrix { get; } diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs index ce34d3a24..53b131563 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -15,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class GrayscaleBt601Processor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs index cc9d727b3..e3bf2d4b7 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -15,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class GrayscaleBt709Processor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/HueProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/HueProcessor.cs index 5e9c483d7..c2fa370e8 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/HueProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/HueProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class HueProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs index 82cc2166d..627098d66 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -15,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public interface IColorMatrixFilter : IImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Gets the used to alter the image. diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/KodachromeProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/KodachromeProcessor.cs index 0778ce602..fc797bb38 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/KodachromeProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/KodachromeProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class KodachromeProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/LomographProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/LomographProcessor.cs index 490bb13c2..055e664a0 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/LomographProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/LomographProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class LomographProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/PolaroidProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/PolaroidProcessor.cs index a5d907dde..485651504 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/PolaroidProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/PolaroidProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class PolaroidProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs index a44d54542..e578e77cd 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class SaturationProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/SepiaProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/SepiaProcessor.cs index 506f39747..8382af02a 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/SepiaProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/SepiaProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -15,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class SepiaProcessor : ColorMatrixFilter where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public override Matrix4x4 Matrix => new Matrix4x4 diff --git a/src/ImageSharp/Filters/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/BoxBlurProcessor.cs index bc20bde3e..544c76807 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/BoxBlurProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/BoxBlurProcessor.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Processors { + using System; + /// /// Applies a Box blur sampler to the image. /// @@ -12,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class BoxBlurProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The maximum size of the kernel in either direction. diff --git a/src/ImageSharp/Filters/Processors/Convolution/Convolution2DProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/Convolution2DProcessor.cs index 86e3a2624..0eb84d41a 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/Convolution2DProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/Convolution2DProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class Convolution2DProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Convolution/Convolution2PassProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/Convolution2PassProcessor.cs index 38bfb7300..bc33cea2e 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/Convolution2PassProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/Convolution2PassProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; using System.Threading.Tasks; @@ -15,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class Convolution2PassProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Convolution/ConvolutionProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/ConvolutionProcessor.cs index 435718de3..4b7dbf171 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/ConvolutionProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/ConvolutionProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; using System.Threading.Tasks; @@ -15,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class ConvolutionProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs index 753883f3c..7b126c3ee 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Processors { + using System; + /// /// Defines a sampler that detects edges within an image using two one-dimensional matrices. /// @@ -12,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class EdgeDetector2DProcessor : ImageFilteringProcessor, IEdgeDetectorProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Gets the horizontal gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs index bc78a2e5c..1fa527c6e 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class EdgeDetectorCompassProcessor : ImageFilteringProcessor, IEdgeDetectorProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Gets the North gradient operator diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs index 1e6989372..e454b7484 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Processors { + using System; + /// /// Defines a sampler that detects edges within an image using a single two dimensional matrix. /// @@ -12,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class EdgeDetectorProcessor : ImageFilteringProcessor, IEdgeDetectorProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public bool Grayscale { get; set; } diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs index 65abc525f..9e8c4cc42 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Processors { + using System; + /// /// Provides properties and methods allowing the detection of edges within an image. /// @@ -12,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public interface IEdgeDetectorProcessor : IImageFilteringProcessor, IEdgeDetectorProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { } diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs index 039836230..cf2fec302 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class KayyaliProcessor : EdgeDetector2DProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KirschProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KirschProcessor.cs index 77fbfdb6e..d65bfe304 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KirschProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KirschProcessor.cs @@ -4,6 +4,7 @@ // namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -15,7 +16,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class KirschProcessor : EdgeDetectorCompassProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The North gradient operator diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs index 73d5c540b..eaf68178e 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class Laplacian3X3Processor : EdgeDetectorProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The 2d gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs index 70ddfb087..00735b4ec 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class Laplacian5X5Processor : EdgeDetectorProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The 2d gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs index 78498f69a..95a3f717d 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class LaplacianOfGaussianProcessor : EdgeDetectorProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The 2d gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/PrewittProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/PrewittProcessor.cs index 8cf42c293..f91db77e3 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/PrewittProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/PrewittProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class PrewittProcessor : EdgeDetector2DProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs index 2789010e2..abb4914f5 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class RobertsCrossProcessor : EdgeDetector2DProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs index b888e400d..2bddf0d3e 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs @@ -4,6 +4,7 @@ // namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -15,7 +16,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class RobinsonProcessor : EdgeDetectorCompassProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The North gradient operator diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/ScharrProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/ScharrProcessor.cs index e49b9b528..1755e6568 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/ScharrProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/ScharrProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class ScharrProcessor : EdgeDetector2DProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/SobelProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/SobelProcessor.cs index 274cd8470..0017cf545 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/SobelProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/SobelProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Diagnostics.CodeAnalysis; /// @@ -16,7 +17,7 @@ namespace ImageSharp.Processors [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class SobelProcessor : EdgeDetector2DProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp/Filters/Processors/Convolution/GaussianBlurProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/GaussianBlurProcessor.cs index c24b1ef8c..1ff2484e2 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/GaussianBlurProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/GaussianBlurProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class GaussianBlurProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The maximum size of the kernel in either direction. diff --git a/src/ImageSharp/Filters/Processors/Convolution/GaussianSharpenProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/GaussianSharpenProcessor.cs index 34bd4897e..d9865e481 100644 --- a/src/ImageSharp/Filters/Processors/Convolution/GaussianSharpenProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Convolution/GaussianSharpenProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class GaussianSharpenProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The maximum size of the kernel in either direction. diff --git a/src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs index 0e589d328..2e29c4810 100644 --- a/src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class AlphaProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs index cf1437557..26e5f8584 100644 --- a/src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class BackgroundColorProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The epsilon for comparing floating point numbers. diff --git a/src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs index c90e6ffdb..fdcdd094a 100644 --- a/src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class BrightnessProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs index 83275e42e..640a32900 100644 --- a/src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. long, float. public class ContrastProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs index 55c6908ad..0a8dea72f 100644 --- a/src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class InvertProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// protected override void OnApply(ImageBase source, Rectangle sourceRectangle) diff --git a/src/ImageSharp/Filters/Processors/Effects/OilPaintingProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/OilPaintingProcessor.cs index 6886fa5c1..b48ffa809 100644 --- a/src/ImageSharp/Filters/Processors/Effects/OilPaintingProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Effects/OilPaintingProcessor.cs @@ -17,7 +17,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class OilPaintingProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Effects/PixelateProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/PixelateProcessor.cs index 02e74146f..b97545962 100644 --- a/src/ImageSharp/Filters/Processors/Effects/PixelateProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Effects/PixelateProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class PixelateProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs b/src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs index 22707168f..73b48ef0b 100644 --- a/src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs +++ b/src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Processors { + using System; + /// /// Encapsulates methods to alter the pixels of an image. The processor operates on the original source pixels. /// @@ -12,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public interface IImageFilteringProcessor : IImageProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Applies the process to the specified portion of the specified . diff --git a/src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs b/src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs index 044b38588..724645215 100644 --- a/src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs +++ b/src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class ImageFilteringProcessor : ImageProcessor, IImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public void Apply(ImageBase source, Rectangle sourceRectangle) diff --git a/src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs b/src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs index d6ebda919..393f0549a 100644 --- a/src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class GlowProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs b/src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs index 87e7d0623..e30a45b95 100644 --- a/src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class VignetteProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Transforms/CompandingResizeProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/CompandingResizeProcessor.cs index 3c5bb5e29..ced5976ee 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/CompandingResizeProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/CompandingResizeProcessor.cs @@ -17,7 +17,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class CompandingResizeProcessor : ResamplingWeightedProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Transforms/CropProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/CropProcessor.cs index 28bdd5ff3..6a10e843d 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/CropProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/CropProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class CropProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs index c4817b925..0415f0585 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Processors { + using System; + /// /// Provides methods to allow the cropping of an image to preserve areas of highest /// entropy. @@ -13,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class EntropyCropProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Transforms/FlipProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/FlipProcessor.cs index 696ca2deb..89006275f 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/FlipProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/FlipProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class FlipProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Transforms/Matrix3x2Processor.cs b/src/ImageSharp/Filters/Processors/Transforms/Matrix3x2Processor.cs index e72e8aa61..683277499 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/Matrix3x2Processor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/Matrix3x2Processor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Numerics; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class Matrix3x2Processor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Gets the rectangle designating the target canvas. diff --git a/src/ImageSharp/Filters/Processors/Transforms/ResamplingWeightedProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/ResamplingWeightedProcessor.cs index 3effbab61..600267e5a 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/ResamplingWeightedProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/ResamplingWeightedProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class ResamplingWeightedProcessor : ImageFilteringProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Transforms/ResizeProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/ResizeProcessor.cs index 4ffe33ee1..00667214b 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/ResizeProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/ResizeProcessor.cs @@ -19,7 +19,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class ResizeProcessor : ResamplingWeightedProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Filters/Processors/Transforms/RotateProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/RotateProcessor.cs index a6f13ba35..1f28ded29 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/RotateProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/RotateProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class RotateProcessor : Matrix3x2Processor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The transform matrix to apply. diff --git a/src/ImageSharp/Filters/Processors/Transforms/SkewProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/SkewProcessor.cs index 050fbb06c..b8f8d3afd 100644 --- a/src/ImageSharp/Filters/Processors/Transforms/SkewProcessor.cs +++ b/src/ImageSharp/Filters/Processors/Transforms/SkewProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public class SkewProcessor : Matrix3x2Processor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The transform matrix to apply. diff --git a/src/ImageSharp/Filters/Transforms/AutoOrient.cs b/src/ImageSharp/Filters/Transforms/AutoOrient.cs index e7bcbf739..a30dec9b5 100644 --- a/src/ImageSharp/Filters/Transforms/AutoOrient.cs +++ b/src/ImageSharp/Filters/Transforms/AutoOrient.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + /// /// Extension methods for the type. /// @@ -19,7 +21,7 @@ namespace ImageSharp /// The public static Image AutoOrient(this Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Orientation orientation = GetExifOrientation(source); @@ -64,7 +66,7 @@ namespace ImageSharp /// The private static Orientation GetExifOrientation(Image source) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { if (source.ExifProfile == null) { diff --git a/src/ImageSharp/Filters/Transforms/Crop.cs b/src/ImageSharp/Filters/Transforms/Crop.cs index d0c8ab8d8..0ffadc94d 100644 --- a/src/ImageSharp/Filters/Transforms/Crop.cs +++ b/src/ImageSharp/Filters/Transforms/Crop.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -23,7 +25,7 @@ namespace ImageSharp /// The public static Image Crop(this Image source, int width, int height) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Crop(source, new Rectangle(0, 0, width, height)); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The public static Image Crop(this Image source, Rectangle cropRectangle) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { CropProcessor processor = new CropProcessor(cropRectangle); return source.Process(source.Bounds, processor); diff --git a/src/ImageSharp/Filters/Transforms/EntropyCrop.cs b/src/ImageSharp/Filters/Transforms/EntropyCrop.cs index 06902888d..ce4c8096d 100644 --- a/src/ImageSharp/Filters/Transforms/EntropyCrop.cs +++ b/src/ImageSharp/Filters/Transforms/EntropyCrop.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The public static Image EntropyCrop(this Image source, float threshold = .5f) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { EntropyCropProcessor processor = new EntropyCropProcessor(threshold); return source.Process(source.Bounds, processor); diff --git a/src/ImageSharp/Filters/Transforms/Flip.cs b/src/ImageSharp/Filters/Transforms/Flip.cs index 0ea0a9f67..c42aef81e 100644 --- a/src/ImageSharp/Filters/Transforms/Flip.cs +++ b/src/ImageSharp/Filters/Transforms/Flip.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The public static Image Flip(this Image source, FlipType flipType) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { FlipProcessor processor = new FlipProcessor(flipType); return source.Process(source.Bounds, processor); diff --git a/src/ImageSharp/Filters/Transforms/Options/ResizeHelper.cs b/src/ImageSharp/Filters/Transforms/Options/ResizeHelper.cs index 33aa32528..002831c58 100644 --- a/src/ImageSharp/Filters/Transforms/Options/ResizeHelper.cs +++ b/src/ImageSharp/Filters/Transforms/Options/ResizeHelper.cs @@ -26,7 +26,7 @@ namespace ImageSharp /// public static Rectangle CalculateTargetLocationAndBounds(ImageBase source, ResizeOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { switch (options.Mode) { @@ -59,7 +59,7 @@ namespace ImageSharp /// private static Rectangle CalculateCropRectangle(ImageBase source, ResizeOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int width = options.Size.Width; int height = options.Size.Height; @@ -180,7 +180,7 @@ namespace ImageSharp /// private static Rectangle CalculatePadRectangle(ImageBase source, ResizeOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int width = options.Size.Width; int height = options.Size.Height; @@ -263,7 +263,7 @@ namespace ImageSharp /// private static Rectangle CalculateBoxPadRectangle(ImageBase source, ResizeOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int width = options.Size.Width; int height = options.Size.Height; @@ -352,7 +352,7 @@ namespace ImageSharp /// private static Rectangle CalculateMaxRectangle(ImageBase source, ResizeOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int width = options.Size.Width; int height = options.Size.Height; @@ -395,7 +395,7 @@ namespace ImageSharp /// private static Rectangle CalculateMinRectangle(ImageBase source, ResizeOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int width = options.Size.Width; int height = options.Size.Height; diff --git a/src/ImageSharp/Filters/Transforms/Pad.cs b/src/ImageSharp/Filters/Transforms/Pad.cs index 3c4db20bd..731304279 100644 --- a/src/ImageSharp/Filters/Transforms/Pad.cs +++ b/src/ImageSharp/Filters/Transforms/Pad.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + /// /// Extension methods for the type. /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The . public static Image Pad(this Image source, int width, int height) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { ResizeOptions options = new ResizeOptions { diff --git a/src/ImageSharp/Filters/Transforms/Resize.cs b/src/ImageSharp/Filters/Transforms/Resize.cs index 4c3543c83..0eaf89930 100644 --- a/src/ImageSharp/Filters/Transforms/Resize.cs +++ b/src/ImageSharp/Filters/Transforms/Resize.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -23,7 +25,7 @@ namespace ImageSharp /// Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, ResizeOptions options) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // Ensure size is populated across both dimensions. if (options.Size.Width == 0 && options.Size.Height > 0) @@ -53,7 +55,7 @@ namespace ImageSharp /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Resize(source, width, height, new BicubicResampler(), false); } @@ -71,7 +73,7 @@ namespace ImageSharp /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, bool compand) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Resize(source, width, height, new BicubicResampler(), compand); } @@ -89,7 +91,7 @@ namespace ImageSharp /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, IResampler sampler) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Resize(source, width, height, sampler, false); } @@ -108,7 +110,7 @@ namespace ImageSharp /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, IResampler sampler, bool compand) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Resize(source, width, height, sampler, source.Bounds, new Rectangle(0, 0, width, height), compand); } @@ -134,7 +136,7 @@ namespace ImageSharp /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand = false) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { if (width == 0 && height > 0) { diff --git a/src/ImageSharp/Filters/Transforms/Rotate.cs b/src/ImageSharp/Filters/Transforms/Rotate.cs index 5815bc0dd..b53e79a25 100644 --- a/src/ImageSharp/Filters/Transforms/Rotate.cs +++ b/src/ImageSharp/Filters/Transforms/Rotate.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -22,7 +24,7 @@ namespace ImageSharp /// The public static Image Rotate(this Image source, float degrees) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Rotate(source, degrees, true); } @@ -37,7 +39,7 @@ namespace ImageSharp /// The public static Image Rotate(this Image source, RotateType rotateType) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Rotate(source, (float)rotateType, false); } @@ -53,7 +55,7 @@ namespace ImageSharp /// The public static Image Rotate(this Image source, float degrees, bool expand) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { RotateProcessor processor = new RotateProcessor { Angle = degrees, Expand = expand }; return source.Process(source.Bounds, processor); diff --git a/src/ImageSharp/Filters/Transforms/RotateFlip.cs b/src/ImageSharp/Filters/Transforms/RotateFlip.cs index 5adef987c..8a3097985 100644 --- a/src/ImageSharp/Filters/Transforms/RotateFlip.cs +++ b/src/ImageSharp/Filters/Transforms/RotateFlip.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + /// /// Extension methods for the type. /// @@ -21,7 +23,7 @@ namespace ImageSharp /// The public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return source.Rotate(rotateType).Flip(flipType); } diff --git a/src/ImageSharp/Filters/Transforms/Skew.cs b/src/ImageSharp/Filters/Transforms/Skew.cs index cced53c95..664c9e31f 100644 --- a/src/ImageSharp/Filters/Transforms/Skew.cs +++ b/src/ImageSharp/Filters/Transforms/Skew.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using Processors; /// @@ -23,7 +25,7 @@ namespace ImageSharp /// The public static Image Skew(this Image source, float degreesX, float degreesY) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Skew(source, degreesX, degreesY, true); } @@ -40,7 +42,7 @@ namespace ImageSharp /// The public static Image Skew(this Image source, float degreesX, float degreesY, bool expand) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { SkewProcessor processor = new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand }; return source.Process(source.Bounds, processor); diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs index b99a96462..a38564129 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs @@ -72,7 +72,7 @@ namespace ImageSharp.Formats /// public void Decode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Guard.NotNull(image, "image"); Guard.NotNull(stream, "stream"); diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index 49b88f902..918eaac4c 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -60,7 +60,7 @@ namespace ImageSharp.Formats /// public void Decode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { this.currentStream = stream; @@ -216,7 +216,7 @@ namespace ImageSharp.Formats /// Whether the bitmap is inverted. private void ReadRgbPalette(PixelAccessor pixels, byte[] colors, int width, int height, int bits, bool inverted) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // Pixels per byte (bits per pixel) int ppb = 8 / bits; @@ -273,7 +273,7 @@ namespace ImageSharp.Formats /// Whether the bitmap is inverted. private void ReadRgb16(PixelAccessor pixels, int width, int height, bool inverted) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // We divide here as we will store the colors in our floating point format. const int ScaleR = 8; // 256/32 @@ -317,7 +317,7 @@ namespace ImageSharp.Formats /// Whether the bitmap is inverted. private void ReadRgb24(PixelAccessor pixels, int width, int height, bool inverted) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int padding = CalculatePadding(width, 3); using (PixelArea row = new PixelArea(width, ComponentOrder.ZYX, padding)) @@ -343,7 +343,7 @@ namespace ImageSharp.Formats /// Whether the bitmap is inverted. private void ReadRgb32(PixelAccessor pixels, int width, int height, bool inverted) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int padding = CalculatePadding(width, 4); using (PixelArea row = new PixelArea(width, ComponentOrder.ZYXW, padding)) diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoder.cs b/src/ImageSharp/Formats/Bmp/BmpEncoder.cs index 7205840b7..c151ccb46 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoder.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoder.cs @@ -45,7 +45,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { BmpEncoderCore encoder = new BmpEncoderCore(); encoder.Encode(image, stream, this.BitsPerPixel); diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs index 42f159096..0dd5755b4 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Formats { + using System; using System.IO; using IO; @@ -34,7 +35,7 @@ namespace ImageSharp.Formats /// The public void Encode(ImageBase image, Stream stream, BmpBitsPerPixel bitsPerPixel) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -127,7 +128,7 @@ namespace ImageSharp.Formats /// private void WriteImage(EndianBinaryWriter writer, ImageBase image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { using (PixelAccessor pixels = image.Lock()) { @@ -153,7 +154,7 @@ namespace ImageSharp.Formats /// The containing pixel data. private void Write32Bit(EndianBinaryWriter writer, PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.ZYXW, this.padding)) { @@ -174,7 +175,7 @@ namespace ImageSharp.Formats /// The containing pixel data. private void Write24Bit(EndianBinaryWriter writer, PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.ZYX, this.padding)) { diff --git a/src/ImageSharp/Formats/Gif/GifDecoder.cs b/src/ImageSharp/Formats/Gif/GifDecoder.cs index 4afc1cfdb..dc2b1bb1c 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoder.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoder.cs @@ -57,7 +57,7 @@ namespace ImageSharp.Formats /// public void Decode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { new GifDecoderCore().Decode(image, stream); } diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs index 775b3be98..d5e806716 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Formats /// The packed format. uint, long, float. internal class GifDecoderCore where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The image to decode the information to. diff --git a/src/ImageSharp/Formats/Gif/GifEncoder.cs b/src/ImageSharp/Formats/Gif/GifEncoder.cs index 57db04301..ea573ca74 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoder.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoder.cs @@ -49,7 +49,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { GifEncoderCore encoder = new GifEncoderCore { diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 15f76f5be..4cbae6e77 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -53,7 +53,7 @@ namespace ImageSharp.Formats /// The to encode from. /// The to encode the image data to. public void Encode(Image image, Stream stream) - where TColor : struct, IPackedPixel where TPacked : struct + where TColor : struct, IPackedPixel where TPacked : struct, IEquatable { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -121,7 +121,7 @@ namespace ImageSharp.Formats /// The . /// private static int GetTransparentIndex(QuantizedImage quantized) - where TColor : struct, IPackedPixel where TPacked : struct + where TColor : struct, IPackedPixel where TPacked : struct, IEquatable { // Find the lowest alpha value and make it the transparent index. int index = -1; @@ -163,7 +163,7 @@ namespace ImageSharp.Formats /// The transparency index to set the default background index to. private void WriteLogicalScreenDescriptor(Image image, EndianBinaryWriter writer, int tranparencyIndex) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { GifLogicalScreenDescriptor descriptor = new GifLogicalScreenDescriptor { @@ -236,7 +236,7 @@ namespace ImageSharp.Formats private void WriteGraphicalControlExtension( ImageBase image, EndianBinaryWriter writer, - int transparencyIndex) where TColor : struct, IPackedPixel where TPacked : struct + int transparencyIndex) where TColor : struct, IPackedPixel where TPacked : struct, IEquatable { // TODO: Check transparency logic. bool hasTransparent = transparencyIndex > -1; @@ -281,7 +281,7 @@ namespace ImageSharp.Formats /// The to be encoded. /// The stream to write to. private void WriteImageDescriptor(ImageBase image, EndianBinaryWriter writer) - where TColor : struct, IPackedPixel where TPacked : struct + where TColor : struct, IPackedPixel where TPacked : struct, IEquatable { writer.Write(GifConstants.ImageDescriptorLabel); // 2c // TODO: Can we capture this? @@ -308,7 +308,7 @@ namespace ImageSharp.Formats /// The writer to write to the stream with. private void WriteColorTable(QuantizedImage image, EndianBinaryWriter writer) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // Grab the palette and write it to the stream. int pixelCount = image.Palette.Length; @@ -345,7 +345,7 @@ namespace ImageSharp.Formats /// The stream to write to. private void WriteImageData(QuantizedImage image, EndianBinaryWriter writer) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { using (LzwEncoder encoder = new LzwEncoder(image.Pixels, (byte)this.bitDepth)) { diff --git a/src/ImageSharp/Formats/IImageDecoder.cs b/src/ImageSharp/Formats/IImageDecoder.cs index 36ef23398..951bc145a 100644 --- a/src/ImageSharp/Formats/IImageDecoder.cs +++ b/src/ImageSharp/Formats/IImageDecoder.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Formats { + using System; using System.IO; /// @@ -47,6 +48,6 @@ namespace ImageSharp.Formats /// The containing image data. void Decode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct; + where TPacked : struct, IEquatable; } } diff --git a/src/ImageSharp/Formats/IImageEncoder.cs b/src/ImageSharp/Formats/IImageEncoder.cs index 6cb97420c..7b14ffe2a 100644 --- a/src/ImageSharp/Formats/IImageEncoder.cs +++ b/src/ImageSharp/Formats/IImageEncoder.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Formats { + using System; using System.IO; /// @@ -46,6 +47,6 @@ namespace ImageSharp.Formats /// The to encode the image data to. void Encode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct; + where TPacked : struct, IEquatable; } } diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoder.cs b/src/ImageSharp/Formats/Jpg/JpegDecoder.cs index d3c64a9c0..d33caa153 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoder.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoder.cs @@ -78,7 +78,7 @@ namespace ImageSharp.Formats /// public void Decode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Guard.NotNull(image, "image"); Guard.NotNull(stream, "stream"); diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs index d12217cf5..313360d1c 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs @@ -239,7 +239,7 @@ namespace ImageSharp.Formats /// Whether to decode metadata only. public void Decode(Image image, Stream stream, bool configOnly) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { this.InputStream = stream; @@ -465,7 +465,7 @@ namespace ImageSharp.Formats [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void PackYcbCr(ref TColor packed, byte y, byte cb, byte cr) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int ccb = cb - 128; int ccr = cr - 128; @@ -1118,7 +1118,7 @@ namespace ImageSharp.Formats /// The image. private void ProcessApp1Marker(int remaining, Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { if (remaining < 6) { @@ -1176,7 +1176,7 @@ namespace ImageSharp.Formats /// The image. private void ConvertFromCmyk(int width, int height, Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { if (!this.adobeTransformValid) { @@ -1233,7 +1233,7 @@ namespace ImageSharp.Formats /// The image. private void ConvertFromGrayScale(int width, int height, Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { image.InitPixels(width, height); @@ -1270,7 +1270,7 @@ namespace ImageSharp.Formats /// The image. private void ConvertFromYCbCr(int width, int height, Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int scale = this.componentArray[0].HorizontalFactor / this.componentArray[1].HorizontalFactor; image.InitPixels(width, height); @@ -1312,7 +1312,7 @@ namespace ImageSharp.Formats /// The image. private void ConvertFromRGB(int width, int height, Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int scale = this.componentArray[0].HorizontalFactor / this.componentArray[1].HorizontalFactor; image.InitPixels(width, height); @@ -1352,7 +1352,7 @@ namespace ImageSharp.Formats /// The image to assign the resolution to. private void AssignResolution(Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { if (this.isJfif && this.horizontalResolution > 0 && this.verticalResolution > 0) { @@ -2114,7 +2114,7 @@ namespace ImageSharp.Formats /// The y-position within the image. private void PackCmyk(ref TColor packed, byte y, byte cb, byte cr, int xx, int yy) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // TODO: We can speed this up further with Vector4 int ccb = cb - 128; diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoder.cs b/src/ImageSharp/Formats/Jpg/JpegEncoder.cs index 0fc1f3d35..2857915c4 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoder.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoder.cs @@ -84,7 +84,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { JpegEncoderCore encode = new JpegEncoderCore(); if (this.subsampleSet) diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs index 8247bb867..2ec65bc5b 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs @@ -286,7 +286,7 @@ namespace ImageSharp.Formats /// The subsampling mode. public void Encode(Image image, Stream stream, int quality, JpegSubsample sample) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -540,7 +540,7 @@ namespace ImageSharp.Formats /// The blue chroma block. private void ToYCbCr(PixelAccessor pixels, int x, int y, ref Block yBlock, ref Block cbBlock, ref Block crBlock) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int xmax = pixels.Width - 1; int ymax = pixels.Height - 1; @@ -639,7 +639,7 @@ namespace ImageSharp.Formats /// The packed format. uint, long, float. private void WriteProfiles(Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { this.WriteProfile(image.ExifProfile); } @@ -815,7 +815,7 @@ namespace ImageSharp.Formats /// private void WriteStartOfScan(PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // TODO: We should allow grayscale writing. this.outputStream.Write(this.sosHeaderYCbCr, 0, this.sosHeaderYCbCr.Length); @@ -842,7 +842,7 @@ namespace ImageSharp.Formats /// The pixel accessor providing access to the image pixels. private void Encode444(PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Block b = Block.Create(); Block cb = Block.Create(); @@ -876,7 +876,7 @@ namespace ImageSharp.Formats /// The pixel accessor providing access to the image pixels. private void Encode420(PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Block b = Block.Create(); Block[] cb = Block.CreateArray(4); diff --git a/src/ImageSharp/Formats/Png/PngDecoder.cs b/src/ImageSharp/Formats/Png/PngDecoder.cs index 08e086a43..ea1727ed2 100644 --- a/src/ImageSharp/Formats/Png/PngDecoder.cs +++ b/src/ImageSharp/Formats/Png/PngDecoder.cs @@ -83,7 +83,7 @@ namespace ImageSharp.Formats /// The containing image data. public void Decode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { new PngDecoderCore().Decode(image, stream); } diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index b318449a8..0a6212a07 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -140,7 +140,7 @@ namespace ImageSharp.Formats /// public void Decode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Image currentImage = image; this.currentStream = stream; @@ -266,7 +266,7 @@ namespace ImageSharp.Formats /// The data containing physical data. private void ReadPhysicalChunk(Image image, byte[] data) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { data.ReverseBytes(0, 4); data.ReverseBytes(4, 4); @@ -331,7 +331,7 @@ namespace ImageSharp.Formats /// The pixel data. private void ReadScanlines(MemoryStream dataStream, PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { this.bytesPerPixel = this.CalculateBytesPerPixel(); this.bytesPerScanline = this.CalculateScanlineLength(this.header.Width) + 1; @@ -364,7 +364,7 @@ namespace ImageSharp.Formats /// The image pixel accessor. private void DecodePixelData(Stream compressedStream, PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { byte[] previousScanline = ArrayPool.Shared.Rent(this.bytesPerScanline); byte[] scanline = ArrayPool.Shared.Rent(this.bytesPerScanline); @@ -438,7 +438,7 @@ namespace ImageSharp.Formats /// The image pixel accessor. private void DecodeInterlacedPixelData(Stream compressedStream, PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { byte[] previousScanline = ArrayPool.Shared.Rent(this.bytesPerScanline); byte[] scanline = ArrayPool.Shared.Rent(this.bytesPerScanline); @@ -528,7 +528,7 @@ namespace ImageSharp.Formats /// The image pixels private void ProcessDefilteredScanline(byte[] defilteredScanline, int row, PixelAccessor pixels) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { TColor color = default(TColor); switch (this.PngColorType) @@ -655,7 +655,7 @@ namespace ImageSharp.Formats /// The column increment. Always 1 for none interlaced images. private void ProcessInterlacedDefilteredScanline(byte[] defilteredScanline, int row, PixelAccessor pixels, int pixelOffset = 0, int increment = 1) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { TColor color = default(TColor); @@ -775,7 +775,7 @@ namespace ImageSharp.Formats /// The maximum length to read. private void ReadTextChunk(Image image, byte[] data, int length) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int zeroIndex = 0; diff --git a/src/ImageSharp/Formats/Png/PngEncoder.cs b/src/ImageSharp/Formats/Png/PngEncoder.cs index af4fe95d6..4799a56de 100644 --- a/src/ImageSharp/Formats/Png/PngEncoder.cs +++ b/src/ImageSharp/Formats/Png/PngEncoder.cs @@ -74,7 +74,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { PngEncoderCore encoder = new PngEncoderCore { diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index a23c19b51..abc6b2da7 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -134,7 +134,7 @@ namespace ImageSharp.Formats /// The to encode the image data to. public void Encode(ImageBase image, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -266,7 +266,7 @@ namespace ImageSharp.Formats /// The . private void CollectIndexedBytes(ImageBase image, Stream stream, PngHeader header) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // Quantize the image and get the pixels. QuantizedImage quantized = this.WritePaletteChunk(stream, header, image); @@ -283,7 +283,7 @@ namespace ImageSharp.Formats /// The raw scanline. private void CollectGrayscaleBytes(PixelAccessor pixels, int row, byte[] rawScanline) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // Copy the pixels across from the image. // Reuse the chunk type buffer. @@ -319,7 +319,7 @@ namespace ImageSharp.Formats /// The raw scanline. private void CollectColorBytes(PixelAccessor pixels, int row, byte[] rawScanline) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { // We can use the optimized PixelAccessor here and copy the bytes in unmanaged memory. using (PixelArea pixelRow = new PixelArea(this.width, rawScanline, this.bytesPerPixel == 4 ? ComponentOrder.XYZW : ComponentOrder.XYZ)) @@ -342,7 +342,7 @@ namespace ImageSharp.Formats /// The private byte[] EncodePixelRow(PixelAccessor pixels, int row, byte[] previousScanline, byte[] rawScanline, byte[] result) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { switch (this.PngColorType) { @@ -489,7 +489,7 @@ namespace ImageSharp.Formats /// The private QuantizedImage WritePaletteChunk(Stream stream, PngHeader header, ImageBase image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { if (this.Quality > 256) { @@ -559,7 +559,7 @@ namespace ImageSharp.Formats /// The image base. private void WritePhysicalChunk(Stream stream, ImageBase imageBase) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { Image image = imageBase as Image; if (image != null && image.HorizontalResolution > 0 && image.VerticalResolution > 0) @@ -607,7 +607,7 @@ namespace ImageSharp.Formats /// The stream. private void WriteDataChunks(PixelAccessor pixels, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { int bytesPerScanline = this.width * this.bytesPerPixel; byte[] previousScanline = new byte[bytesPerScanline]; diff --git a/src/ImageSharp/Image/IImageBase.cs b/src/ImageSharp/Image/IImageBase.cs index 3168b4bb5..59c9baf70 100644 --- a/src/ImageSharp/Image/IImageBase.cs +++ b/src/ImageSharp/Image/IImageBase.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + /// /// Encapsulates the basic properties and methods required to manipulate images in varying formats. /// @@ -12,7 +14,7 @@ namespace ImageSharp /// The packed format. uint, long, float. public interface IImageBase : IImageBase where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Gets the pixels as an array of the given packed pixel format. diff --git a/src/ImageSharp/Image/IImageFrame.cs b/src/ImageSharp/Image/IImageFrame.cs index f6f856b22..b7f7049c2 100644 --- a/src/ImageSharp/Image/IImageFrame.cs +++ b/src/ImageSharp/Image/IImageFrame.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + /// /// Represents a single frame in a animation. /// @@ -12,7 +14,7 @@ namespace ImageSharp /// The packed format. uint, long, float. public interface IImageFrame : IImageBase where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { } } diff --git a/src/ImageSharp/Image/Image.cs b/src/ImageSharp/Image/Image.cs index 2884eddbd..74bb581c7 100644 --- a/src/ImageSharp/Image/Image.cs +++ b/src/ImageSharp/Image/Image.cs @@ -24,7 +24,7 @@ namespace ImageSharp [DebuggerDisplay("Image: {Width}x{Height}")] public class Image : ImageBase where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The default horizontal resolution value (dots per inch) in x direction. @@ -268,7 +268,7 @@ namespace ImageSharp /// The public Image To(Func scaleFunc = null) where TColor2 : struct, IPackedPixel - where TPacked2 : struct + where TPacked2 : struct, IEquatable { scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); diff --git a/src/ImageSharp/Image/ImageBase.cs b/src/ImageSharp/Image/ImageBase.cs index 7e9ca2701..1cb4b2fb3 100644 --- a/src/ImageSharp/Image/ImageBase.cs +++ b/src/ImageSharp/Image/ImageBase.cs @@ -17,7 +17,7 @@ namespace ImageSharp [DebuggerDisplay("Image: {Width}x{Height}")] public abstract class ImageBase : IImageBase where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The image pixels diff --git a/src/ImageSharp/Image/ImageFrame.cs b/src/ImageSharp/Image/ImageFrame.cs index c0e5b3f16..5e9c9fb9b 100644 --- a/src/ImageSharp/Image/ImageFrame.cs +++ b/src/ImageSharp/Image/ImageFrame.cs @@ -16,7 +16,7 @@ namespace ImageSharp /// The packed format. uint, long, float. public class ImageFrame : ImageBase where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. @@ -49,7 +49,7 @@ namespace ImageSharp /// The public ImageFrame To(Func scaleFunc = null) where TColor2 : struct, IPackedPixel - where TPacked2 : struct + where TPacked2 : struct, IEquatable { scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); diff --git a/src/ImageSharp/Image/ImageIOExtensions.cs b/src/ImageSharp/Image/ImageIOExtensions.cs index bb0369d8a..959577bb8 100644 --- a/src/ImageSharp/Image/ImageIOExtensions.cs +++ b/src/ImageSharp/Image/ImageIOExtensions.cs @@ -5,6 +5,7 @@ namespace ImageSharp { + using System; using System.IO; using Formats; @@ -27,7 +28,7 @@ namespace ImageSharp /// public static Image SaveAsBmp(this Image source, Stream stream) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable => source.Save(stream, new BmpEncoder()); /// @@ -46,7 +47,7 @@ namespace ImageSharp /// public static Image SaveAsPng(this Image source, Stream stream, int quality = int.MaxValue) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable => source.Save(stream, new PngEncoder { Quality = quality }); /// @@ -63,7 +64,7 @@ namespace ImageSharp /// public static Image SaveAsJpeg(this Image source, Stream stream, int quality = 75) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable => source.Save(stream, new JpegEncoder { Quality = quality }); /// @@ -80,7 +81,7 @@ namespace ImageSharp /// public static Image SaveAsGif(this Image source, Stream stream, int quality = 256) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable => source.Save(stream, new GifEncoder { Quality = quality }); } } diff --git a/src/ImageSharp/Image/ImageProcessingExtensions.cs b/src/ImageSharp/Image/ImageProcessingExtensions.cs index 69c283f9f..81acfe863 100644 --- a/src/ImageSharp/Image/ImageProcessingExtensions.cs +++ b/src/ImageSharp/Image/ImageProcessingExtensions.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The . internal static Image Process(this Image source, IImageFilteringProcessor processor) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return Process(source, source.Bounds, processor); } @@ -43,7 +43,7 @@ namespace ImageSharp /// The . internal static Image Process(this Image source, Rectangle sourceRectangle, IImageFilteringProcessor processor) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { return PerformAction(source, (sourceImage) => processor.Apply(sourceImage, sourceRectangle)); } @@ -58,7 +58,7 @@ namespace ImageSharp /// The . private static Image PerformAction(Image source, Action> action) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { action(source); diff --git a/src/ImageSharp/Image/PixelAccessor.cs b/src/ImageSharp/Image/PixelAccessor.cs index eba054955..3baf9aeb1 100644 --- a/src/ImageSharp/Image/PixelAccessor.cs +++ b/src/ImageSharp/Image/PixelAccessor.cs @@ -17,7 +17,7 @@ namespace ImageSharp /// The packed format. uint, long, float. public unsafe class PixelAccessor : IDisposable where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The pointer to the pixel buffer. diff --git a/src/ImageSharp/Image/PixelArea.cs b/src/ImageSharp/Image/PixelArea.cs index f2b828860..9d063b753 100644 --- a/src/ImageSharp/Image/PixelArea.cs +++ b/src/ImageSharp/Image/PixelArea.cs @@ -18,7 +18,7 @@ namespace ImageSharp /// The packed format. uint, long, float. public sealed unsafe class PixelArea : IDisposable where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Provides a way to access the pixels from unmanaged memory. diff --git a/src/ImageSharp/ImageProcessor.cs b/src/ImageSharp/ImageProcessor.cs index 17395218d..3da7496fe 100644 --- a/src/ImageSharp/ImageProcessor.cs +++ b/src/ImageSharp/ImageProcessor.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Processors { + using System; using System.Threading.Tasks; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Processors /// The packed format. uint, long, float. public abstract class ImageProcessor : IImageProcessor where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// public virtual ParallelOptions ParallelOptions { get; set; } = Bootstrapper.Instance.ParallelOptions; diff --git a/src/ImageSharp/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/Profiles/Exif/ExifProfile.cs index 2b7cb55a4..a03c404fa 100644 --- a/src/ImageSharp/Profiles/Exif/ExifProfile.cs +++ b/src/ImageSharp/Profiles/Exif/ExifProfile.cs @@ -5,6 +5,7 @@ namespace ImageSharp { + using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; @@ -122,7 +123,7 @@ namespace ImageSharp /// public Image CreateThumbnail() where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { this.InitializeValues(); diff --git a/src/ImageSharp/Quantizers/IQuantizer.cs b/src/ImageSharp/Quantizers/IQuantizer.cs index 8b92af125..642c2817a 100644 --- a/src/ImageSharp/Quantizers/IQuantizer.cs +++ b/src/ImageSharp/Quantizers/IQuantizer.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Quantizers { + using System; + /// /// Provides methods for allowing quantization of images pixels. /// @@ -12,7 +14,7 @@ namespace ImageSharp.Quantizers /// The packed format. uint, long, float. public interface IQuantizer : IQuantizer where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Quantize an image and return the resulting output pixels. diff --git a/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs b/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs index 2d640298c..b65bd2278 100644 --- a/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs +++ b/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Quantizers /// The packed format. uint, long, float. public sealed class OctreeQuantizer : Quantizer where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The pixel buffer, used to reduce allocations. diff --git a/src/ImageSharp/Quantizers/Octree/Quantizer.cs b/src/ImageSharp/Quantizers/Octree/Quantizer.cs index 36d68c209..9c43d98f7 100644 --- a/src/ImageSharp/Quantizers/Octree/Quantizer.cs +++ b/src/ImageSharp/Quantizers/Octree/Quantizer.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Quantizers { + using System; using System.Threading.Tasks; /// @@ -14,7 +15,7 @@ namespace ImageSharp.Quantizers /// The packed format. uint, long, float. public abstract class Quantizer : IQuantizer where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Flag used to indicate whether a single pass or two passes are needed for quantization. diff --git a/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs b/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs index c45ad4c93..6ca5d00fb 100644 --- a/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs +++ b/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs @@ -17,7 +17,7 @@ namespace ImageSharp.Quantizers /// The packed format. uint, long, float. public class PaletteQuantizer : Quantizer where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The pixel buffer, used to reduce allocations. diff --git a/src/ImageSharp/Quantizers/Quantize.cs b/src/ImageSharp/Quantizers/Quantize.cs index 0a339a527..93293a33b 100644 --- a/src/ImageSharp/Quantizers/Quantize.cs +++ b/src/ImageSharp/Quantizers/Quantize.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using System; + using ImageSharp.Quantizers; /// @@ -23,7 +25,7 @@ namespace ImageSharp /// The . public static Image Quantize(this Image source, Quantization mode = Quantization.Octree, int maxColors = 256) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { IQuantizer quantizer; switch (mode) @@ -55,7 +57,7 @@ namespace ImageSharp /// The . public static Image Quantize(this Image source, IQuantizer quantizer, int maxColors) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { QuantizedImage quantizedImage = quantizer.Quantize(source, maxColors); source.SetPixels(source.Width, source.Height, quantizedImage.ToImage().Pixels); diff --git a/src/ImageSharp/Quantizers/QuantizedImage.cs b/src/ImageSharp/Quantizers/QuantizedImage.cs index a204f6c2d..600d8aa8f 100644 --- a/src/ImageSharp/Quantizers/QuantizedImage.cs +++ b/src/ImageSharp/Quantizers/QuantizedImage.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Quantizers /// The packed format. uint, long, float. public class QuantizedImage where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs index 2f3e89e99..2542537c7 100644 --- a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs +++ b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs @@ -33,7 +33,7 @@ namespace ImageSharp.Quantizers /// The packed format. uint, long, float. public sealed class WuQuantizer : IQuantizer where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { /// /// The epsilon for comparing floating point numbers. diff --git a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs index cab4527e7..e5c051264 100644 --- a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs +++ b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Tests { + using System; + using Xunit; /// @@ -62,7 +64,7 @@ namespace ImageSharp.Tests private static void CopyFromZYX(Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { using (PixelAccessor pixels = image.Lock()) { @@ -79,7 +81,7 @@ namespace ImageSharp.Tests pixels.CopyFrom(row, 0); - Color color = (Color) (object) pixels[0, 0]; + Color color = (Color)(object)pixels[0, 0]; Assert.Equal(red, color.R); Assert.Equal(green, color.G); Assert.Equal(blue, color.B); @@ -90,7 +92,7 @@ namespace ImageSharp.Tests private static void CopyFromZYXW(Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { using (PixelAccessor pixels = image.Lock()) { @@ -108,7 +110,7 @@ namespace ImageSharp.Tests pixels.CopyFrom(row, 0); - Color color = (Color) (object) pixels[0, 0]; + Color color = (Color)(object)pixels[0, 0]; Assert.Equal(red, color.R); Assert.Equal(green, color.G); Assert.Equal(blue, color.B); @@ -119,7 +121,7 @@ namespace ImageSharp.Tests private static void CopyToZYX(Image image) where TColor : struct, IPackedPixel - where TPacked : struct + where TPacked : struct, IEquatable { using (PixelAccessor pixels = image.Lock()) { @@ -129,7 +131,7 @@ namespace ImageSharp.Tests using (PixelArea row = new PixelArea(1, ComponentOrder.ZYX)) { - pixels[0, 0] = (TColor) (object) new Color(red, green, blue); + pixels[0, 0] = (TColor)(object)new Color(red, green, blue); pixels.CopyTo(row, 0); @@ -141,8 +143,8 @@ namespace ImageSharp.Tests } private static void CopyToZYXW(Image image) - where TColor : struct, IPackedPixel - where TPacked : struct + where TColor : struct, IPackedPixel + where TPacked : struct, IEquatable { using (PixelAccessor pixels = image.Lock()) { @@ -153,7 +155,7 @@ namespace ImageSharp.Tests using (PixelArea row = new PixelArea(1, ComponentOrder.ZYXW)) { - pixels[0, 0] = (TColor) (object) new Color(red, green, blue, alpha); + pixels[0, 0] = (TColor)(object)new Color(red, green, blue, alpha); pixels.CopyTo(row, 0);