diff --git a/src/ImageSharp.Drawing.Paths/DrawBeziers.cs b/src/ImageSharp.Drawing.Paths/DrawBeziers.cs index ef11a3bac5..936d5a9ce5 100644 --- a/src/ImageSharp.Drawing.Paths/DrawBeziers.cs +++ b/src/ImageSharp.Drawing.Paths/DrawBeziers.cs @@ -29,7 +29,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new BezierLineSegment(points)), options); } @@ -44,7 +44,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new BezierLineSegment(points))); } @@ -59,7 +59,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.DrawBeziers(new SolidBrush(color), thickness, points); } @@ -75,7 +75,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.DrawBeziers(new SolidBrush(color), thickness, points, options); } @@ -90,7 +90,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new Path(new BezierLineSegment(points)), options); } @@ -104,7 +104,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new Path(new BezierLineSegment(points))); } diff --git a/src/ImageSharp.Drawing.Paths/DrawLines.cs b/src/ImageSharp.Drawing.Paths/DrawLines.cs index fc046d6276..42f4406e83 100644 --- a/src/ImageSharp.Drawing.Paths/DrawLines.cs +++ b/src/ImageSharp.Drawing.Paths/DrawLines.cs @@ -29,7 +29,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options); } @@ -44,7 +44,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points))); } @@ -59,7 +59,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.DrawLines(new SolidBrush(color), thickness, points); } @@ -75,7 +75,7 @@ namespace ImageSharp /// The options. /// The .> public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.DrawLines(new SolidBrush(color), thickness, points, options); } @@ -90,7 +90,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawLines(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points)), options); } @@ -104,7 +104,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawLines(this Image source, IPen pen, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points))); } diff --git a/src/ImageSharp.Drawing.Paths/DrawPath.cs b/src/ImageSharp.Drawing.Paths/DrawPath.cs index 29b389fa24..e2c1442de8 100644 --- a/src/ImageSharp.Drawing.Paths/DrawPath.cs +++ b/src/ImageSharp.Drawing.Paths/DrawPath.cs @@ -28,7 +28,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, IPen pen, IPath path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new ShapePath(path), options); } @@ -42,7 +42,7 @@ namespace ImageSharp /// The path. /// The . public static Image Draw(this Image source, IPen pen, IPath path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, path, GraphicsOptions.Default); } @@ -58,7 +58,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, IBrush brush, float thickness, IPath path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), path, options); } @@ -73,7 +73,7 @@ namespace ImageSharp /// The path. /// The . public static Image Draw(this Image source, IBrush brush, float thickness, IPath path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), path); } @@ -89,7 +89,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, TColor color, float thickness, IPath path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, path, options); } @@ -104,7 +104,7 @@ namespace ImageSharp /// The path. /// The . public static Image Draw(this Image source, TColor color, float thickness, IPath path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, path); } diff --git a/src/ImageSharp.Drawing.Paths/DrawPolygon.cs b/src/ImageSharp.Drawing.Paths/DrawPolygon.cs index 6b3a6f1f36..8043d18e56 100644 --- a/src/ImageSharp.Drawing.Paths/DrawPolygon.cs +++ b/src/ImageSharp.Drawing.Paths/DrawPolygon.cs @@ -29,7 +29,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options); } @@ -44,7 +44,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points))); } @@ -59,7 +59,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.DrawPolygon(new SolidBrush(color), thickness, points); } @@ -75,7 +75,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.DrawPolygon(new SolidBrush(color), thickness, points, options); } @@ -89,7 +89,7 @@ namespace ImageSharp /// The points. /// The . public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new Polygon(new LinearLineSegment(points)), GraphicsOptions.Default); } @@ -104,7 +104,7 @@ namespace ImageSharp /// The options. /// The . public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new Polygon(new LinearLineSegment(points)), options); } diff --git a/src/ImageSharp.Drawing.Paths/DrawRectangle.cs b/src/ImageSharp.Drawing.Paths/DrawRectangle.cs index d42fee5dc1..b356652409 100644 --- a/src/ImageSharp.Drawing.Paths/DrawRectangle.cs +++ b/src/ImageSharp.Drawing.Paths/DrawRectangle.cs @@ -26,7 +26,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, IPen pen, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options); } @@ -40,7 +40,7 @@ namespace ImageSharp /// The shape. /// The . public static Image Draw(this Image source, IPen pen, Rectangle shape) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, shape, GraphicsOptions.Default); } @@ -56,7 +56,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), shape, options); } @@ -71,7 +71,7 @@ namespace ImageSharp /// The shape. /// The . public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), shape); } @@ -87,7 +87,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, TColor color, float thickness, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, shape, options); } @@ -102,7 +102,7 @@ namespace ImageSharp /// The shape. /// The . public static Image Draw(this Image source, TColor color, float thickness, Rectangle shape) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, shape); } diff --git a/src/ImageSharp.Drawing.Paths/FillPaths.cs b/src/ImageSharp.Drawing.Paths/FillPaths.cs index 1dd0b0a3a8..92e227ce1f 100644 --- a/src/ImageSharp.Drawing.Paths/FillPaths.cs +++ b/src/ImageSharp.Drawing.Paths/FillPaths.cs @@ -27,7 +27,7 @@ namespace ImageSharp /// The graphics options. /// The . public static Image Fill(this Image source, IBrush brush, IPath path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), options); } @@ -41,7 +41,7 @@ namespace ImageSharp /// The path. /// The . public static Image Fill(this Image source, IBrush brush, IPath path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default); } @@ -56,7 +56,7 @@ namespace ImageSharp /// The options. /// The . public static Image Fill(this Image source, TColor color, IPath path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), path, options); } @@ -70,7 +70,7 @@ namespace ImageSharp /// The path. /// The . public static Image Fill(this Image source, TColor color, IPath path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), path); } diff --git a/src/ImageSharp.Drawing.Paths/FillPolygon.cs b/src/ImageSharp.Drawing.Paths/FillPolygon.cs index b41267b9e2..cd3d154666 100644 --- a/src/ImageSharp.Drawing.Paths/FillPolygon.cs +++ b/src/ImageSharp.Drawing.Paths/FillPolygon.cs @@ -27,7 +27,7 @@ namespace ImageSharp /// The options. /// The . public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options); } @@ -41,7 +41,7 @@ namespace ImageSharp /// The points. /// The . public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points))); } @@ -56,7 +56,7 @@ namespace ImageSharp /// The options. /// The . public static Image FillPolygon(this Image source, TColor color, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options); } @@ -70,7 +70,7 @@ namespace ImageSharp /// The points. /// The . public static Image FillPolygon(this Image source, TColor color, Vector2[] points) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points))); } diff --git a/src/ImageSharp.Drawing.Paths/FillRectangle.cs b/src/ImageSharp.Drawing.Paths/FillRectangle.cs index 3b2cef6131..1928e54d3c 100644 --- a/src/ImageSharp.Drawing.Paths/FillRectangle.cs +++ b/src/ImageSharp.Drawing.Paths/FillRectangle.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The options. /// The . public static Image Fill(this Image source, IBrush brush, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options); } @@ -39,7 +39,7 @@ namespace ImageSharp /// The shape. /// The . public static Image Fill(this Image source, IBrush brush, Rectangle shape) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height)); } @@ -54,7 +54,7 @@ namespace ImageSharp /// The options. /// The . public static Image Fill(this Image source, TColor color, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), shape, options); } @@ -68,7 +68,7 @@ namespace ImageSharp /// The shape. /// The . public static Image Fill(this Image source, TColor color, Rectangle shape) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), shape); } diff --git a/src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs b/src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs index a5cf02b8a9..d77a6d5941 100644 --- a/src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Drawing.Brushes /// The pixel format. /// A Brush public class Brushes - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Percent10 Hatch Pattern diff --git a/src/ImageSharp.Drawing/Brushes/IBrush.cs b/src/ImageSharp.Drawing/Brushes/IBrush.cs index b281802048..df05fa23e1 100644 --- a/src/ImageSharp.Drawing/Brushes/IBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/IBrush.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Drawing /// logic for converting a pixel location to a . /// public interface IBrush - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Creates the applicator for this brush. diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs index b9bcc2f9a0..2707c00642 100644 --- a/src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The pixel format. public class ImageBrush : IBrush - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The image to paint. diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs index 3fea53052d..741ab3f005 100644 --- a/src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs @@ -42,7 +42,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The pixel format. public class PatternBrush : IBrush - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The pattern. diff --git a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs index 37af8cd046..b66827e491 100644 --- a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs +++ b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Drawing.Processors /// The pixel format. /// public abstract class BrushApplicator : IDisposable // disposable will be required if/when there is an ImageBrush - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets the color for a single pixel. diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs index 33403facb2..542c3cfed6 100644 --- a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The pixel format. public class RecolorBrush : IBrush - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs index 018c272b7f..30351dbe1b 100644 --- a/src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The pixel format. public class SolidBrush : IBrush - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The color to paint. diff --git a/src/ImageSharp.Drawing/DrawImage.cs b/src/ImageSharp.Drawing/DrawImage.cs index 2fba227ee6..16582e7ee5 100644 --- a/src/ImageSharp.Drawing/DrawImage.cs +++ b/src/ImageSharp.Drawing/DrawImage.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The opacity of the image image to blend. Must be between 0 and 100. /// The . public static Image Blend(this Image source, Image image, int percent = 50) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return DrawImage(source, image, percent, default(Size), default(Point)); } @@ -39,7 +39,7 @@ namespace ImageSharp /// The location to draw the blended image. /// The . public static Image DrawImage(this Image source, Image image, int percent, Size size, Point location) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (size == default(Size)) { diff --git a/src/ImageSharp.Drawing/DrawPath.cs b/src/ImageSharp.Drawing/DrawPath.cs index 75a0d81575..e91b972033 100644 --- a/src/ImageSharp.Drawing/DrawPath.cs +++ b/src/ImageSharp.Drawing/DrawPath.cs @@ -27,7 +27,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, IPen pen, Drawable path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Apply(new DrawPathProcessor(pen, path, options)); } @@ -41,7 +41,7 @@ namespace ImageSharp /// The path. /// The . public static Image Draw(this Image source, IPen pen, Drawable path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(pen, path, GraphicsOptions.Default); } @@ -57,7 +57,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, IBrush brush, float thickness, Drawable path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), path, options); } @@ -72,7 +72,7 @@ namespace ImageSharp /// The path. /// The . public static Image Draw(this Image source, IBrush brush, float thickness, Drawable path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), path); } @@ -88,7 +88,7 @@ namespace ImageSharp /// The options. /// The . public static Image Draw(this Image source, TColor color, float thickness, Drawable path, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, path, options); } @@ -103,7 +103,7 @@ namespace ImageSharp /// The path. /// The . public static Image Draw(this Image source, TColor color, float thickness, Drawable path) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, path); } diff --git a/src/ImageSharp.Drawing/FillRegion.cs b/src/ImageSharp.Drawing/FillRegion.cs index 6faf519af1..8aab202519 100644 --- a/src/ImageSharp.Drawing/FillRegion.cs +++ b/src/ImageSharp.Drawing/FillRegion.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The details how to fill the region of interest. /// The . public static Image Fill(this Image source, IBrush brush) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Apply(new FillProcessor(brush)); } @@ -37,7 +37,7 @@ namespace ImageSharp /// The color. /// The . public static Image Fill(this Image source, TColor color) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color)); } @@ -52,7 +52,7 @@ namespace ImageSharp /// The graphics options. /// The . public static Image Fill(this Image source, IBrush brush, Region region, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Apply(new FillRegionProcessor(brush, region, options)); } @@ -66,7 +66,7 @@ namespace ImageSharp /// The region. /// The . public static Image Fill(this Image source, IBrush brush, Region region) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(brush, region, GraphicsOptions.Default); } @@ -81,7 +81,7 @@ namespace ImageSharp /// The options. /// The . public static Image Fill(this Image source, TColor color, Region region, GraphicsOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), region, options); } @@ -95,7 +95,7 @@ namespace ImageSharp /// The region. /// The . public static Image Fill(this Image source, TColor color, Region region) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), region); } diff --git a/src/ImageSharp.Drawing/Pens/IPen.cs b/src/ImageSharp.Drawing/Pens/IPen.cs index 0cf473427f..72a5ffc367 100644 --- a/src/ImageSharp.Drawing/Pens/IPen.cs +++ b/src/ImageSharp.Drawing/Pens/IPen.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Drawing.Pens /// /// The type of the color. public interface IPen - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Creates the applicator for applying this pen to an Image diff --git a/src/ImageSharp.Drawing/Pens/Pens{TColor}.cs b/src/ImageSharp.Drawing/Pens/Pens{TColor}.cs index 94a2826595..49eed370df 100644 --- a/src/ImageSharp.Drawing/Pens/Pens{TColor}.cs +++ b/src/ImageSharp.Drawing/Pens/Pens{TColor}.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Drawing.Pens /// /// The type of the color. public class Pens - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { 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/Pen{TColor}.cs b/src/ImageSharp.Drawing/Pens/Pen{TColor}.cs index d0ea55c1e7..79a5d6b15a 100644 --- a/src/ImageSharp.Drawing/Pens/Pen{TColor}.cs +++ b/src/ImageSharp.Drawing/Pens/Pen{TColor}.cs @@ -24,7 +24,7 @@ namespace ImageSharp.Drawing.Pens /// the the pattern will imidiatly repeat without gap. /// public class Pen : IPen - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private static readonly float[] EmptyPattern = new float[0]; private readonly float[] pattern; diff --git a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs b/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs index 494f0f4e4e..d042bdccbb 100644 --- a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs +++ b/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Drawing.Processors /// /// The type of the color. public struct ColoredPointInfo - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The color diff --git a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs b/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs index 86283b5bb6..8cdb04b455 100644 --- a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs +++ b/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Drawing.Processors /// /// The type of the color. public abstract class PenApplicator : IDisposable - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets the required region. diff --git a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs index 81b40e6559..1c1de45cbc 100644 --- a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Processors /// /// The pixel format. public class DrawImageProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs index 83ae9521cb..913293ff34 100644 --- a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Drawing.Processors /// The type of the color. /// public class DrawPathProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { 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 37bdac90f9..9fa01075d4 100644 --- a/src/ImageSharp.Drawing/Processors/FillProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillProcessor.cs @@ -17,7 +17,7 @@ namespace ImageSharp.Drawing.Processors /// /// The pixel format. public class FillProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The brush. diff --git a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs index 67313d84b6..fed97275d6 100644 --- a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Drawing.Processors /// The type of the color. /// public class FillRegionProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private const float AntialiasFactor = 1f; private const int DrawPadding = 1; diff --git a/src/ImageSharp.Formats.Bmp/BmpDecoder.cs b/src/ImageSharp.Formats.Bmp/BmpDecoder.cs index b91f727c3c..4b7da38afc 100644 --- a/src/ImageSharp.Formats.Bmp/BmpDecoder.cs +++ b/src/ImageSharp.Formats.Bmp/BmpDecoder.cs @@ -27,7 +27,7 @@ namespace ImageSharp.Formats { /// public void Decode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { 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 5624176010..a75031ea19 100644 --- a/src/ImageSharp.Formats.Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp.Formats.Bmp/BmpDecoderCore.cs @@ -58,7 +58,7 @@ namespace ImageSharp.Formats /// is null. /// public void Decode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.currentStream = stream; @@ -212,7 +212,7 @@ namespace ImageSharp.Formats /// The number of bits per pixel. /// Whether the bitmap is inverted. private void ReadRgbPalette(PixelAccessor pixels, byte[] colors, int width, int height, int bits, bool inverted) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Pixels per byte (bits per pixel) int ppb = 8 / bits; @@ -267,7 +267,7 @@ namespace ImageSharp.Formats /// The height of the bitmap. /// Whether the bitmap is inverted. private void ReadRgb16(PixelAccessor pixels, int width, int height, bool inverted) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // We divide here as we will store the colors in our floating point format. const int ScaleR = 8; // 256/32 @@ -309,7 +309,7 @@ namespace ImageSharp.Formats /// The height of the bitmap. /// Whether the bitmap is inverted. private void ReadRgb24(PixelAccessor pixels, int width, int height, bool inverted) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int padding = CalculatePadding(width, 3); using (PixelArea row = new PixelArea(width, ComponentOrder.Zyx, padding)) @@ -333,7 +333,7 @@ namespace ImageSharp.Formats /// The height of the bitmap. /// Whether the bitmap is inverted. private void ReadRgb32(PixelAccessor pixels, int width, int height, bool inverted) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { 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 d43efc5139..6edaf178bc 100644 --- a/src/ImageSharp.Formats.Bmp/BmpEncoder.cs +++ b/src/ImageSharp.Formats.Bmp/BmpEncoder.cs @@ -21,7 +21,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { 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 8abe7cbfce..02d270a0ad 100644 --- a/src/ImageSharp.Formats.Bmp/BmpEncoderCore.cs +++ b/src/ImageSharp.Formats.Bmp/BmpEncoderCore.cs @@ -33,7 +33,7 @@ namespace ImageSharp.Formats /// The to encode the image data to. /// The public void Encode(ImageBase image, Stream stream, BmpBitsPerPixel bitsPerPixel) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -124,7 +124,7 @@ namespace ImageSharp.Formats /// The containing pixel data. /// private void WriteImage(EndianBinaryWriter writer, ImageBase image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelAccessor pixels = image.Lock()) { @@ -148,7 +148,7 @@ namespace ImageSharp.Formats /// The containing the stream to write to. /// The containing pixel data. private void Write32Bit(EndianBinaryWriter writer, PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.Zyxw, this.padding)) { @@ -167,7 +167,7 @@ namespace ImageSharp.Formats /// The containing the stream to write to. /// The containing pixel data. private void Write24Bit(EndianBinaryWriter writer, PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.Zyx, this.padding)) { diff --git a/src/ImageSharp.Formats.Bmp/ImageExtensions.cs b/src/ImageSharp.Formats.Bmp/ImageExtensions.cs index 8bbae8487b..5b92b90d63 100644 --- a/src/ImageSharp.Formats.Bmp/ImageExtensions.cs +++ b/src/ImageSharp.Formats.Bmp/ImageExtensions.cs @@ -26,7 +26,7 @@ namespace ImageSharp /// The . /// public static Image SaveAsBmp(this Image source, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel => source.Save(stream, new BmpEncoder()); } } diff --git a/src/ImageSharp.Formats.Gif/GifDecoder.cs b/src/ImageSharp.Formats.Gif/GifDecoder.cs index f329744abf..76530dc504 100644 --- a/src/ImageSharp.Formats.Gif/GifDecoder.cs +++ b/src/ImageSharp.Formats.Gif/GifDecoder.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Formats { /// public void Decode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { new GifDecoderCore().Decode(image, stream); } diff --git a/src/ImageSharp.Formats.Gif/GifDecoderCore.cs b/src/ImageSharp.Formats.Gif/GifDecoderCore.cs index e6f7b6136f..5812b9f297 100644 --- a/src/ImageSharp.Formats.Gif/GifDecoderCore.cs +++ b/src/ImageSharp.Formats.Gif/GifDecoderCore.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Formats /// /// The pixel format. internal class GifDecoderCore - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The temp buffer used to reduce allocations. diff --git a/src/ImageSharp.Formats.Gif/GifEncoder.cs b/src/ImageSharp.Formats.Gif/GifEncoder.cs index 45c2164e14..de7e03322d 100644 --- a/src/ImageSharp.Formats.Gif/GifEncoder.cs +++ b/src/ImageSharp.Formats.Gif/GifEncoder.cs @@ -33,7 +33,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { GifEncoderCore encoder = new GifEncoderCore { diff --git a/src/ImageSharp.Formats.Gif/GifEncoderCore.cs b/src/ImageSharp.Formats.Gif/GifEncoderCore.cs index 80c9ee36bc..36cf614d94 100644 --- a/src/ImageSharp.Formats.Gif/GifEncoderCore.cs +++ b/src/ImageSharp.Formats.Gif/GifEncoderCore.cs @@ -51,7 +51,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, IEquatable + where TColor : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -121,7 +121,7 @@ namespace ImageSharp.Formats /// The . /// private int GetTransparentIndex(QuantizedImage quantized) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Find the lowest alpha value and make it the transparent index. int index = 255; @@ -171,7 +171,7 @@ namespace ImageSharp.Formats /// The writer to write to the stream with. /// The transparency index to set the default background index to. private void WriteLogicalScreenDescriptor(Image image, EndianBinaryWriter writer, int tranparencyIndex) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { GifLogicalScreenDescriptor descriptor = new GifLogicalScreenDescriptor { @@ -237,7 +237,7 @@ namespace ImageSharp.Formats /// The stream to write to. /// The index of the color in the color palette to make transparent. private void WriteGraphicalControlExtension(Image image, EndianBinaryWriter writer, int transparencyIndex) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.WriteGraphicalControlExtension(image, image.MetaData, writer, transparencyIndex); } @@ -250,7 +250,7 @@ namespace ImageSharp.Formats /// The stream to write to. /// The index of the color in the color palette to make transparent. private void WriteGraphicalControlExtension(ImageFrame imageFrame, EndianBinaryWriter writer, int transparencyIndex) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.WriteGraphicalControlExtension(imageFrame, imageFrame.MetaData, writer, transparencyIndex); } @@ -264,7 +264,7 @@ namespace ImageSharp.Formats /// The stream to write to. /// The index of the color in the color palette to make transparent. private void WriteGraphicalControlExtension(ImageBase image, IMetaData metaData, EndianBinaryWriter writer, int transparencyIndex) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // TODO: Check transparency logic. bool hasTransparent = transparencyIndex < 255; @@ -306,7 +306,7 @@ namespace ImageSharp.Formats /// The to be encoded. /// The stream to write to. private void WriteImageDescriptor(ImageBase image, EndianBinaryWriter writer) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { writer.Write(GifConstants.ImageDescriptorLabel); // 2c @@ -332,7 +332,7 @@ namespace ImageSharp.Formats /// The to encode. /// The writer to write to the stream with. private void WriteColorTable(QuantizedImage image, EndianBinaryWriter writer) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Grab the palette and write it to the stream. int pixelCount = image.Palette.Length; @@ -367,7 +367,7 @@ namespace ImageSharp.Formats /// The containing indexed pixels. /// The stream to write to. private void WriteImageData(QuantizedImage image, EndianBinaryWriter writer) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (LzwEncoder encoder = new LzwEncoder(image.Pixels, (byte)this.bitDepth)) { diff --git a/src/ImageSharp.Formats.Gif/ImageExtensions.cs b/src/ImageSharp.Formats.Gif/ImageExtensions.cs index 09c836a680..e0ec2e8c84 100644 --- a/src/ImageSharp.Formats.Gif/ImageExtensions.cs +++ b/src/ImageSharp.Formats.Gif/ImageExtensions.cs @@ -27,7 +27,7 @@ namespace ImageSharp /// The . /// public static Image SaveAsGif(this Image source, Stream stream, int quality = 256) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel => source.Save(stream, new GifEncoder { Quality = quality }); } } diff --git a/src/ImageSharp.Formats.Jpeg/ImageExtensions.cs b/src/ImageSharp.Formats.Jpeg/ImageExtensions.cs index c0cda4d46a..2cbba02a90 100644 --- a/src/ImageSharp.Formats.Jpeg/ImageExtensions.cs +++ b/src/ImageSharp.Formats.Jpeg/ImageExtensions.cs @@ -27,7 +27,7 @@ namespace ImageSharp /// The . /// public static Image SaveAsJpeg(this Image source, Stream stream, int quality = 75) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel => source.Save(stream, new JpegEncoder { Quality = quality }); } } diff --git a/src/ImageSharp.Formats.Jpeg/JpegDecoder.cs b/src/ImageSharp.Formats.Jpeg/JpegDecoder.cs index 41d2a2ad42..435ae51cfd 100644 --- a/src/ImageSharp.Formats.Jpeg/JpegDecoder.cs +++ b/src/ImageSharp.Formats.Jpeg/JpegDecoder.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Formats { /// public void Decode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Guard.NotNull(image, "image"); Guard.NotNull(stream, "stream"); diff --git a/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs b/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs index eb70c4f8c4..6577876828 100644 --- a/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs @@ -177,7 +177,7 @@ namespace ImageSharp.Formats /// The stream, where the image should be. /// Whether to decode metadata only. public void Decode(Image image, Stream stream, bool metadataOnly) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.ProcessStream(image, stream, metadataOnly); if (!metadataOnly) @@ -248,7 +248,7 @@ namespace ImageSharp.Formats /// The cr chroma component. [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void PackYcbCr(ref TColor packed, byte y, byte cb, byte cr) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int ccb = cb - 128; int ccr = cr - 128; @@ -274,7 +274,7 @@ namespace ImageSharp.Formats /// The stream /// Whether to decode metadata only. private void ProcessStream(Image image, Stream stream, bool metadataOnly) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.InputStream = stream; this.InputProcessor = new InputProcessor(stream, this.Temp); @@ -472,7 +472,7 @@ namespace ImageSharp.Formats /// /// The pixel type private void ProcessBlocksIntoJpegImageChannels() - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Parallel.For( 0, @@ -491,7 +491,7 @@ namespace ImageSharp.Formats /// The pixel type /// The destination image private void ConvertJpegPixelsToImagePixels(Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (this.grayImage.IsInitialized) { @@ -549,7 +549,7 @@ namespace ImageSharp.Formats /// The pixel format. /// The image to assign the resolution to. private void AssignResolution(Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (this.isJfif && this.horizontalResolution > 0 && this.verticalResolution > 0) { @@ -579,7 +579,7 @@ namespace ImageSharp.Formats /// The image height. /// The image. private void ConvertFromCmyk(int width, int height, Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; @@ -620,7 +620,7 @@ namespace ImageSharp.Formats /// The image height. /// The image. private void ConvertFromGrayScale(int width, int height, Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { image.InitPixels(width, height); @@ -655,7 +655,7 @@ namespace ImageSharp.Formats /// The height. /// The image. private void ConvertFromRGB(int width, int height, Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; image.InitPixels(width, height); @@ -696,7 +696,7 @@ namespace ImageSharp.Formats /// The image height. /// The image. private void ConvertFromYCbCr(int width, int height, Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; image.InitPixels(width, height); @@ -737,7 +737,7 @@ namespace ImageSharp.Formats /// The image height. /// The image. private void ConvertFromYcck(int width, int height, Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; @@ -862,7 +862,7 @@ namespace ImageSharp.Formats /// The x-position within the image. /// The y-position within the image. private void PackCmyk(ref TColor packed, byte c, byte m, byte y, int xx, int yy) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Get keyline float keyline = (255 - this.blackImage[xx, yy]) / 255F; @@ -887,7 +887,7 @@ namespace ImageSharp.Formats /// The x-position within the image. /// The y-position within the image. private void PackYcck(ref TColor packed, byte y, byte cb, byte cr, int xx, int yy) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Convert the YCbCr part of the YCbCrK to RGB, invert the RGB to get // CMY, and patch in the original K. The RGB to CMY inversion cancels @@ -956,7 +956,7 @@ namespace ImageSharp.Formats /// The remaining bytes in the segment block. /// The image. private void ProcessApp1Marker(int remaining, Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (remaining < 6) { diff --git a/src/ImageSharp.Formats.Jpeg/JpegEncoder.cs b/src/ImageSharp.Formats.Jpeg/JpegEncoder.cs index e56a9f2e81..07d9b24cd9 100644 --- a/src/ImageSharp.Formats.Jpeg/JpegEncoder.cs +++ b/src/ImageSharp.Formats.Jpeg/JpegEncoder.cs @@ -62,7 +62,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Ensure that quality can be set but has a fallback. if (image.MetaData.Quality > 0) diff --git a/src/ImageSharp.Formats.Jpeg/JpegEncoderCore.cs b/src/ImageSharp.Formats.Jpeg/JpegEncoderCore.cs index 657470f5cf..0309af1299 100644 --- a/src/ImageSharp.Formats.Jpeg/JpegEncoderCore.cs +++ b/src/ImageSharp.Formats.Jpeg/JpegEncoderCore.cs @@ -157,7 +157,7 @@ namespace ImageSharp.Formats /// The quality. /// The subsampling mode. public void Encode(Image image, Stream stream, int quality, JpegSubsample sample) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -287,7 +287,7 @@ namespace ImageSharp.Formats Block8x8F* cbBlock, Block8x8F* crBlock, PixelArea rgbBytes) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { float* yBlockRaw = (float*)yBlock; float* cbBlockRaw = (float*)cbBlock; @@ -433,7 +433,7 @@ namespace ImageSharp.Formats /// The pixel format. /// The pixel accessor providing access to the image pixels. private void Encode444(PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) Block8x8F b = default(Block8x8F); @@ -704,7 +704,7 @@ namespace ImageSharp.Formats /// The image. /// The pixel format. private void WriteProfiles(Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { image.MetaData.SyncProfiles(); this.WriteProfile(image.MetaData.ExifProfile); @@ -772,7 +772,7 @@ namespace ImageSharp.Formats /// The pixel format. /// The pixel accessor providing access to the image pixels. private void WriteStartOfScan(PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) // TODO: We should allow grayscale writing. @@ -799,7 +799,7 @@ namespace ImageSharp.Formats /// The pixel format. /// The pixel accessor providing access to the image pixels. private void Encode420(PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) Block8x8F b = default(Block8x8F); diff --git a/src/ImageSharp.Formats.Jpeg/Utils/JpegUtils.cs b/src/ImageSharp.Formats.Jpeg/Utils/JpegUtils.cs index 7f62058b7e..dd96985d9a 100644 --- a/src/ImageSharp.Formats.Jpeg/Utils/JpegUtils.cs +++ b/src/ImageSharp.Formats.Jpeg/Utils/JpegUtils.cs @@ -25,7 +25,7 @@ namespace ImageSharp.Formats.Jpg PixelArea dest, int sourceY, int sourceX) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { pixels.SafeCopyTo(dest, sourceY, sourceX); int stretchFromX = pixels.Width - sourceX; @@ -49,13 +49,13 @@ namespace ImageSharp.Formats.Jpg // Nothing to stretch if (fromX, fromY) is outside the area, or is at (0,0) [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool IsInvalidStretchStartingPosition(PixelArea area, int fromX, int fromY) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return fromX <= 0 || fromY <= 0 || fromX >= area.Width || fromY >= area.Height; } private static void StretchPixels(PixelArea area, int fromX, int fromY) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (IsInvalidStretchStartingPosition(area, fromX, fromY)) { diff --git a/src/ImageSharp.Formats.Png/ImageExtensions.cs b/src/ImageSharp.Formats.Png/ImageExtensions.cs index d46c46217e..dcb1c988b7 100644 --- a/src/ImageSharp.Formats.Png/ImageExtensions.cs +++ b/src/ImageSharp.Formats.Png/ImageExtensions.cs @@ -29,7 +29,7 @@ namespace ImageSharp /// The . /// public static Image SaveAsPng(this Image source, Stream stream, int quality = int.MaxValue) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel => source.Save(stream, new PngEncoder { Quality = quality }); } } diff --git a/src/ImageSharp.Formats.Png/PngDecoder.cs b/src/ImageSharp.Formats.Png/PngDecoder.cs index 845f0f2229..088bea5919 100644 --- a/src/ImageSharp.Formats.Png/PngDecoder.cs +++ b/src/ImageSharp.Formats.Png/PngDecoder.cs @@ -37,7 +37,7 @@ namespace ImageSharp.Formats /// The to decode to. /// The containing image data. public void Decode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { new PngDecoderCore().Decode(image, stream); } diff --git a/src/ImageSharp.Formats.Png/PngDecoderCore.cs b/src/ImageSharp.Formats.Png/PngDecoderCore.cs index 9e871e987b..47b09d5ffb 100644 --- a/src/ImageSharp.Formats.Png/PngDecoderCore.cs +++ b/src/ImageSharp.Formats.Png/PngDecoderCore.cs @@ -138,7 +138,7 @@ namespace ImageSharp.Formats /// Thrown if the image is larger than the maximum allowable size. /// public void Decode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Image currentImage = image; this.currentStream = stream; @@ -262,7 +262,7 @@ namespace ImageSharp.Formats /// The image to read to. /// The data containing physical data. private void ReadPhysicalChunk(Image image, byte[] data) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { data.ReverseBytes(0, 4); data.ReverseBytes(4, 4); @@ -325,7 +325,7 @@ namespace ImageSharp.Formats /// The containing data. /// The pixel data. private void ReadScanlines(MemoryStream dataStream, PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.bytesPerPixel = this.CalculateBytesPerPixel(); this.bytesPerScanline = this.CalculateScanlineLength(this.header.Width) + 1; @@ -356,7 +356,7 @@ namespace ImageSharp.Formats /// The compressed pixel data stream. /// The image pixel accessor. private void DecodePixelData(Stream compressedStream, PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { byte[] previousScanline = ArrayPool.Shared.Rent(this.bytesPerScanline); byte[] scanline = ArrayPool.Shared.Rent(this.bytesPerScanline); @@ -429,7 +429,7 @@ namespace ImageSharp.Formats /// The compressed pixel data stream. /// The image pixel accessor. private void DecodeInterlacedPixelData(Stream compressedStream, PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { byte[] previousScanline = ArrayPool.Shared.Rent(this.bytesPerScanline); byte[] scanline = ArrayPool.Shared.Rent(this.bytesPerScanline); @@ -518,7 +518,7 @@ namespace ImageSharp.Formats /// The current image row. /// The image pixels private void ProcessDefilteredScanline(byte[] defilteredScanline, int row, PixelAccessor pixels) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { TColor color = default(TColor); switch (this.PngColorType) @@ -643,7 +643,7 @@ namespace ImageSharp.Formats /// The column start index. Always 0 for none interlaced images. /// 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, IEquatable + where TColor : struct, IPixel { TColor color = default(TColor); @@ -761,7 +761,7 @@ namespace ImageSharp.Formats /// The containing data. /// The maximum length to read. private void ReadTextChunk(Image image, byte[] data, int length) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int zeroIndex = 0; diff --git a/src/ImageSharp.Formats.Png/PngEncoder.cs b/src/ImageSharp.Formats.Png/PngEncoder.cs index 7f71d1f393..ba790f4ae9 100644 --- a/src/ImageSharp.Formats.Png/PngEncoder.cs +++ b/src/ImageSharp.Formats.Png/PngEncoder.cs @@ -57,7 +57,7 @@ namespace ImageSharp.Formats /// public void Encode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { PngEncoderCore encoder = new PngEncoderCore { diff --git a/src/ImageSharp.Formats.Png/PngEncoderCore.cs b/src/ImageSharp.Formats.Png/PngEncoderCore.cs index 9acaf5b9fa..2324853cba 100644 --- a/src/ImageSharp.Formats.Png/PngEncoderCore.cs +++ b/src/ImageSharp.Formats.Png/PngEncoderCore.cs @@ -132,7 +132,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, IEquatable + where TColor : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -262,7 +262,7 @@ namespace ImageSharp.Formats /// The containing image data. /// The . private void CollectIndexedBytes(ImageBase image, Stream stream, PngHeader header) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Quantize the image and get the pixels. QuantizedImage quantized = this.WritePaletteChunk(stream, header, image); @@ -277,7 +277,7 @@ namespace ImageSharp.Formats /// The row index. /// The raw scanline. private void CollectGrayscaleBytes(PixelAccessor pixels, int row, byte[] rawScanline) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Copy the pixels across from the image. // Reuse the chunk type buffer. @@ -311,7 +311,7 @@ namespace ImageSharp.Formats /// The row index. /// The raw scanline. private void CollectColorBytes(PixelAccessor pixels, int row, byte[] rawScanline) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // 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)) @@ -332,7 +332,7 @@ namespace ImageSharp.Formats /// The filtered scanline result. /// The private byte[] EncodePixelRow(PixelAccessor pixels, int row, byte[] previousScanline, byte[] rawScanline, byte[] result) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { switch (this.PngColorType) { @@ -486,7 +486,7 @@ namespace ImageSharp.Formats /// The image to encode. /// The private QuantizedImage WritePaletteChunk(Stream stream, PngHeader header, ImageBase image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (this.Quality > 256) { @@ -554,7 +554,7 @@ namespace ImageSharp.Formats /// The containing image data. /// The image base. private void WritePhysicalChunk(Stream stream, ImageBase imageBase) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Image image = imageBase as Image; if (image != null && image.MetaData.HorizontalResolution > 0 && image.MetaData.VerticalResolution > 0) @@ -600,7 +600,7 @@ namespace ImageSharp.Formats /// The pixel accessor. /// The stream. private void WriteDataChunks(PixelAccessor pixels, Stream stream) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int bytesPerScanline = this.width * this.bytesPerPixel; byte[] previousScanline = new byte[bytesPerScanline]; diff --git a/src/ImageSharp.Processing/Binarization/BinaryThreshold.cs b/src/ImageSharp.Processing/Binarization/BinaryThreshold.cs index e59369349f..672726d929 100644 --- a/src/ImageSharp.Processing/Binarization/BinaryThreshold.cs +++ b/src/ImageSharp.Processing/Binarization/BinaryThreshold.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The . public static Image BinaryThreshold(this Image source, float threshold) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return BinaryThreshold(source, threshold, source.Bounds); } @@ -38,7 +38,7 @@ namespace ImageSharp /// /// The . public static Image BinaryThreshold(this Image source, float threshold, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new BinaryThresholdProcessor(threshold), rectangle); return source; diff --git a/src/ImageSharp.Processing/Binarization/Dither.cs b/src/ImageSharp.Processing/Binarization/Dither.cs index 6a4f7f0057..dd6dfe8a14 100644 --- a/src/ImageSharp.Processing/Binarization/Dither.cs +++ b/src/ImageSharp.Processing/Binarization/Dither.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The component index to test the threshold against. Must range from 0 to 3. /// The . public static Image Dither(this Image source, IOrderedDither dither, int index = 0) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Dither(source, dither, source.Bounds, index); } @@ -41,7 +41,7 @@ namespace ImageSharp /// The component index to test the threshold against. Must range from 0 to 3. /// The . public static Image Dither(this Image source, IOrderedDither dither, Rectangle rectangle, int index = 0) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new OrderedDitherProcessor(dither, index), rectangle); return source; @@ -56,7 +56,7 @@ namespace ImageSharp /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The . public static Image Dither(this Image source, IErrorDiffuser diffuser, float threshold) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Dither(source, diffuser, threshold, source.Bounds); } @@ -73,7 +73,7 @@ namespace ImageSharp /// /// The . public static Image Dither(this Image source, IErrorDiffuser diffuser, float threshold, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new ErrorDiffusionDitherProcessor(diffuser, threshold), rectangle); return source; diff --git a/src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs b/src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs index 05fb8f19c8..63d6dd33c5 100644 --- a/src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs +++ b/src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image BlackWhite(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return BlackWhite(source, source.Bounds); } @@ -37,7 +37,7 @@ namespace ImageSharp /// /// The . public static Image BlackWhite(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new BlackWhiteProcessor(), rectangle); return source; diff --git a/src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs b/src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs index 30b28861d0..36a139d0ea 100644 --- a/src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs +++ b/src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The type of color blindness simulator to apply. /// The . public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return ColorBlindness(source, colorBlindness, source.Bounds); } @@ -39,7 +39,7 @@ namespace ImageSharp /// /// The . public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { IImageProcessor processor; diff --git a/src/ImageSharp.Processing/ColorMatrix/Grayscale.cs b/src/ImageSharp.Processing/ColorMatrix/Grayscale.cs index b2aadc46db..613b999d44 100644 --- a/src/ImageSharp.Processing/ColorMatrix/Grayscale.cs +++ b/src/ImageSharp.Processing/ColorMatrix/Grayscale.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The formula to apply to perform the operation. /// The . public static Image Grayscale(this Image source, GrayscaleMode mode = GrayscaleMode.Bt709) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Grayscale(source, source.Bounds, mode); } @@ -39,7 +39,7 @@ namespace ImageSharp /// The formula to apply to perform the operation. /// The . public static Image Grayscale(this Image source, Rectangle rectangle, GrayscaleMode mode = GrayscaleMode.Bt709) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { IImageProcessor processor = mode == GrayscaleMode.Bt709 ? (IImageProcessor)new GrayscaleBt709Processor() diff --git a/src/ImageSharp.Processing/ColorMatrix/Hue.cs b/src/ImageSharp.Processing/ColorMatrix/Hue.cs index 25fcc6c559..8edeb2ff31 100644 --- a/src/ImageSharp.Processing/ColorMatrix/Hue.cs +++ b/src/ImageSharp.Processing/ColorMatrix/Hue.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The angle in degrees to adjust the image. /// The . public static Image Hue(this Image source, float degrees) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Hue(source, degrees, source.Bounds); } @@ -39,7 +39,7 @@ namespace ImageSharp /// /// The . public static Image Hue(this Image source, float degrees, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new HueProcessor(degrees), rectangle); return source; diff --git a/src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs b/src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs index dab0224c3a..5084c96b25 100644 --- a/src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs +++ b/src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image Kodachrome(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Kodachrome(source, source.Bounds); } @@ -37,7 +37,7 @@ namespace ImageSharp /// /// The . public static Image Kodachrome(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new KodachromeProcessor(), rectangle); return source; diff --git a/src/ImageSharp.Processing/ColorMatrix/Lomograph.cs b/src/ImageSharp.Processing/ColorMatrix/Lomograph.cs index df34dc52e9..ef6b23d5da 100644 --- a/src/ImageSharp.Processing/ColorMatrix/Lomograph.cs +++ b/src/ImageSharp.Processing/ColorMatrix/Lomograph.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image Lomograph(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Lomograph(source, source.Bounds); } @@ -37,7 +37,7 @@ namespace ImageSharp /// /// The . public static Image Lomograph(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new LomographProcessor(), rectangle); return source; diff --git a/src/ImageSharp.Processing/ColorMatrix/Polaroid.cs b/src/ImageSharp.Processing/ColorMatrix/Polaroid.cs index 4bb8f82a31..68b10173cc 100644 --- a/src/ImageSharp.Processing/ColorMatrix/Polaroid.cs +++ b/src/ImageSharp.Processing/ColorMatrix/Polaroid.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image Polaroid(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Polaroid(source, source.Bounds); } @@ -37,7 +37,7 @@ namespace ImageSharp /// /// The . public static Image Polaroid(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new PolaroidProcessor(), rectangle); return source; diff --git a/src/ImageSharp.Processing/ColorMatrix/Saturation.cs b/src/ImageSharp.Processing/ColorMatrix/Saturation.cs index a92483c9c3..7a6359744b 100644 --- a/src/ImageSharp.Processing/ColorMatrix/Saturation.cs +++ b/src/ImageSharp.Processing/ColorMatrix/Saturation.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The new saturation of the image. Must be between -100 and 100. /// The . public static Image Saturation(this Image source, int amount) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Saturation(source, amount, source.Bounds); } @@ -39,7 +39,7 @@ namespace ImageSharp /// /// The . public static Image Saturation(this Image source, int amount, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new SaturationProcessor(amount), rectangle); return source; diff --git a/src/ImageSharp.Processing/ColorMatrix/Sepia.cs b/src/ImageSharp.Processing/ColorMatrix/Sepia.cs index 1a8ec4b95e..4943635e06 100644 --- a/src/ImageSharp.Processing/ColorMatrix/Sepia.cs +++ b/src/ImageSharp.Processing/ColorMatrix/Sepia.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image Sepia(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Sepia(source, source.Bounds); } @@ -37,7 +37,7 @@ namespace ImageSharp /// /// The . public static Image Sepia(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new SepiaProcessor(), rectangle); return source; diff --git a/src/ImageSharp.Processing/Convolution/BoxBlur.cs b/src/ImageSharp.Processing/Convolution/BoxBlur.cs index 6bdd68b9b6..428142ffa8 100644 --- a/src/ImageSharp.Processing/Convolution/BoxBlur.cs +++ b/src/ImageSharp.Processing/Convolution/BoxBlur.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The 'radius' value representing the size of the area to sample. /// The . public static Image BoxBlur(this Image source, int radius = 7) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return BoxBlur(source, radius, source.Bounds); } @@ -38,7 +38,7 @@ namespace ImageSharp /// /// The . public static Image BoxBlur(this Image source, int radius, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new BoxBlurProcessor(radius), rectangle); return source; diff --git a/src/ImageSharp.Processing/Convolution/DetectEdges.cs b/src/ImageSharp.Processing/Convolution/DetectEdges.cs index a61726e74e..dba062b563 100644 --- a/src/ImageSharp.Processing/Convolution/DetectEdges.cs +++ b/src/ImageSharp.Processing/Convolution/DetectEdges.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image DetectEdges(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return DetectEdges(source, source.Bounds, new SobelProcessor { Grayscale = true }); } @@ -39,7 +39,7 @@ namespace ImageSharp /// /// The . public static Image DetectEdges(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return DetectEdges(source, rectangle, new SobelProcessor { Grayscale = true }); } @@ -53,7 +53,7 @@ namespace ImageSharp /// Whether to convert the image to Grayscale first. Defaults to true. /// The . public static Image DetectEdges(this Image source, EdgeDetection filter, bool grayscale = true) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return DetectEdges(source, filter, source.Bounds, grayscale); } @@ -70,7 +70,7 @@ namespace ImageSharp /// Whether to convert the image to Grayscale first. Defaults to true. /// The . public static Image DetectEdges(this Image source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { IEdgeDetectorProcessor processor; @@ -128,7 +128,7 @@ namespace ImageSharp /// The filter for detecting edges. /// The . public static Image DetectEdges(this Image source, IEdgeDetectorProcessor filter) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return DetectEdges(source, source.Bounds, filter); } @@ -144,7 +144,7 @@ namespace ImageSharp /// The filter for detecting edges. /// The . public static Image DetectEdges(this Image source, Rectangle rectangle, IEdgeDetectorProcessor filter) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(filter, rectangle); return source; diff --git a/src/ImageSharp.Processing/Convolution/GaussianBlur.cs b/src/ImageSharp.Processing/Convolution/GaussianBlur.cs index 893ebb2646..81f8546380 100644 --- a/src/ImageSharp.Processing/Convolution/GaussianBlur.cs +++ b/src/ImageSharp.Processing/Convolution/GaussianBlur.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The 'sigma' value representing the weight of the blur. /// The . public static Image GaussianBlur(this Image source, float sigma = 3f) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return GaussianBlur(source, sigma, source.Bounds); } @@ -39,7 +39,7 @@ namespace ImageSharp /// /// The . public static Image GaussianBlur(this Image source, float sigma, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle); return source; diff --git a/src/ImageSharp.Processing/Convolution/GaussianSharpen.cs b/src/ImageSharp.Processing/Convolution/GaussianSharpen.cs index e3f8e995bc..61816198a5 100644 --- a/src/ImageSharp.Processing/Convolution/GaussianSharpen.cs +++ b/src/ImageSharp.Processing/Convolution/GaussianSharpen.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The 'sigma' value representing the weight of the blur. /// The . public static Image GaussianSharpen(this Image source, float sigma = 3f) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return GaussianSharpen(source, sigma, source.Bounds); } @@ -39,7 +39,7 @@ namespace ImageSharp /// /// The . public static Image GaussianSharpen(this Image source, float sigma, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new GaussianSharpenProcessor(sigma), rectangle); return source; diff --git a/src/ImageSharp.Processing/Effects/Alpha.cs b/src/ImageSharp.Processing/Effects/Alpha.cs index 21b6dfbcbc..39849d4d4b 100644 --- a/src/ImageSharp.Processing/Effects/Alpha.cs +++ b/src/ImageSharp.Processing/Effects/Alpha.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The new opacity of the image. Must be between 0 and 100. /// The . public static Image Alpha(this Image source, int percent) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Alpha(source, percent, source.Bounds); } @@ -38,7 +38,7 @@ namespace ImageSharp /// /// The . public static Image Alpha(this Image source, int percent, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new AlphaProcessor(percent), rectangle); return source; diff --git a/src/ImageSharp.Processing/Effects/BackgroundColor.cs b/src/ImageSharp.Processing/Effects/BackgroundColor.cs index 0f724c08c0..2e621172e1 100644 --- a/src/ImageSharp.Processing/Effects/BackgroundColor.cs +++ b/src/ImageSharp.Processing/Effects/BackgroundColor.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The color to set as the background. /// The . public static Image BackgroundColor(this Image source, TColor color) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new BackgroundColorProcessor(color), source.Bounds); return source; diff --git a/src/ImageSharp.Processing/Effects/Brightness.cs b/src/ImageSharp.Processing/Effects/Brightness.cs index bf5500faf5..8ba702c4f5 100644 --- a/src/ImageSharp.Processing/Effects/Brightness.cs +++ b/src/ImageSharp.Processing/Effects/Brightness.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The new brightness of the image. Must be between -100 and 100. /// The . public static Image Brightness(this Image source, int amount) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Brightness(source, amount, source.Bounds); } @@ -38,7 +38,7 @@ namespace ImageSharp /// /// The . public static Image Brightness(this Image source, int amount, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new BrightnessProcessor(amount), rectangle); return source; diff --git a/src/ImageSharp.Processing/Effects/Contrast.cs b/src/ImageSharp.Processing/Effects/Contrast.cs index f05eea6399..0228f4fe37 100644 --- a/src/ImageSharp.Processing/Effects/Contrast.cs +++ b/src/ImageSharp.Processing/Effects/Contrast.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The new contrast of the image. Must be between -100 and 100. /// The . public static Image Contrast(this Image source, int amount) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Contrast(source, amount, source.Bounds); } @@ -38,7 +38,7 @@ namespace ImageSharp /// /// The . public static Image Contrast(this Image source, int amount, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new ContrastProcessor(amount), rectangle); return source; diff --git a/src/ImageSharp.Processing/Effects/Invert.cs b/src/ImageSharp.Processing/Effects/Invert.cs index fff3108df4..6c51ad3eb3 100644 --- a/src/ImageSharp.Processing/Effects/Invert.cs +++ b/src/ImageSharp.Processing/Effects/Invert.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image Invert(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Invert(source, source.Bounds); } @@ -36,7 +36,7 @@ namespace ImageSharp /// /// The . public static Image Invert(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(new InvertProcessor(), rectangle); return source; diff --git a/src/ImageSharp.Processing/Effects/OilPainting.cs b/src/ImageSharp.Processing/Effects/OilPainting.cs index fbd7777110..d7d8444c01 100644 --- a/src/ImageSharp.Processing/Effects/OilPainting.cs +++ b/src/ImageSharp.Processing/Effects/OilPainting.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The number of neighboring pixels used in calculating each individual pixel value. /// The . public static Image OilPaint(this Image source, int levels = 10, int brushSize = 15) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return OilPaint(source, levels, brushSize, source.Bounds); } @@ -40,7 +40,7 @@ namespace ImageSharp /// /// The . public static Image OilPaint(this Image source, int levels, int brushSize, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Guard.MustBeGreaterThan(levels, 0, nameof(levels)); diff --git a/src/ImageSharp.Processing/Effects/Pixelate.cs b/src/ImageSharp.Processing/Effects/Pixelate.cs index 77b014e73d..721dd930b0 100644 --- a/src/ImageSharp.Processing/Effects/Pixelate.cs +++ b/src/ImageSharp.Processing/Effects/Pixelate.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The size of the pixels. /// The . public static Image Pixelate(this Image source, int size = 4) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Pixelate(source, size, source.Bounds); } @@ -38,7 +38,7 @@ namespace ImageSharp /// /// The . public static Image Pixelate(this Image source, int size, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (size <= 0 || size > source.Height || size > source.Width) { diff --git a/src/ImageSharp.Processing/Overlays/Glow.cs b/src/ImageSharp.Processing/Overlays/Glow.cs index 9c5fe017f2..e8dfbdf0ef 100644 --- a/src/ImageSharp.Processing/Overlays/Glow.cs +++ b/src/ImageSharp.Processing/Overlays/Glow.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image Glow(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Glow(source, NamedColors.Black, source.Bounds.Width * .5F, source.Bounds); } @@ -34,7 +34,7 @@ namespace ImageSharp /// The color to set as the glow. /// The . public static Image Glow(this Image source, TColor color) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Glow(source, color, source.Bounds.Width * .5F, source.Bounds); } @@ -47,7 +47,7 @@ namespace ImageSharp /// The the radius. /// The . public static Image Glow(this Image source, float radius) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Glow(source, NamedColors.Black, radius, source.Bounds); } @@ -62,7 +62,7 @@ namespace ImageSharp /// /// The . public static Image Glow(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Glow(source, NamedColors.Black, 0, rectangle); } @@ -79,7 +79,7 @@ namespace ImageSharp /// /// The . public static Image Glow(this Image source, TColor color, float radius, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { GlowProcessor processor = new GlowProcessor(color) { Radius = radius, }; source.ApplyProcessor(processor, rectangle); diff --git a/src/ImageSharp.Processing/Overlays/Vignette.cs b/src/ImageSharp.Processing/Overlays/Vignette.cs index 4a505ad9bb..e42ead8d3a 100644 --- a/src/ImageSharp.Processing/Overlays/Vignette.cs +++ b/src/ImageSharp.Processing/Overlays/Vignette.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The image this method extends. /// The . public static Image Vignette(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Vignette(source, NamedColors.Black, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); } @@ -34,7 +34,7 @@ namespace ImageSharp /// The color to set as the vignette. /// The . public static Image Vignette(this Image source, TColor color) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Vignette(source, color, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); } @@ -48,7 +48,7 @@ namespace ImageSharp /// The the y-radius. /// The . public static Image Vignette(this Image source, float radiusX, float radiusY) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Vignette(source, NamedColors.Black, radiusX, radiusY, source.Bounds); } @@ -63,7 +63,7 @@ namespace ImageSharp /// /// The . public static Image Vignette(this Image source, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Vignette(source, NamedColors.Black, 0, 0, rectangle); } @@ -81,7 +81,7 @@ namespace ImageSharp /// /// The . public static Image Vignette(this Image source, TColor color, float radiusX, float radiusY, Rectangle rectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { VignetteProcessor processor = new VignetteProcessor(color) { RadiusX = radiusX, RadiusY = radiusY }; source.ApplyProcessor(processor, rectangle); diff --git a/src/ImageSharp.Processing/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageSharp.Processing/Processors/Binarization/BinaryThresholdProcessor.cs index e4010413fd..2d57957d3f 100644 --- a/src/ImageSharp.Processing/Processors/Binarization/BinaryThresholdProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Binarization/BinaryThresholdProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class BinaryThresholdProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs b/src/ImageSharp.Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs index 25b464c692..ce03c58a8a 100644 --- a/src/ImageSharp.Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class ErrorDiffusionDitherProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Binarization/OrderedDitherProcessor.cs b/src/ImageSharp.Processing/Processors/Binarization/OrderedDitherProcessor.cs index f201ba49aa..4126419f25 100644 --- a/src/ImageSharp.Processing/Processors/Binarization/OrderedDitherProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Binarization/OrderedDitherProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class OrderedDitherProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs index 305375eca1..0ea821bef6 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class BlackWhiteProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs index 3e34d08382..15e7c78da1 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class AchromatomalyProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs index 53a7a3556b..adca0fe985 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class AchromatopsiaProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs index 5d252961c5..6de54beeae 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class DeuteranomalyProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs index cd48df4016..4729ccc616 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class DeuteranopiaProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs index 234c2e13b5..200fff24d8 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class ProtanomalyProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs index a88b8812e6..7c0f03543f 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class ProtanopiaProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs index 1f68bddbbb..63f1fd9eb1 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class TritanomalyProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs index 85332e8106..2200414fee 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class TritanopiaProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorMatrixFilter.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorMatrixFilter.cs index b11b82b102..a37228a9ba 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/ColorMatrixFilter.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/ColorMatrixFilter.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public abstract class ColorMatrixFilter : ImageProcessor, IColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public abstract Matrix4x4 Matrix { get; } diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs index 364919e74e..bd14da59e5 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class GrayscaleBt601Processor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs index 37d41ab74d..925a36c754 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class GrayscaleBt709Processor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/HueProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/HueProcessor.cs index 0de0891fea..fdf5ffdb44 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/HueProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/HueProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class HueProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/IColorMatrixFilter.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/IColorMatrixFilter.cs index 4230fda12a..faee890eb6 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/IColorMatrixFilter.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/IColorMatrixFilter.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public interface IColorMatrixFilter : IImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets the used to alter the image. diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/KodachromeProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/KodachromeProcessor.cs index 84a05e579c..fee1684985 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/KodachromeProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/KodachromeProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class KodachromeProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/LomographProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/LomographProcessor.cs index ad166b1347..0e614afe8a 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/LomographProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/LomographProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class LomographProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private static readonly TColor VeryDarkGreen = ColorBuilder.FromRGBA(0, 10, 0, 255); diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/PolaroidProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/PolaroidProcessor.cs index 5df11160fb..666fe5bc0c 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/PolaroidProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/PolaroidProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class PolaroidProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private static TColor veryDarkOrange = ColorBuilder.FromRGB(102, 34, 0); private static TColor lightOrange = ColorBuilder.FromRGBA(255, 153, 102, 178); diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/SaturationProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/SaturationProcessor.cs index 430228d53e..d63326385c 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/SaturationProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/SaturationProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class SaturationProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/ColorMatrix/SepiaProcessor.cs b/src/ImageSharp.Processing/Processors/ColorMatrix/SepiaProcessor.cs index 1170fc3a90..d8fdc6cd1a 100644 --- a/src/ImageSharp.Processing/Processors/ColorMatrix/SepiaProcessor.cs +++ b/src/ImageSharp.Processing/Processors/ColorMatrix/SepiaProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class SepiaProcessor : ColorMatrixFilter - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4 diff --git a/src/ImageSharp.Processing/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/BoxBlurProcessor.cs index a9caea5559..3597ba7de7 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/BoxBlurProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/BoxBlurProcessor.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class BoxBlurProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The maximum size of the kernel in either direction. diff --git a/src/ImageSharp.Processing/Processors/Convolution/Convolution2DProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/Convolution2DProcessor.cs index 71b71ba5d2..d104f5d351 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/Convolution2DProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/Convolution2DProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class Convolution2DProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Convolution/Convolution2PassProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/Convolution2PassProcessor.cs index 495bfa5dba..1d118443c3 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/Convolution2PassProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/Convolution2PassProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class Convolution2PassProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Convolution/ConvolutionProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/ConvolutionProcessor.cs index 46df9c6eea..6b5b6d3fe4 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/ConvolutionProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/ConvolutionProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class ConvolutionProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs index f86940adef..a8c786f712 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public abstract class EdgeDetector2DProcessor : ImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs index 58967cb5b1..eb8491d4cd 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public abstract class EdgeDetectorCompassProcessor : ImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets the North gradient operator diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs index cd2b91f167..a963bb5780 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public abstract class EdgeDetectorProcessor : ImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs index 68dc7ccdbb..7c0923bbbd 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public interface IEdgeDetectorProcessor : IImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { } diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs index bda3c9317a..6456cc073c 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs index 4a555137eb..90b3fc4b4c 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The North gradient operator diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs index 74fcfcad55..c8823efee8 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The 2d gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs index c00831a694..3aad6d1ef0 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The 2d gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs index 8ee01047b2..a7da76e136 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The 2d gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs index cf213e7240..fea9844183 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs index de1f279ea1..329a995c09 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs index 13d7a3f498..60726deab5 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The North gradient operator diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs index 11cb91b0d9..ed45ba0acf 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs index 347a19dab6..3d2c583a7a 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// The pixel format. [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, IEquatable + where TColor : struct, IPixel { /// /// The horizontal gradient operator. diff --git a/src/ImageSharp.Processing/Processors/Convolution/GaussianBlurProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/GaussianBlurProcessor.cs index 87dde5b475..ddaffc9b48 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/GaussianBlurProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/GaussianBlurProcessor.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class GaussianBlurProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The maximum size of the kernel in either direction. diff --git a/src/ImageSharp.Processing/Processors/Convolution/GaussianSharpenProcessor.cs b/src/ImageSharp.Processing/Processors/Convolution/GaussianSharpenProcessor.cs index 5cf8cdf541..6541b73800 100644 --- a/src/ImageSharp.Processing/Processors/Convolution/GaussianSharpenProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Convolution/GaussianSharpenProcessor.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class GaussianSharpenProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The maximum size of the kernel in either direction. diff --git a/src/ImageSharp.Processing/Processors/Effects/AlphaProcessor.cs b/src/ImageSharp.Processing/Processors/Effects/AlphaProcessor.cs index ecf47a036c..11af92ea75 100644 --- a/src/ImageSharp.Processing/Processors/Effects/AlphaProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Effects/AlphaProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class AlphaProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Effects/BackgroundColorProcessor.cs b/src/ImageSharp.Processing/Processors/Effects/BackgroundColorProcessor.cs index 356b2e925a..d6d209dc7e 100644 --- a/src/ImageSharp.Processing/Processors/Effects/BackgroundColorProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Effects/BackgroundColorProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class BackgroundColorProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Effects/BrightnessProcessor.cs b/src/ImageSharp.Processing/Processors/Effects/BrightnessProcessor.cs index eb88b9c41c..566f2c6d74 100644 --- a/src/ImageSharp.Processing/Processors/Effects/BrightnessProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Effects/BrightnessProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class BrightnessProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Effects/ContrastProcessor.cs b/src/ImageSharp.Processing/Processors/Effects/ContrastProcessor.cs index 0cc56cc8e4..f4acc42bfc 100644 --- a/src/ImageSharp.Processing/Processors/Effects/ContrastProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Effects/ContrastProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class ContrastProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Effects/InvertProcessor.cs b/src/ImageSharp.Processing/Processors/Effects/InvertProcessor.cs index ec1ea7786e..641cd1b47d 100644 --- a/src/ImageSharp.Processing/Processors/Effects/InvertProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Effects/InvertProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class InvertProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// protected override void OnApply(ImageBase source, Rectangle sourceRectangle) diff --git a/src/ImageSharp.Processing/Processors/Effects/OilPaintingProcessor.cs b/src/ImageSharp.Processing/Processors/Effects/OilPaintingProcessor.cs index 5c16af2f7f..6b9558ad2c 100644 --- a/src/ImageSharp.Processing/Processors/Effects/OilPaintingProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Effects/OilPaintingProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// Adapted from by Dewald Esterhuizen. /// The pixel format. public class OilPaintingProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Effects/PixelateProcessor.cs b/src/ImageSharp.Processing/Processors/Effects/PixelateProcessor.cs index c197ce356f..d9d78dfa8c 100644 --- a/src/ImageSharp.Processing/Processors/Effects/PixelateProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Effects/PixelateProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class PixelateProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Overlays/GlowProcessor.cs b/src/ImageSharp.Processing/Processors/Overlays/GlowProcessor.cs index 690f57ab73..9043b66cb8 100644 --- a/src/ImageSharp.Processing/Processors/Overlays/GlowProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Overlays/GlowProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class GlowProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Overlays/VignetteProcessor.cs b/src/ImageSharp.Processing/Processors/Overlays/VignetteProcessor.cs index 6e94a4c2ac..f1872d0b81 100644 --- a/src/ImageSharp.Processing/Processors/Overlays/VignetteProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Overlays/VignetteProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class VignetteProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Transforms/CompandingResizeProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/CompandingResizeProcessor.cs index ac8a52321e..53da214831 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/CompandingResizeProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/CompandingResizeProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class CompandingResizeProcessor : ResamplingWeightedProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Transforms/CropProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/CropProcessor.cs index bdfbc496c9..88f23a7fd6 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/CropProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/CropProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class CropProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Transforms/EntropyCropProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/EntropyCropProcessor.cs index 98297eed99..d150c59d49 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/EntropyCropProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/EntropyCropProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class EntropyCropProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Transforms/FlipProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/FlipProcessor.cs index ad375ce0fb..da4f2b3a80 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/FlipProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/FlipProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class FlipProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Transforms/Matrix3x2Processor.cs b/src/ImageSharp.Processing/Processors/Transforms/Matrix3x2Processor.cs index 209ad3914b..7e87576870 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/Matrix3x2Processor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/Matrix3x2Processor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public abstract class Matrix3x2Processor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets the rectangle designating the target canvas. diff --git a/src/ImageSharp.Processing/Processors/Transforms/ResamplingWeightedProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/ResamplingWeightedProcessor.cs index cac8871539..25a7a4efd6 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/ResamplingWeightedProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/ResamplingWeightedProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public abstract class ResamplingWeightedProcessor : ImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Transforms/ResizeProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/ResizeProcessor.cs index f5d6308089..f4ec39f785 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/ResizeProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/ResizeProcessor.cs @@ -17,7 +17,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class ResizeProcessor : ResamplingWeightedProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp.Processing/Processors/Transforms/RotateProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/RotateProcessor.cs index a5a762b911..22fbb895c1 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/RotateProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/RotateProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class RotateProcessor : Matrix3x2Processor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The transform matrix to apply. diff --git a/src/ImageSharp.Processing/Processors/Transforms/SkewProcessor.cs b/src/ImageSharp.Processing/Processors/Transforms/SkewProcessor.cs index 4daa46491a..c6afbedcce 100644 --- a/src/ImageSharp.Processing/Processors/Transforms/SkewProcessor.cs +++ b/src/ImageSharp.Processing/Processors/Transforms/SkewProcessor.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors /// /// The pixel format. public class SkewProcessor : Matrix3x2Processor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The transform matrix to apply. diff --git a/src/ImageSharp.Processing/Transforms/AutoOrient.cs b/src/ImageSharp.Processing/Transforms/AutoOrient.cs index cb4e72a948..8c5e22b995 100644 --- a/src/ImageSharp.Processing/Transforms/AutoOrient.cs +++ b/src/ImageSharp.Processing/Transforms/AutoOrient.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The image to auto rotate. /// The public static Image AutoOrient(this Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Orientation orientation = GetExifOrientation(source); @@ -64,7 +64,7 @@ namespace ImageSharp /// The image to auto rotate. /// The private static Orientation GetExifOrientation(Image source) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (source.MetaData.ExifProfile == null) { diff --git a/src/ImageSharp.Processing/Transforms/Crop.cs b/src/ImageSharp.Processing/Transforms/Crop.cs index bdcbe51d8a..92773aaeac 100644 --- a/src/ImageSharp.Processing/Transforms/Crop.cs +++ b/src/ImageSharp.Processing/Transforms/Crop.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The target image height. /// The public static Image Crop(this Image source, int width, int height) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Crop(source, new Rectangle(0, 0, width, height)); } @@ -38,7 +38,7 @@ namespace ImageSharp /// /// The public static Image Crop(this Image source, Rectangle cropRectangle) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { CropProcessor processor = new CropProcessor(cropRectangle); diff --git a/src/ImageSharp.Processing/Transforms/EntropyCrop.cs b/src/ImageSharp.Processing/Transforms/EntropyCrop.cs index fcfcf3813e..ad2ce89e3d 100644 --- a/src/ImageSharp.Processing/Transforms/EntropyCrop.cs +++ b/src/ImageSharp.Processing/Transforms/EntropyCrop.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The threshold for entropic density. /// The public static Image EntropyCrop(this Image source, float threshold = .5f) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { EntropyCropProcessor processor = new EntropyCropProcessor(threshold); diff --git a/src/ImageSharp.Processing/Transforms/Flip.cs b/src/ImageSharp.Processing/Transforms/Flip.cs index 82b664eb14..ed096eb750 100644 --- a/src/ImageSharp.Processing/Transforms/Flip.cs +++ b/src/ImageSharp.Processing/Transforms/Flip.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The to perform the flip. /// The public static Image Flip(this Image source, FlipType flipType) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { FlipProcessor processor = new FlipProcessor(flipType); diff --git a/src/ImageSharp.Processing/Transforms/Options/ResizeHelper.cs b/src/ImageSharp.Processing/Transforms/Options/ResizeHelper.cs index 4ed147aedf..3dc37e52d7 100644 --- a/src/ImageSharp.Processing/Transforms/Options/ResizeHelper.cs +++ b/src/ImageSharp.Processing/Transforms/Options/ResizeHelper.cs @@ -24,7 +24,7 @@ namespace ImageSharp.Processing /// The . /// public static Rectangle CalculateTargetLocationAndBounds(ImageBase source, ResizeOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { switch (options.Mode) { @@ -55,7 +55,7 @@ namespace ImageSharp.Processing /// The . /// private static Rectangle CalculateCropRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -174,7 +174,7 @@ namespace ImageSharp.Processing /// The . /// private static Rectangle CalculatePadRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -255,7 +255,7 @@ namespace ImageSharp.Processing /// The . /// private static Rectangle CalculateBoxPadRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -342,7 +342,7 @@ namespace ImageSharp.Processing /// The . /// private static Rectangle CalculateMaxRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -383,7 +383,7 @@ namespace ImageSharp.Processing /// The . /// private static Rectangle CalculateMinRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; diff --git a/src/ImageSharp.Processing/Transforms/Pad.cs b/src/ImageSharp.Processing/Transforms/Pad.cs index df45a94f33..bd530ecd82 100644 --- a/src/ImageSharp.Processing/Transforms/Pad.cs +++ b/src/ImageSharp.Processing/Transforms/Pad.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The new height. /// The . public static Image Pad(this Image source, int width, int height) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { ResizeOptions options = new ResizeOptions { diff --git a/src/ImageSharp.Processing/Transforms/Resize.cs b/src/ImageSharp.Processing/Transforms/Resize.cs index aa4bf2439f..ab256c4ae2 100644 --- a/src/ImageSharp.Processing/Transforms/Resize.cs +++ b/src/ImageSharp.Processing/Transforms/Resize.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The /// 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, IEquatable + where TColor : struct, IPixel { // Ensure size is populated across both dimensions. if (options.Size.Width == 0 && options.Size.Height > 0) @@ -51,7 +51,7 @@ namespace ImageSharp /// The /// 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, Size size) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Resize(source, size.Width, size.Height, new BicubicResampler(), false); } @@ -66,7 +66,7 @@ namespace ImageSharp /// The /// 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, IEquatable + where TColor : struct, IPixel { return Resize(source, width, height, new BicubicResampler(), false); } @@ -82,7 +82,7 @@ namespace ImageSharp /// The /// 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, IEquatable + where TColor : struct, IPixel { return Resize(source, width, height, new BicubicResampler(), compand); } @@ -98,7 +98,7 @@ namespace ImageSharp /// The /// 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, IEquatable + where TColor : struct, IPixel { return Resize(source, width, height, sampler, false); } @@ -115,7 +115,7 @@ namespace ImageSharp /// The /// 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, IEquatable + where TColor : struct, IPixel { return Resize(source, width, height, sampler, source.Bounds, new Rectangle(0, 0, width, height), compand); } @@ -139,7 +139,7 @@ namespace ImageSharp /// The /// 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, IEquatable + where TColor : struct, IPixel { if (width == 0 && height > 0) { diff --git a/src/ImageSharp.Processing/Transforms/Rotate.cs b/src/ImageSharp.Processing/Transforms/Rotate.cs index e9ed4e97c1..76311ef252 100644 --- a/src/ImageSharp.Processing/Transforms/Rotate.cs +++ b/src/ImageSharp.Processing/Transforms/Rotate.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The angle in degrees to perform the rotation. /// The public static Image Rotate(this Image source, float degrees) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Rotate(source, degrees, true); } @@ -36,7 +36,7 @@ namespace ImageSharp /// The to perform the rotation. /// The public static Image Rotate(this Image source, RotateType rotateType) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Rotate(source, (float)rotateType, false); } @@ -50,7 +50,7 @@ namespace ImageSharp /// Whether to expand the image to fit the rotated result. /// The public static Image Rotate(this Image source, float degrees, bool expand) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { RotateProcessor processor = new RotateProcessor { Angle = degrees, Expand = expand }; diff --git a/src/ImageSharp.Processing/Transforms/RotateFlip.cs b/src/ImageSharp.Processing/Transforms/RotateFlip.cs index e69f183380..d6050db3f3 100644 --- a/src/ImageSharp.Processing/Transforms/RotateFlip.cs +++ b/src/ImageSharp.Processing/Transforms/RotateFlip.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The to perform the flip. /// The public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return source.Rotate(rotateType).Flip(flipType); } diff --git a/src/ImageSharp.Processing/Transforms/Skew.cs b/src/ImageSharp.Processing/Transforms/Skew.cs index 5a662c3004..03fdbcceb4 100644 --- a/src/ImageSharp.Processing/Transforms/Skew.cs +++ b/src/ImageSharp.Processing/Transforms/Skew.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The angle in degrees to perform the rotation along the y-axis. /// The public static Image Skew(this Image source, float degreesX, float degreesY) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return Skew(source, degreesX, degreesY, true); } @@ -38,7 +38,7 @@ namespace ImageSharp /// Whether to expand the image to fit the skewed result. /// The public static Image Skew(this Image source, float degreesX, float degreesY, bool expand) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { SkewProcessor processor = new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand }; diff --git a/src/ImageSharp/Colors/Color.cs b/src/ImageSharp/Colors/Color.cs index 730fe45a52..2c0d80e52d 100644 --- a/src/ImageSharp/Colors/Color.cs +++ b/src/ImageSharp/Colors/Color.cs @@ -18,7 +18,7 @@ namespace ImageSharp /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public partial struct Color : IPackedPixel, IEquatable + public partial struct Color : IPixel, IPackedVector { /// /// The shift count for the red component @@ -184,7 +184,9 @@ namespace ImageSharp } } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get diff --git a/src/ImageSharp/Colors/ColorBuilder{TColor}.cs b/src/ImageSharp/Colors/ColorBuilder{TColor}.cs index 47506af49f..f60b5c8c09 100644 --- a/src/ImageSharp/Colors/ColorBuilder{TColor}.cs +++ b/src/ImageSharp/Colors/ColorBuilder{TColor}.cs @@ -13,7 +13,7 @@ namespace ImageSharp /// /// The type of the color. public static class ColorBuilder - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Creates a new representation from the string representing a color. diff --git a/src/ImageSharp/Colors/NamedColors{TColor}.cs b/src/ImageSharp/Colors/NamedColors{TColor}.cs index 77a537f0f1..bcad4dd40b 100644 --- a/src/ImageSharp/Colors/NamedColors{TColor}.cs +++ b/src/ImageSharp/Colors/NamedColors{TColor}.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// The type of the color. public static class NamedColors - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Represents a matching the W3C definition that has an hex value of #F0F8FF. diff --git a/src/ImageSharp/Colors/PackedPixel/Alpha8.cs b/src/ImageSharp/Colors/PackedPixel/Alpha8.cs index 5642e62010..6339b66a88 100644 --- a/src/ImageSharp/Colors/PackedPixel/Alpha8.cs +++ b/src/ImageSharp/Colors/PackedPixel/Alpha8.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing a single 8 bit normalized W values ranging from 0 to 1. /// - public struct Alpha8 : IPackedPixel, IEquatable + public struct Alpha8 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -23,7 +23,9 @@ namespace ImageSharp this.PackedValue = Pack(alpha); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public byte PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Argb.cs b/src/ImageSharp/Colors/PackedPixel/Argb.cs index 783545c680..da3c50917b 100644 --- a/src/ImageSharp/Colors/PackedPixel/Argb.cs +++ b/src/ImageSharp/Colors/PackedPixel/Argb.cs @@ -17,7 +17,7 @@ namespace ImageSharp /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public struct Argb : IPackedPixel, IEquatable + public struct Argb : IPixel, IPackedVector { /// /// The shift count for the blue component @@ -106,7 +106,9 @@ namespace ImageSharp this.PackedValue = packed; } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Bgr565.cs b/src/ImageSharp/Colors/PackedPixel/Bgr565.cs index 19c7f3d14b..e11aa9c650 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgr565.cs +++ b/src/ImageSharp/Colors/PackedPixel/Bgr565.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing unsigned normalized values ranging from 0 to 1. The x and z components use 5 bits, and the y component uses 6 bits. /// - public struct Bgr565 : IPackedPixel, IEquatable + public struct Bgr565 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -36,7 +36,9 @@ namespace ImageSharp this.PackedValue = Pack(vector.X, vector.Y, vector.Z); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ushort PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs b/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs index 41f7cba040..9853409eaa 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs +++ b/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing unsigned normalized values, ranging from 0 to 1, using 4 bits each for x, y, z, and w. /// - public struct Bgra4444 : IPackedPixel, IEquatable + public struct Bgra4444 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -35,7 +35,9 @@ namespace ImageSharp this.PackedValue = Pack(vector.X, vector.Y, vector.Z, vector.W); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ushort PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs b/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs index 800cb0bf16..bed6581339 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs +++ b/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing unsigned normalized values ranging from 0 to 1. The x , y and z components use 5 bits, and the w component uses 1 bit. /// - public struct Bgra5551 : IPackedPixel, IEquatable + public struct Bgra5551 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -37,7 +37,9 @@ namespace ImageSharp this.PackedValue = Pack(vector.X, vector.Y, vector.Z, vector.W); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ushort PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Byte4.cs b/src/ImageSharp/Colors/PackedPixel/Byte4.cs index 16e066890e..79a625c312 100644 --- a/src/ImageSharp/Colors/PackedPixel/Byte4.cs +++ b/src/ImageSharp/Colors/PackedPixel/Byte4.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing four 8-bit unsigned integer values, ranging from 0 to 255. /// - public struct Byte4 : IPackedPixel, IEquatable + public struct Byte4 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -38,7 +38,9 @@ namespace ImageSharp this.PackedValue = Pack(ref vector); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/HalfSingle.cs b/src/ImageSharp/Colors/PackedPixel/HalfSingle.cs index 29a55095b9..9737a99ae7 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfSingle.cs +++ b/src/ImageSharp/Colors/PackedPixel/HalfSingle.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing a single 16 bit floating point value. /// - public struct HalfSingle : IPackedPixel, IEquatable + public struct HalfSingle : IPixel, IPackedVector { /// /// The maximum byte value. @@ -33,7 +33,9 @@ namespace ImageSharp this.PackedValue = HalfTypeHelper.Pack(single); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ushort PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/HalfVector2.cs b/src/ImageSharp/Colors/PackedPixel/HalfVector2.cs index 02e93b2503..57649dbd5e 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfVector2.cs +++ b/src/ImageSharp/Colors/PackedPixel/HalfVector2.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing two 16-bit floating-point values. /// - public struct HalfVector2 : IPackedPixel, IEquatable + public struct HalfVector2 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -43,7 +43,9 @@ namespace ImageSharp this.PackedValue = Pack(vector.X, vector.Y); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/HalfVector4.cs b/src/ImageSharp/Colors/PackedPixel/HalfVector4.cs index 38787acea8..f4f08a25c6 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfVector4.cs +++ b/src/ImageSharp/Colors/PackedPixel/HalfVector4.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing four 16-bit floating-point values. /// - public struct HalfVector4 : IPackedPixel, IEquatable + public struct HalfVector4 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -46,7 +46,9 @@ namespace ImageSharp this.PackedValue = Pack(ref vector); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ulong PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs b/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs deleted file mode 100644 index f9b8dc0a23..0000000000 --- a/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp -{ - using System; - - /// - /// An interface that represents a generic packed pixel type. - /// - /// The packed format. uint, long, float. - public interface IPackedPixel : IPackedPixel, IPackedVector - where TPacked : struct, IEquatable - { - } - - /// - /// An interface that represents a packed pixel type. - /// - public interface IPackedPixel : IPackedVector, IPackedBytes - { - } -} \ No newline at end of file diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedVector.cs b/src/ImageSharp/Colors/PackedPixel/IPackedVector.cs deleted file mode 100644 index 4d9a89712b..0000000000 --- a/src/ImageSharp/Colors/PackedPixel/IPackedVector.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp -{ - using System; - using System.Numerics; - - /// - /// An interface that converts packed vector types to and from values, - /// allowing multiple encodings to be manipulated in a generic manner. - /// - /// The packed format. uint, long, float. - public interface IPackedVector : IPackedVector - where TPacked : struct, IEquatable - { - /// - /// Gets or sets the packed representation of the value. - /// - TPacked PackedValue { get; set; } - } - - /// - /// An interface that converts packed vector types to and from values. - /// - public interface IPackedVector - { - /// - /// Sets the packed representation from a . - /// - /// The vector to create the packed representation from. - void PackFromVector4(Vector4 vector); - - /// - /// Expands the packed representation into a . - /// The vector components are typically expanded in least to greatest significance order. - /// - /// The . - Vector4 ToVector4(); - } -} \ No newline at end of file diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedVector{TPacked}.cs b/src/ImageSharp/Colors/PackedPixel/IPackedVector{TPacked}.cs new file mode 100644 index 0000000000..0450fb8fba --- /dev/null +++ b/src/ImageSharp/Colors/PackedPixel/IPackedVector{TPacked}.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp +{ + using System; + using System.Numerics; + + /// + /// This interface exists for ensuring signature compatibility to MonoGame and XNA packed color types. + /// + /// + /// The packed format. uint, long, float. + public interface IPackedVector : IPixel + where TPacked : struct, IEquatable + { + /// + /// Gets or sets the packed representation of the value. + /// + TPacked PackedValue { get; set; } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedBytes.cs b/src/ImageSharp/Colors/PackedPixel/IPixel.cs similarity index 69% rename from src/ImageSharp/Colors/PackedPixel/IPackedBytes.cs rename to src/ImageSharp/Colors/PackedPixel/IPixel.cs index 3343a92c73..1c3e20a7e4 100644 --- a/src/ImageSharp/Colors/PackedPixel/IPackedBytes.cs +++ b/src/ImageSharp/Colors/PackedPixel/IPixel.cs @@ -1,16 +1,40 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp { + using System; + using System.Numerics; + + /// + /// An interface that represents a generic pixel type. + /// + /// The type implementing this interface + public interface IPixel : IPixel, IEquatable + where TSelf : struct, IPixel + { + } + /// - /// An interface that converts packed vector types to and from values, - /// allowing multiple encodings to be manipulated in a generic manner. + /// An interface that represents a pixel type. /// - public interface IPackedBytes + public interface IPixel { + /// + /// Sets the packed representation from a . + /// + /// The vector to create the packed representation from. + void PackFromVector4(Vector4 vector); + + /// + /// Expands the packed representation into a . + /// The vector components are typically expanded in least to greatest significance order. + /// + /// The . + Vector4 ToVector4(); + /// /// Sets the packed representation from the given byte array. /// @@ -52,4 +76,4 @@ namespace ImageSharp /// The starting index of the . void ToZyxwBytes(byte[] bytes, int startIndex); } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedByte2.cs b/src/ImageSharp/Colors/PackedPixel/NormalizedByte2.cs index 5196cbfaf4..1fece550fa 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedByte2.cs +++ b/src/ImageSharp/Colors/PackedPixel/NormalizedByte2.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed packed pixel type containing two 8-bit signed normalized values, ranging from −1 to 1. /// - public struct NormalizedByte2 : IPackedPixel, IEquatable + public struct NormalizedByte2 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -48,7 +48,9 @@ namespace ImageSharp this.PackedValue = Pack(x, y); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ushort PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedByte4.cs b/src/ImageSharp/Colors/PackedPixel/NormalizedByte4.cs index c5de795e24..d49ea8a654 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedByte4.cs +++ b/src/ImageSharp/Colors/PackedPixel/NormalizedByte4.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing four 8-bit signed normalized values, ranging from −1 to 1. /// - public struct NormalizedByte4 : IPackedPixel, IEquatable + public struct NormalizedByte4 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -50,7 +50,9 @@ namespace ImageSharp this.PackedValue = Pack(x, y, z, w); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedShort2.cs b/src/ImageSharp/Colors/PackedPixel/NormalizedShort2.cs index 8e35700472..b9a2dc5332 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedShort2.cs +++ b/src/ImageSharp/Colors/PackedPixel/NormalizedShort2.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing two 16-bit signed normalized values, ranging from −1 to 1. /// - public struct NormalizedShort2 : IPackedPixel, IEquatable + public struct NormalizedShort2 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -48,7 +48,9 @@ namespace ImageSharp this.PackedValue = Pack(x, y); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedShort4.cs b/src/ImageSharp/Colors/PackedPixel/NormalizedShort4.cs index 81d182cee3..2cf90d2081 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedShort4.cs +++ b/src/ImageSharp/Colors/PackedPixel/NormalizedShort4.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing four 16-bit signed normalized values, ranging from −1 to 1. /// - public struct NormalizedShort4 : IPackedPixel, IEquatable + public struct NormalizedShort4 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -50,7 +50,9 @@ namespace ImageSharp this.PackedValue = Pack(x, y, z, w); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ulong PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Rg32.cs b/src/ImageSharp/Colors/PackedPixel/Rg32.cs index f7dab68c3d..0dbcf483a9 100644 --- a/src/ImageSharp/Colors/PackedPixel/Rg32.cs +++ b/src/ImageSharp/Colors/PackedPixel/Rg32.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing two 16-bit unsigned normalized values ranging from 0 to 1. /// - public struct Rg32 : IPackedPixel, IEquatable, IPackedVector + public struct Rg32 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -33,7 +33,9 @@ namespace ImageSharp this.PackedValue = Pack(vector.X, vector.Y); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Rgba1010102.cs b/src/ImageSharp/Colors/PackedPixel/Rgba1010102.cs index 8c22610287..f867afb014 100644 --- a/src/ImageSharp/Colors/PackedPixel/Rgba1010102.cs +++ b/src/ImageSharp/Colors/PackedPixel/Rgba1010102.cs @@ -13,7 +13,7 @@ namespace ImageSharp /// Packed vector type containing unsigned normalized values ranging from 0 to 1. /// The x, y and z components use 10 bits, and the w component uses 2 bits. /// - public struct Rgba1010102 : IPackedPixel, IEquatable, IPackedVector + public struct Rgba1010102 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -36,7 +36,9 @@ namespace ImageSharp this.PackedValue = Pack(vector.X, vector.Y, vector.Z, vector.W); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Rgba64.cs b/src/ImageSharp/Colors/PackedPixel/Rgba64.cs index bb21826498..a99e127f35 100644 --- a/src/ImageSharp/Colors/PackedPixel/Rgba64.cs +++ b/src/ImageSharp/Colors/PackedPixel/Rgba64.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing four 16-bit unsigned normalized values ranging from 0 to 1. /// - public struct Rgba64 : IPackedPixel, IEquatable, IPackedVector + public struct Rgba64 : IPixel, IPackedVector { /// /// Initializes a new instance of the struct. @@ -35,7 +35,9 @@ namespace ImageSharp this.PackedValue = Pack(vector.X, vector.Y, vector.Z, vector.W); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ulong PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Short2.cs b/src/ImageSharp/Colors/PackedPixel/Short2.cs index 6bfc5d40c2..a89005ce54 100644 --- a/src/ImageSharp/Colors/PackedPixel/Short2.cs +++ b/src/ImageSharp/Colors/PackedPixel/Short2.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing two 16-bit signed integer values. /// - public struct Short2 : IPackedPixel, IEquatable + public struct Short2 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -48,7 +48,9 @@ namespace ImageSharp this.PackedValue = Pack(x, y); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public uint PackedValue { get; set; } /// diff --git a/src/ImageSharp/Colors/PackedPixel/Short4.cs b/src/ImageSharp/Colors/PackedPixel/Short4.cs index 4b1f3c2533..4b6a6d00b5 100644 --- a/src/ImageSharp/Colors/PackedPixel/Short4.cs +++ b/src/ImageSharp/Colors/PackedPixel/Short4.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// Packed pixel type containing four 16-bit signed integer values. /// - public struct Short4 : IPackedPixel, IEquatable + public struct Short4 : IPixel, IPackedVector { /// /// The maximum byte value. @@ -50,7 +50,9 @@ namespace ImageSharp this.PackedValue = Pack(x, y, z, w); } - /// + /// + /// Gets or sets the packed representation of the value. + /// public ulong PackedValue { get; set; } /// diff --git a/src/ImageSharp/Common/Extensions/ArrayExtensions.cs b/src/ImageSharp/Common/Extensions/ArrayExtensions.cs index be3d3f1dc7..cce442c522 100644 --- a/src/ImageSharp/Common/Extensions/ArrayExtensions.cs +++ b/src/ImageSharp/Common/Extensions/ArrayExtensions.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The height of the image represented by the pixel buffer. /// The public static PixelAccessor Lock(this TColor[] pixels, int width, int height) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return new PixelAccessor(width, height, pixels); } diff --git a/src/ImageSharp/Common/Helpers/DebugGuard.cs b/src/ImageSharp/Common/Helpers/DebugGuard.cs new file mode 100644 index 0000000000..0ca6f09120 --- /dev/null +++ b/src/ImageSharp/Common/Helpers/DebugGuard.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp +{ + using System; + using System.Diagnostics; + + /// + /// Provides methods to protect against invalid parameters for a DEBUG build. + /// + [DebuggerStepThrough] + internal static class DebugGuard + { + /// + /// Verifies, that the method parameter with specified object value is not null + /// and throws an exception if it is found to be so. + /// + /// The target object, which cannot be null. + /// The name of the parameter that is to be checked. + /// is null + [Conditional("DEBUG")] + public static void NotNull(object target, string parameterName) + { + if (target == null) + { + throw new ArgumentNullException(parameterName); + } + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs index 5720d82186..b59cf54f52 100644 --- a/src/ImageSharp/Common/Helpers/ImageMaths.cs +++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs @@ -183,7 +183,7 @@ namespace ImageSharp /// The . /// public static Rectangle GetFilteredBoundingRectangle(ImageBase bitmap, float componentValue, RgbaComponent channel = RgbaComponent.B) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { int width = bitmap.Width; int height = bitmap.Height; diff --git a/src/ImageSharp/Common/Memory/ArrayPointer{T}.cs b/src/ImageSharp/Common/Memory/ArrayPointer{T}.cs new file mode 100644 index 0000000000..1ea7706d44 --- /dev/null +++ b/src/ImageSharp/Common/Memory/ArrayPointer{T}.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp +{ + using System; + using System.Runtime.CompilerServices; + using System.Runtime.InteropServices; + + /// + /// Provides access to elements in an array from a given position. + /// This type shares many similarities with corefx System.Span<T> but there are significant differences in it's functionalities and semantics: + /// - It's not possible to use it with stack objects or pointers to unmanaged memory, only with managed arrays + /// - It's possible to retrieve a reference to the array () so we can pass it to API-s like + /// - There is no bounds checking for performance reasons. Therefore we don't need to store length. (However this could be added as DEBUG-only feature.) + /// This makes an unsafe type! + /// - Currently the arrays provided to ArrayPointer need to be pinned. This behaviour could be changed using C#7 features. + /// + /// The type of elements of the array + internal unsafe struct ArrayPointer + where T : struct + { + /// + /// Initializes a new instance of the struct from a pinned array and an offset. + /// + /// The pinned array + /// Pointer to the beginning of array + /// The offset inside the array + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ArrayPointer(T[] array, void* pointerToArray, int offset) + { + DebugGuard.NotNull(array, nameof(array)); + + this.Array = array; + this.Offset = offset; + this.PointerAtOffset = (IntPtr)pointerToArray + (Unsafe.SizeOf() * offset); + } + + /// + /// Initializes a new instance of the struct from a pinned array. + /// + /// The pinned array + /// Pointer to the start of 'array' + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ArrayPointer(T[] array, void* pointerToArray) + { + DebugGuard.NotNull(array, nameof(array)); + + this.Array = array; + this.Offset = 0; + this.PointerAtOffset = (IntPtr)pointerToArray; + } + + /// + /// Gets the array + /// + public T[] Array { get; private set; } + + /// + /// Gets the offset inside + /// + public int Offset { get; private set; } + + /// + /// Gets the pointer to the offseted array position + /// + public IntPtr PointerAtOffset { get; private set; } + + /// + /// Forms a slice out of the given ArrayPointer, beginning at 'offset'. + /// + /// The offset in number of elements + /// The offseted (sliced) ArrayPointer + public ArrayPointer Slice(int offset) + { + ArrayPointer result = default(ArrayPointer); + result.Array = this.Array; + result.Offset = this.Offset + offset; + result.PointerAtOffset = this.PointerAtOffset + (Unsafe.SizeOf() * offset); + return result; + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Common/Helpers/Fast2DArray{T}.cs b/src/ImageSharp/Common/Memory/Fast2DArray{T}.cs similarity index 98% rename from src/ImageSharp/Common/Helpers/Fast2DArray{T}.cs rename to src/ImageSharp/Common/Memory/Fast2DArray{T}.cs index 09cb0fec23..3455031fdb 100644 --- a/src/ImageSharp/Common/Helpers/Fast2DArray{T}.cs +++ b/src/ImageSharp/Common/Memory/Fast2DArray{T}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // diff --git a/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs b/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs index 4fd5476f05..20a45d4df6 100644 --- a/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs +++ b/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs @@ -68,7 +68,7 @@ namespace ImageSharp.Dithering /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Dither(PixelAccessor pixels, TColor source, TColor transformed, int x, int y, int width, int height) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { // Assign the transformed pixel to the array. pixels[x, y] = transformed; diff --git a/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs b/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs index fbee27088e..4fb31c13e4 100644 --- a/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs +++ b/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs @@ -29,6 +29,6 @@ namespace ImageSharp.Dithering /// The image height. /// The pixel format. void Dither(PixelAccessor pixels, TColor source, TColor transformed, int x, int y, int width, int height) - where TColor : struct, IPackedPixel, IEquatable; + where TColor : struct, IPixel; } } diff --git a/src/ImageSharp/Dithering/Ordered/Bayer.cs b/src/ImageSharp/Dithering/Ordered/Bayer.cs index ff56196c59..1027e51d94 100644 --- a/src/ImageSharp/Dithering/Ordered/Bayer.cs +++ b/src/ImageSharp/Dithering/Ordered/Bayer.cs @@ -31,7 +31,7 @@ namespace ImageSharp.Dithering.Ordered /// public void Dither(PixelAccessor pixels, TColor source, TColor upper, TColor lower, byte[] bytes, int index, int x, int y, int width, int height) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ToXyzwBytes(bytes, 0); pixels[x, y] = ThresholdMatrix[y % 3, x % 3] >= bytes[index] ? lower : upper; diff --git a/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs b/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs index e74a863a51..162cdb6a18 100644 --- a/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs +++ b/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs @@ -32,6 +32,6 @@ namespace ImageSharp.Dithering /// The image height. /// The pixel format. void Dither(PixelAccessor pixels, TColor source, TColor upper, TColor lower, byte[] bytes, int index, int x, int y, int width, int height) - where TColor : struct, IPackedPixel, IEquatable; + where TColor : struct, IPixel; } } diff --git a/src/ImageSharp/Dithering/Ordered/Ordered.cs b/src/ImageSharp/Dithering/Ordered/Ordered.cs index 86c325cd1f..aabca31aad 100644 --- a/src/ImageSharp/Dithering/Ordered/Ordered.cs +++ b/src/ImageSharp/Dithering/Ordered/Ordered.cs @@ -31,7 +31,7 @@ namespace ImageSharp.Dithering.Ordered /// public void Dither(PixelAccessor pixels, TColor source, TColor upper, TColor lower, byte[] bytes, int index, int x, int y, int width, int height) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ToXyzwBytes(bytes, 0); pixels[x, y] = ThresholdMatrix[y % 3, x % 3] >= bytes[index] ? lower : upper; diff --git a/src/ImageSharp/Formats/IImageDecoder.cs b/src/ImageSharp/Formats/IImageDecoder.cs index d723b82f0a..28bda7837e 100644 --- a/src/ImageSharp/Formats/IImageDecoder.cs +++ b/src/ImageSharp/Formats/IImageDecoder.cs @@ -20,6 +20,6 @@ namespace ImageSharp.Formats /// The to decode to. /// The containing image data. void Decode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable; + where TColor : struct, IPixel; } } diff --git a/src/ImageSharp/Formats/IImageEncoder.cs b/src/ImageSharp/Formats/IImageEncoder.cs index edde5347e5..0ba56477ac 100644 --- a/src/ImageSharp/Formats/IImageEncoder.cs +++ b/src/ImageSharp/Formats/IImageEncoder.cs @@ -20,6 +20,6 @@ namespace ImageSharp.Formats /// The to encode from. /// The to encode the image data to. void Encode(Image image, Stream stream) - where TColor : struct, IPackedPixel, IEquatable; + where TColor : struct, IPixel; } } diff --git a/src/ImageSharp/Image/IImageBase{TColor}.cs b/src/ImageSharp/Image/IImageBase{TColor}.cs index f01a4b7028..e894fba4a8 100644 --- a/src/ImageSharp/Image/IImageBase{TColor}.cs +++ b/src/ImageSharp/Image/IImageBase{TColor}.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// /// The pixel format. public interface IImageBase : IImageBase, IDisposable - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets the pixels as an array of the given packed pixel format. diff --git a/src/ImageSharp/Image/IImageProcessor.cs b/src/ImageSharp/Image/IImageProcessor.cs index fae0c23b8a..0440cdd766 100644 --- a/src/ImageSharp/Image/IImageProcessor.cs +++ b/src/ImageSharp/Image/IImageProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing /// /// The pixel format. public interface IImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets or sets the parallel options for processing tasks in parallel. diff --git a/src/ImageSharp/Image/ImageBase{TColor}.cs b/src/ImageSharp/Image/ImageBase{TColor}.cs index fd82f77308..e4b4485c7f 100644 --- a/src/ImageSharp/Image/ImageBase{TColor}.cs +++ b/src/ImageSharp/Image/ImageBase{TColor}.cs @@ -16,7 +16,7 @@ namespace ImageSharp /// The pixel format. [DebuggerDisplay("Image: {Width}x{Height}")] public abstract class ImageBase : IImageBase - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The image pixels @@ -182,7 +182,7 @@ namespace ImageSharp /// protected void CopyProperties(IImageBase other) { - Debug.Assert(other != null); + DebugGuard.NotNull(other, nameof(other)); this.Configuration = other.Configuration; } diff --git a/src/ImageSharp/Image/ImageFrame{TColor}.cs b/src/ImageSharp/Image/ImageFrame{TColor}.cs index 02e5b71618..2712dc6878 100644 --- a/src/ImageSharp/Image/ImageFrame{TColor}.cs +++ b/src/ImageSharp/Image/ImageFrame{TColor}.cs @@ -14,7 +14,7 @@ namespace ImageSharp /// /// The pixel format. public class ImageFrame : ImageBase, IImageFrame - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. @@ -56,7 +56,7 @@ namespace ImageSharp /// The pixel format. /// The public ImageFrame To(Func scaleFunc = null) - where TColor2 : struct, IPackedPixel, IEquatable + where TColor2 : struct, IPixel { scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); diff --git a/src/ImageSharp/Image/ImageProcessingExtensions.cs b/src/ImageSharp/Image/ImageProcessingExtensions.cs index db8fb4baa7..ff3ecd5eef 100644 --- a/src/ImageSharp/Image/ImageProcessingExtensions.cs +++ b/src/ImageSharp/Image/ImageProcessingExtensions.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The processor to apply to the image. /// The . public static Image Apply(this Image source, IImageProcessor processor) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { source.ApplyProcessor(processor, source.Bounds); return source; diff --git a/src/ImageSharp/Image/Image{TColor}.cs b/src/ImageSharp/Image/Image{TColor}.cs index 33d6a69655..bbd839d168 100644 --- a/src/ImageSharp/Image/Image{TColor}.cs +++ b/src/ImageSharp/Image/Image{TColor}.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. [DebuggerDisplay("Image: {Width}x{Height}")] public class Image : ImageBase, IImage - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class @@ -325,7 +325,7 @@ namespace ImageSharp /// The pixel format. /// The public Image To(Func scaleFunc = null) - where TColor2 : struct, IPackedPixel, IEquatable + where TColor2 : struct, IPixel { scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); diff --git a/src/ImageSharp/Image/PixelAccessor{TColor}.cs b/src/ImageSharp/Image/PixelAccessor{TColor}.cs index 55b16235a5..338f491827 100644 --- a/src/ImageSharp/Image/PixelAccessor{TColor}.cs +++ b/src/ImageSharp/Image/PixelAccessor{TColor}.cs @@ -16,7 +16,7 @@ namespace ImageSharp /// /// The pixel format. public unsafe class PixelAccessor : IDisposable - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The pointer to the pixel buffer. diff --git a/src/ImageSharp/Image/PixelArea{TColor}.cs b/src/ImageSharp/Image/PixelArea{TColor}.cs index 99e9273751..77b648ca56 100644 --- a/src/ImageSharp/Image/PixelArea{TColor}.cs +++ b/src/ImageSharp/Image/PixelArea{TColor}.cs @@ -16,7 +16,7 @@ namespace ImageSharp /// /// The pixel format. public sealed unsafe class PixelArea : IDisposable - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// True if was rented from by the constructor diff --git a/src/ImageSharp/Image/PixelPool{TColor}.cs b/src/ImageSharp/Image/PixelPool{TColor}.cs index 1f33926214..8193600daf 100644 --- a/src/ImageSharp/Image/PixelPool{TColor}.cs +++ b/src/ImageSharp/Image/PixelPool{TColor}.cs @@ -13,7 +13,7 @@ namespace ImageSharp /// /// The pixel format. public static class PixelPool - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The used to pool data. TODO: Choose sensible default size and count diff --git a/src/ImageSharp/ImageProcessor.cs b/src/ImageSharp/ImageProcessor.cs index 79bc3ee1e6..a0766d1edf 100644 --- a/src/ImageSharp/ImageProcessor.cs +++ b/src/ImageSharp/ImageProcessor.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Processing /// /// The pixel format. public abstract class ImageProcessor : IImageProcessor - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// public virtual ParallelOptions ParallelOptions { get; set; } diff --git a/src/ImageSharp/MetaData/ImageFrameMetaData.cs b/src/ImageSharp/MetaData/ImageFrameMetaData.cs index c2277686f1..50119096e9 100644 --- a/src/ImageSharp/MetaData/ImageFrameMetaData.cs +++ b/src/ImageSharp/MetaData/ImageFrameMetaData.cs @@ -5,8 +5,6 @@ namespace ImageSharp { - using System.Diagnostics; - /// /// Encapsulates the metadata of an image frame. /// @@ -28,7 +26,7 @@ namespace ImageSharp /// internal ImageFrameMetaData(ImageFrameMetaData other) { - Debug.Assert(other != null); + DebugGuard.NotNull(other, nameof(other)); this.FrameDelay = other.FrameDelay; } diff --git a/src/ImageSharp/MetaData/ImageMetaData.cs b/src/ImageSharp/MetaData/ImageMetaData.cs index a40df3110d..de1e424769 100644 --- a/src/ImageSharp/MetaData/ImageMetaData.cs +++ b/src/ImageSharp/MetaData/ImageMetaData.cs @@ -6,7 +6,6 @@ namespace ImageSharp { using System.Collections.Generic; - using System.Diagnostics; /// /// Encapsulates the metadata of an image. @@ -46,7 +45,7 @@ namespace ImageSharp /// internal ImageMetaData(ImageMetaData other) { - Debug.Assert(other != null); + DebugGuard.NotNull(other, nameof(other)); this.HorizontalResolution = other.HorizontalResolution; this.VerticalResolution = other.VerticalResolution; diff --git a/src/ImageSharp/MetaData/ImageProperty.cs b/src/ImageSharp/MetaData/ImageProperty.cs index c8bd0b23d1..178794283c 100644 --- a/src/ImageSharp/MetaData/ImageProperty.cs +++ b/src/ImageSharp/MetaData/ImageProperty.cs @@ -6,7 +6,6 @@ namespace ImageSharp { using System; - using System.Diagnostics; /// /// Stores meta information about a image, like the name of the author, @@ -37,7 +36,7 @@ namespace ImageSharp /// internal ImageProperty(ImageProperty other) { - Debug.Assert(other != null); + DebugGuard.NotNull(other, nameof(other)); this.Name = other.Name; this.Value = other.Value; diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs index 3bd5ef3cb1..b363286b00 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs @@ -121,7 +121,7 @@ namespace ImageSharp /// The . /// public Image CreateThumbnail() - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.InitializeValues(); diff --git a/src/ImageSharp/Quantizers/IQuantizer.cs b/src/ImageSharp/Quantizers/IQuantizer.cs index ef2f0bb98e..9ee3072666 100644 --- a/src/ImageSharp/Quantizers/IQuantizer.cs +++ b/src/ImageSharp/Quantizers/IQuantizer.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Quantizers /// /// The pixel format. public interface IQuantizer : IQuantizer - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Quantize an image and return the resulting output pixels. @@ -32,7 +32,7 @@ namespace ImageSharp.Quantizers /// /// The pixel format. public interface IDitheredQuantizer : IQuantizer - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Gets or sets a value indicating whether to apply dithering to the output image. diff --git a/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs b/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs index c0aab00ed6..c047e1af48 100644 --- a/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs +++ b/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Quantizers /// /// The pixel format. public sealed class OctreeQuantizer : Quantizer - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The pixel buffer, used to reduce allocations. diff --git a/src/ImageSharp/Quantizers/Octree/Quantizer.cs b/src/ImageSharp/Quantizers/Octree/Quantizer.cs index 87705de94d..8af638de35 100644 --- a/src/ImageSharp/Quantizers/Octree/Quantizer.cs +++ b/src/ImageSharp/Quantizers/Octree/Quantizer.cs @@ -17,7 +17,7 @@ namespace ImageSharp.Quantizers /// /// The pixel format. public abstract class Quantizer : IDitheredQuantizer - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// A lookup table for colors diff --git a/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs b/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs index e55d670375..19f10aabb0 100644 --- a/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs +++ b/src/ImageSharp/Quantizers/Palette/PaletteQuantizer.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Quantizers /// /// The pixel format. public sealed class PaletteQuantizer : Quantizer - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The pixel buffer, used to reduce allocations. diff --git a/src/ImageSharp/Quantizers/Quantize.cs b/src/ImageSharp/Quantizers/Quantize.cs index 8a26fb4bad..f45cd3f799 100644 --- a/src/ImageSharp/Quantizers/Quantize.cs +++ b/src/ImageSharp/Quantizers/Quantize.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The maximum number of colors to return. Defaults to 256. /// The . public static Image Quantize(this Image source, Quantization mode = Quantization.Octree, int maxColors = 256) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { IQuantizer quantizer; switch (mode) @@ -54,7 +54,7 @@ namespace ImageSharp /// The maximum number of colors to return. /// The . public static Image Quantize(this Image source, IQuantizer quantizer, int maxColors) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { QuantizedImage quantized = quantizer.Quantize(source, maxColors); int palleteCount = quantized.Palette.Length - 1; diff --git a/src/ImageSharp/Quantizers/QuantizedImage.cs b/src/ImageSharp/Quantizers/QuantizedImage.cs index cc740f9be1..528da77172 100644 --- a/src/ImageSharp/Quantizers/QuantizedImage.cs +++ b/src/ImageSharp/Quantizers/QuantizedImage.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Quantizers /// /// The pixel format. public class QuantizedImage - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// Initializes a new instance of the class. diff --git a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs index 55743f81e2..d632cdd73b 100644 --- a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs +++ b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs @@ -31,7 +31,7 @@ namespace ImageSharp.Quantizers /// /// The pixel format. public sealed class WuQuantizer : IQuantizer - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { /// /// The index bits. diff --git a/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs b/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs index ac1c3f3516..08b9375f82 100644 --- a/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs @@ -132,7 +132,7 @@ namespace ImageSharp.Tests.Colors [MemberData(nameof(Vector3Data))] [MemberData(nameof(Float4Data))] [MemberData(nameof(Float3Data))] - public void ConstructorToVector4(IPackedVector packedVector, float[] expectedVector4Components) + public void ConstructorToVector4(IPixel packedVector, float[] expectedVector4Components) { // Arrange var precision = 2; diff --git a/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs b/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs index a1057a2c26..ac5f8d6b46 100644 --- a/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs @@ -69,7 +69,7 @@ namespace ImageSharp.Tests.Colors [Theory] [MemberData(nameof(Vector4PackData))] [MemberData(nameof(Vector3PackData))] - public void FromVector4ToVector4(IPackedVector packedVector, float[] vector4ComponentsToPack) + public void FromVector4ToVector4(IPixel packedVector, float[] vector4ComponentsToPack) { // Arrange var precision = 2; diff --git a/tests/ImageSharp.Tests/Common/ArrayPointerTests.cs b/tests/ImageSharp.Tests/Common/ArrayPointerTests.cs new file mode 100644 index 0000000000..076e2512c8 --- /dev/null +++ b/tests/ImageSharp.Tests/Common/ArrayPointerTests.cs @@ -0,0 +1,83 @@ +// ReSharper disable ObjectCreationAsStatement +// ReSharper disable InconsistentNaming +namespace ImageSharp.Tests.Common +{ + using System; + + using Xunit; + + public unsafe class ArrayPointerTests + { + public struct Foo + { +#pragma warning disable CS0414 + private int a; + + private double b; +#pragma warning restore CS0414 + + internal static Foo[] CreateArray(int size) + { + Foo[] result = new Foo[size]; + for (int i = 0; i < size; i++) + { + result[i] = new Foo() { a = i, b = i }; + } + return result; + } + } + + [Fact] + public void ConstructWithoutOffset() + { + Foo[] array = Foo.CreateArray(3); + fixed (Foo* p = array) + { + // Act: + ArrayPointer ap = new ArrayPointer(array, p); + + // Assert: + Assert.Equal(array, ap.Array); + Assert.Equal((IntPtr)p, ap.PointerAtOffset); + } + } + + [Fact] + public void ConstructWithOffset() + { + Foo[] array = Foo.CreateArray(3); + int offset = 2; + fixed (Foo* p = array) + { + // Act: + ArrayPointer ap = new ArrayPointer(array, p, offset); + + // Assert: + Assert.Equal(array, ap.Array); + Assert.Equal(offset, ap.Offset); + Assert.Equal((IntPtr)(p+offset), ap.PointerAtOffset); + } + } + + [Fact] + public void Slice() + { + Foo[] array = Foo.CreateArray(5); + int offset0 = 2; + int offset1 = 2; + int totalOffset = offset0 + offset1; + fixed (Foo* p = array) + { + ArrayPointer ap = new ArrayPointer(array, p, offset0); + + // Act: + ap = ap.Slice(offset1); + + // Assert: + Assert.Equal(array, ap.Array); + Assert.Equal(totalOffset, ap.Offset); + Assert.Equal((IntPtr)(p + totalOffset), ap.PointerAtOffset); + } + } + } +} \ No newline at end of file diff --git a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs index adc568c824..8dbdb998c5 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs @@ -29,7 +29,7 @@ namespace ImageSharp.Tests [Theory] [WithFile(TestImages.Jpeg.Baseline.Bad.MissingEOF, PixelTypes.Color)] public void LoadBaselineImage(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image image = provider.GetImage()) { @@ -41,7 +41,7 @@ namespace ImageSharp.Tests [Theory] // TODO: #18 [WithFile(TestImages.Jpeg.Progressive.Bad.BadEOF, PixelTypes.Color)] public void LoadProgressiveImage(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image image = provider.GetImage()) { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 8bce4c4e8d..71ce4e1652 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -27,7 +27,7 @@ namespace ImageSharp.Tests [Theory] [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb)] public void OpenBaselineJpeg_SaveBmp(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image image = provider.GetImage()) { @@ -38,7 +38,7 @@ namespace ImageSharp.Tests [Theory] [WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb)] public void OpenProgressiveJpeg_SaveBmp(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image image = provider.GetImage()) { @@ -56,7 +56,7 @@ namespace ImageSharp.Tests TestImageProvider provider, JpegSubsample subsample, int quality) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { byte[] data; using (Image image = provider.GetImage()) @@ -80,7 +80,7 @@ namespace ImageSharp.Tests [WithSolidFilledImages(42, 88, 255, 0, 0, PixelTypes.StandardImageClass)] public void DecodeGenerated_MetadataOnly( TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image image = provider.GetImage()) { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs index ef6671931f..6518c3e6b6 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs @@ -32,7 +32,7 @@ namespace ImageSharp.Tests [WithFile(TestImages.Jpeg.Baseline.Snake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)] [WithFile(TestImages.Jpeg.Baseline.Lake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)] public void LoadResizeSave(TestImageProvider provider, int quality, JpegSubsample subsample) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image image = provider.GetImage().Resize(new ResizeOptions { Size = new Size(150, 100), Mode = ResizeMode.Max })) { @@ -50,7 +50,7 @@ namespace ImageSharp.Tests [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb, JpegSubsample.Ratio420, 75)] [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb, JpegSubsample.Ratio444, 75)] public void OpenBmp_SaveJpeg(TestImageProvider provider, JpegSubsample subSample, int quality) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image image = provider.GetImage()) { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs index 0956131b14..d0a7fae333 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Tests public class JpegUtilsTests : TestBase { public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Image image = factory.CreateImage(10, 10); using (PixelAccessor pixels = image.Lock()) @@ -41,7 +41,7 @@ namespace ImageSharp.Tests [Theory] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb)] public void CopyStretchedRGBTo_FromOrigo(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image src = provider.GetImage()) using (Image dest = provider.Factory.CreateImage(8, 8)) @@ -63,7 +63,7 @@ namespace ImageSharp.Tests [Theory] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb)] public void CopyStretchedRGBTo_WithOffset(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image src = provider.GetImage()) using (PixelArea area = new PixelArea(8, 8, ComponentOrder.Xyz)) diff --git a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs index 46f667e703..f3cd20f45c 100644 --- a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs +++ b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Tests public class PixelAccessorTests { public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Image image = factory.CreateImage(10, 10); using (PixelAccessor pixels = image.Lock()) @@ -44,7 +44,7 @@ namespace ImageSharp.Tests [WithMemberFactory(nameof(CreateTestImage), PixelTypes.All, ComponentOrder.Xyzw)] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.All, ComponentOrder.Zyxw)] public void CopyTo_Then_CopyFrom_OnFullImageRect(TestImageProvider provider, ComponentOrder order) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image src = provider.GetImage()) { @@ -70,7 +70,7 @@ namespace ImageSharp.Tests // TODO: Need a processor in the library with this signature private static void Fill(Image image, Rectangle region, TColor color) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelAccessor pixels = image.Lock()) { @@ -90,7 +90,7 @@ namespace ImageSharp.Tests [WithBlankImages(16, 16, PixelTypes.All, ComponentOrder.Xyzw)] [WithBlankImages(16, 16, PixelTypes.All, ComponentOrder.Zyxw)] public void CopyToThenCopyFromWithOffset(TestImageProvider provider, ComponentOrder order) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (Image destImage = new Image(8, 8)) { @@ -195,7 +195,7 @@ namespace ImageSharp.Tests } private static void CopyFromZYX(Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelAccessor pixels = image.Lock()) { @@ -222,7 +222,7 @@ namespace ImageSharp.Tests } private static void CopyFromZYXW(Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelAccessor pixels = image.Lock()) { @@ -250,7 +250,7 @@ namespace ImageSharp.Tests } private static void CopyToZYX(Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelAccessor pixels = image.Lock()) { @@ -272,7 +272,7 @@ namespace ImageSharp.Tests } private static void CopyToZYXW(Image image) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { using (PixelAccessor pixels = image.Lock()) { diff --git a/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs b/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs index c2f0aed84e..87b7ace6ae 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Tests /// Used as parameter for -based factory methods /// public class GenericFactory - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { public virtual Image CreateImage(int width, int height) { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs index c14f56588a..ad4d2cc986 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs @@ -8,7 +8,7 @@ namespace ImageSharp.Tests using System; public abstract partial class TestImageProvider - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private class BlankProvider : TestImageProvider { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs index 1b8c1498ef..cd403caed3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Tests using System.Collections.Concurrent; public abstract partial class TestImageProvider - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private class FileProvider : TestImageProvider { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs index c8bc705f1c..9addc8ca6c 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Tests /// /// The pixel format of the image public abstract partial class TestImageProvider - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private class LambdaProvider : TestImageProvider { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs index f7d3a0bf8d..855374f552 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Tests /// /// The pixel format of the image public abstract partial class TestImageProvider - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { private class SolidProvider : BlankProvider { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 911719afaf..cdb31ab69a 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Tests /// /// The pixel format of the image public abstract partial class TestImageProvider - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { public PixelTypes PixelType { get; private set; } = typeof(TColor).GetPixelType(); diff --git a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs index 8eb658073d..54be62d37d 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs @@ -76,7 +76,7 @@ namespace ImageSharp.Tests /// The requested extension /// Optional encoder public void SaveTestOutputFile(Image image, string extension = null, IImageEncoder encoder = null) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { string path = this.GetTestOutputFileName(extension); diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs index d2726c16a5..ca33402380 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs @@ -45,19 +45,10 @@ namespace ImageSharp.Tests PixelTypes2ClrTypes[PixelTypes.StandardImageClass] = typeof(Color); } - public static Type GetPackedType(Type pixelType) - { - var intrfcType = - pixelType.GetInterfaces() - .Single(i => i.IsConstructedGenericType && i.GetGenericTypeDefinition() == typeof(IPackedPixel<>)); - - return intrfcType.GetGenericArguments().Single(); - } - public static bool HasFlag(this PixelTypes pixelTypes, PixelTypes flag) => (pixelTypes & flag) == flag; public static bool IsEquivalentTo(this Image a, Image b, bool compareAlpha = true) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { if (a.Width != b.Width || a.Height != b.Height) { diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index 2f5ec6c28d..09c81b7610 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs @@ -22,7 +22,7 @@ namespace ImageSharp.Tests [Theory] [WithBlankImages(42, 666, PixelTypes.Color | PixelTypes.Argb | PixelTypes.HalfSingle, "hello")] public void Use_WithEmptyImageAttribute(TestImageProvider provider, string message) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var img = provider.GetImage(); @@ -36,7 +36,7 @@ namespace ImageSharp.Tests public void Use_WithBlankImagesAttribute_WithAllPixelTypes( TestImageProvider provider, string message) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var img = provider.GetImage(); @@ -50,7 +50,7 @@ namespace ImageSharp.Tests [WithBlankImages(1, 1, PixelTypes.Alpha8, PixelTypes.Alpha8)] [WithBlankImages(1, 1, PixelTypes.StandardImageClass, PixelTypes.StandardImageClass)] public void PixelType_PropertyValueIsCorrect(TestImageProvider provider, PixelTypes expected) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Assert.Equal(expected, provider.PixelType); } @@ -60,7 +60,7 @@ namespace ImageSharp.Tests [WithFile(TestImages.Bmp.F, PixelTypes.StandardImageClass)] public void PixelTypes_ColorWithDefaultImageClass_TriggersCreatingTheNonGenericDerivedImageClass( TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var img = provider.GetImage(); @@ -71,7 +71,7 @@ namespace ImageSharp.Tests [WithFile(TestImages.Bmp.Car, PixelTypes.All, 88)] [WithFile(TestImages.Bmp.F, PixelTypes.All, 88)] public void Use_WithFileAttribute(TestImageProvider provider, int yo) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Assert.NotNull(provider.Utility.SourceFileOrDescription); var img = provider.GetImage(); @@ -88,7 +88,7 @@ namespace ImageSharp.Tests [Theory] [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.Argb)] public void Use_WithFileCollection(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Assert.NotNull(provider.Utility.SourceFileOrDescription); var image = provider.GetImage(); @@ -98,7 +98,7 @@ namespace ImageSharp.Tests [Theory] [WithSolidFilledImages(10, 20, 255, 100, 50, 200, PixelTypes.Color | PixelTypes.Argb)] public void Use_WithSolidFilledImagesAttribute(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var img = provider.GetImage(); Assert.Equal(img.Width, 10); @@ -130,7 +130,7 @@ namespace ImageSharp.Tests /// /// public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { return factory.CreateImage(3, 3); } @@ -138,7 +138,7 @@ namespace ImageSharp.Tests [Theory] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.All)] public void Use_WithMemberFactoryAttribute(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var img = provider.GetImage(); Assert.Equal(img.Width, 3); @@ -160,7 +160,7 @@ namespace ImageSharp.Tests [Theory] [MemberData(nameof(BasicData))] public void Blank_MemberData(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var img = provider.GetImage(); @@ -178,7 +178,7 @@ namespace ImageSharp.Tests [Theory] [MemberData(nameof(FileData))] public void File_MemberData(TestImageProvider provider) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { this.Output.WriteLine("SRC: " + provider.Utility.SourceFileOrDescription); this.Output.WriteLine("OUT: " + provider.Utility.GetTestOutputFileName()); diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs index 23a42c1a68..1db209dcd3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs @@ -24,7 +24,7 @@ namespace ImageSharp.Tests private ITestOutputHelper Output { get; } public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { Image image = factory.CreateImage(10, 10); @@ -57,20 +57,12 @@ namespace ImageSharp.Tests var fake = typeof(Color).GetTypeInfo().Assembly.GetType("ImageSharp.dsaada_DASqewrr"); Assert.Null(fake); } - - [Fact] - public void GetPackedType() - { - Type shouldBeUIint32 = TestUtilityExtensions.GetPackedType(typeof(Color)); - - Assert.Equal(shouldBeUIint32, typeof(uint)); - } - + [Theory] [WithFile(TestImages.Bmp.Car, PixelTypes.Color, true)] [WithFile(TestImages.Bmp.Car, PixelTypes.Color, false)] public void IsEquivalentTo_WhenFalse(TestImageProvider provider, bool compareAlpha) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var a = provider.GetImage(); var b = provider.GetImage(); @@ -83,7 +75,7 @@ namespace ImageSharp.Tests [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.Bgr565, true)] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.Bgr565, false)] public void IsEquivalentTo_WhenTrue(TestImageProvider provider, bool compareAlpha) - where TColor : struct, IPackedPixel, IEquatable + where TColor : struct, IPixel { var a = provider.GetImage(); var b = provider.GetImage();