Browse Source

IPixel

pull/109/head
Anton Firszov 9 years ago
parent
commit
be4c189533
  1. 2
      global.json
  2. 12
      src/ImageSharp.Drawing.Paths/DrawBeziers.cs
  3. 12
      src/ImageSharp.Drawing.Paths/DrawLines.cs
  4. 12
      src/ImageSharp.Drawing.Paths/DrawPath.cs
  5. 12
      src/ImageSharp.Drawing.Paths/DrawPolygon.cs
  6. 12
      src/ImageSharp.Drawing.Paths/DrawRectangle.cs
  7. 8
      src/ImageSharp.Drawing.Paths/FillPaths.cs
  8. 8
      src/ImageSharp.Drawing.Paths/FillPolygon.cs
  9. 8
      src/ImageSharp.Drawing.Paths/FillRectangle.cs
  10. 2
      src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs
  11. 2
      src/ImageSharp.Drawing/Brushes/IBrush.cs
  12. 2
      src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs
  13. 2
      src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs
  14. 2
      src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs
  15. 2
      src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs
  16. 2
      src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs
  17. 4
      src/ImageSharp.Drawing/DrawImage.cs
  18. 12
      src/ImageSharp.Drawing/DrawPath.cs
  19. 12
      src/ImageSharp.Drawing/FillRegion.cs
  20. 2
      src/ImageSharp.Drawing/Pens/IPen.cs
  21. 2
      src/ImageSharp.Drawing/Pens/Pens{TColor}.cs
  22. 2
      src/ImageSharp.Drawing/Pens/Pen{TColor}.cs
  23. 2
      src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs
  24. 2
      src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs
  25. 2
      src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs
  26. 2
      src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs
  27. 2
      src/ImageSharp.Drawing/Processors/FillProcessor.cs
  28. 2
      src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs
  29. 2
      src/ImageSharp.Formats.Bmp/BmpDecoder.cs
  30. 10
      src/ImageSharp.Formats.Bmp/BmpDecoderCore.cs
  31. 2
      src/ImageSharp.Formats.Bmp/BmpEncoder.cs
  32. 8
      src/ImageSharp.Formats.Bmp/BmpEncoderCore.cs
  33. 2
      src/ImageSharp.Formats.Bmp/ImageExtensions.cs
  34. 2
      src/ImageSharp.Formats.Gif/GifDecoder.cs
  35. 2
      src/ImageSharp.Formats.Gif/GifDecoderCore.cs
  36. 2
      src/ImageSharp.Formats.Gif/GifEncoder.cs
  37. 18
      src/ImageSharp.Formats.Gif/GifEncoderCore.cs
  38. 2
      src/ImageSharp.Formats.Gif/ImageExtensions.cs
  39. 2
      src/ImageSharp.Formats.Jpeg/ImageExtensions.cs
  40. 2
      src/ImageSharp.Formats.Jpeg/JpegDecoder.cs
  41. 28
      src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs
  42. 2
      src/ImageSharp.Formats.Jpeg/JpegEncoder.cs
  43. 12
      src/ImageSharp.Formats.Jpeg/JpegEncoderCore.cs
  44. 6
      src/ImageSharp.Formats.Jpeg/Utils/JpegUtils.cs
  45. 2
      src/ImageSharp.Formats.Png/ImageExtensions.cs
  46. 2
      src/ImageSharp.Formats.Png/PngDecoder.cs
  47. 16
      src/ImageSharp.Formats.Png/PngDecoderCore.cs
  48. 2
      src/ImageSharp.Formats.Png/PngEncoder.cs
  49. 16
      src/ImageSharp.Formats.Png/PngEncoderCore.cs
  50. 4
      src/ImageSharp.Processing/Binarization/BinaryThreshold.cs
  51. 8
      src/ImageSharp.Processing/Binarization/Dither.cs
  52. 4
      src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs
  53. 4
      src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs
  54. 4
      src/ImageSharp.Processing/ColorMatrix/Grayscale.cs
  55. 4
      src/ImageSharp.Processing/ColorMatrix/Hue.cs
  56. 4
      src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs
  57. 4
      src/ImageSharp.Processing/ColorMatrix/Lomograph.cs
  58. 4
      src/ImageSharp.Processing/ColorMatrix/Polaroid.cs
  59. 4
      src/ImageSharp.Processing/ColorMatrix/Saturation.cs
  60. 4
      src/ImageSharp.Processing/ColorMatrix/Sepia.cs
  61. 4
      src/ImageSharp.Processing/Convolution/BoxBlur.cs
  62. 12
      src/ImageSharp.Processing/Convolution/DetectEdges.cs
  63. 4
      src/ImageSharp.Processing/Convolution/GaussianBlur.cs
  64. 4
      src/ImageSharp.Processing/Convolution/GaussianSharpen.cs
  65. 4
      src/ImageSharp.Processing/Effects/Alpha.cs
  66. 2
      src/ImageSharp.Processing/Effects/BackgroundColor.cs
  67. 4
      src/ImageSharp.Processing/Effects/Brightness.cs
  68. 4
      src/ImageSharp.Processing/Effects/Contrast.cs
  69. 4
      src/ImageSharp.Processing/Effects/Invert.cs
  70. 4
      src/ImageSharp.Processing/Effects/OilPainting.cs
  71. 4
      src/ImageSharp.Processing/Effects/Pixelate.cs
  72. 10
      src/ImageSharp.Processing/Overlays/Glow.cs
  73. 10
      src/ImageSharp.Processing/Overlays/Vignette.cs
  74. 2
      src/ImageSharp.Processing/Processors/Binarization/BinaryThresholdProcessor.cs
  75. 2
      src/ImageSharp.Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs
  76. 2
      src/ImageSharp.Processing/Processors/Binarization/OrderedDitherProcessor.cs
  77. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs
  78. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs
  79. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs
  80. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs
  81. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs
  82. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs
  83. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs
  84. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs
  85. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs
  86. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/ColorMatrixFilter.cs
  87. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs
  88. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs
  89. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/HueProcessor.cs
  90. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/IColorMatrixFilter.cs
  91. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/KodachromeProcessor.cs
  92. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/LomographProcessor.cs
  93. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/PolaroidProcessor.cs
  94. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/SaturationProcessor.cs
  95. 2
      src/ImageSharp.Processing/Processors/ColorMatrix/SepiaProcessor.cs
  96. 2
      src/ImageSharp.Processing/Processors/Convolution/BoxBlurProcessor.cs
  97. 2
      src/ImageSharp.Processing/Processors/Convolution/Convolution2DProcessor.cs
  98. 2
      src/ImageSharp.Processing/Processors/Convolution/Convolution2PassProcessor.cs
  99. 2
      src/ImageSharp.Processing/Processors/Convolution/ConvolutionProcessor.cs
  100. 2
      src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs

2
global.json

@ -1,6 +1,6 @@
{
"projects": [ "src" ],
"sdk": {
"version": "1.0.0-preview2-003121"
"version": "1.0.0-preview2-003131"
}
}

12
src/ImageSharp.Drawing.Paths/DrawBeziers.cs

@ -29,7 +29,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawBeziers<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), new Path(new BezierLineSegment(points)), options);
}
@ -44,7 +44,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawBeziers<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), new Path(new BezierLineSegment(points)));
}
@ -59,7 +59,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawBeziers<TColor>(this Image<TColor> source, TColor color, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.DrawBeziers(new SolidBrush<TColor>(color), thickness, points);
}
@ -75,7 +75,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawBeziers<TColor>(this Image<TColor> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.DrawBeziers(new SolidBrush<TColor>(color), thickness, points, options);
}
@ -90,7 +90,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawBeziers<TColor>(this Image<TColor> source, IPen<TColor> pen, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new Path(new BezierLineSegment(points)), options);
}
@ -104,7 +104,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawBeziers<TColor>(this Image<TColor> source, IPen<TColor> pen, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new Path(new BezierLineSegment(points)));
}

12
src/ImageSharp.Drawing.Paths/DrawLines.cs

@ -29,7 +29,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawLines<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), new Path(new LinearLineSegment(points)), options);
}
@ -44,7 +44,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawLines<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), new Path(new LinearLineSegment(points)));
}
@ -59,7 +59,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawLines<TColor>(this Image<TColor> source, TColor color, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.DrawLines(new SolidBrush<TColor>(color), thickness, points);
}
@ -75,7 +75,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>>
public static Image<TColor> DrawLines<TColor>(this Image<TColor> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.DrawLines(new SolidBrush<TColor>(color), thickness, points, options);
}
@ -90,7 +90,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawLines<TColor>(this Image<TColor> source, IPen<TColor> pen, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new Path(new LinearLineSegment(points)), options);
}
@ -104,7 +104,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawLines<TColor>(this Image<TColor> source, IPen<TColor> pen, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new Path(new LinearLineSegment(points)));
}

12
src/ImageSharp.Drawing.Paths/DrawPath.cs

@ -28,7 +28,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IPen<TColor> pen, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new ShapePath(path), options);
}
@ -42,7 +42,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IPen<TColor> pen, IPath path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, path, GraphicsOptions.Default);
}
@ -58,7 +58,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), path, options);
}
@ -73,7 +73,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, IPath path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), path);
}
@ -89,7 +89,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, TColor color, float thickness, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new SolidBrush<TColor>(color), thickness, path, options);
}
@ -104,7 +104,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, TColor color, float thickness, IPath path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new SolidBrush<TColor>(color), thickness, path);
}

12
src/ImageSharp.Drawing.Paths/DrawPolygon.cs

@ -29,7 +29,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawPolygon<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), new Polygon(new LinearLineSegment(points)), options);
}
@ -44,7 +44,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawPolygon<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), new Polygon(new LinearLineSegment(points)));
}
@ -59,7 +59,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawPolygon<TColor>(this Image<TColor> source, TColor color, float thickness, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.DrawPolygon(new SolidBrush<TColor>(color), thickness, points);
}
@ -75,7 +75,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawPolygon<TColor>(this Image<TColor> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.DrawPolygon(new SolidBrush<TColor>(color), thickness, points, options);
}
@ -89,7 +89,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawPolygon<TColor>(this Image<TColor> source, IPen<TColor> pen, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new Polygon(new LinearLineSegment(points)), GraphicsOptions.Default);
}
@ -104,7 +104,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawPolygon<TColor>(this Image<TColor> source, IPen<TColor> pen, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new Polygon(new LinearLineSegment(points)), options);
}

12
src/ImageSharp.Drawing.Paths/DrawRectangle.cs

@ -26,7 +26,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IPen<TColor> pen, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options);
}
@ -40,7 +40,7 @@ namespace ImageSharp
/// <param name="shape">The shape.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IPen<TColor> pen, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, shape, GraphicsOptions.Default);
}
@ -56,7 +56,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), shape, options);
}
@ -71,7 +71,7 @@ namespace ImageSharp
/// <param name="shape">The shape.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), shape);
}
@ -87,7 +87,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, TColor color, float thickness, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new SolidBrush<TColor>(color), thickness, shape, options);
}
@ -102,7 +102,7 @@ namespace ImageSharp
/// <param name="shape">The shape.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, TColor color, float thickness, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new SolidBrush<TColor>(color), thickness, shape);
}

8
src/ImageSharp.Drawing.Paths/FillPaths.cs

@ -27,7 +27,7 @@ namespace ImageSharp
/// <param name="options">The graphics options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, IBrush<TColor> brush, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(brush, new ShapeRegion(path), options);
}
@ -41,7 +41,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, IBrush<TColor> brush, IPath path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default);
}
@ -56,7 +56,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, TColor color, IPath path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), path, options);
}
@ -70,7 +70,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, TColor color, IPath path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), path);
}

8
src/ImageSharp.Drawing.Paths/FillPolygon.cs

@ -27,7 +27,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> FillPolygon<TColor>(this Image<TColor> source, IBrush<TColor> brush, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options);
}
@ -41,7 +41,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> FillPolygon<TColor>(this Image<TColor> source, IBrush<TColor> brush, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(brush, new Polygon(new LinearLineSegment(points)));
}
@ -56,7 +56,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> FillPolygon<TColor>(this Image<TColor> source, TColor color, Vector2[] points, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), new Polygon(new LinearLineSegment(points)), options);
}
@ -70,7 +70,7 @@ namespace ImageSharp
/// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> FillPolygon<TColor>(this Image<TColor> source, TColor color, Vector2[] points)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), new Polygon(new LinearLineSegment(points)));
}

8
src/ImageSharp.Drawing.Paths/FillRectangle.cs

@ -25,7 +25,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, IBrush<TColor> brush, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options);
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// <param name="shape">The shape.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, IBrush<TColor> brush, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height));
}
@ -54,7 +54,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, TColor color, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), shape, options);
}
@ -68,7 +68,7 @@ namespace ImageSharp
/// <param name="shape">The shape.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, TColor color, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), shape);
}

2
src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Drawing.Brushes
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <returns>A Brush</returns>
public class Brushes<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Percent10 Hatch Pattern

2
src/ImageSharp.Drawing/Brushes/IBrush.cs

@ -18,7 +18,7 @@ namespace ImageSharp.Drawing
/// logic for converting a pixel location to a <typeparamref name="TColor"/>.
/// </remarks>
public interface IBrush<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Creates the applicator for this brush.

2
src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs

@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class ImageBrush<TColor> : IBrush<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// The image to paint.

2
src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs

@ -42,7 +42,7 @@ namespace ImageSharp.Drawing.Brushes
/// </remarks>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class PatternBrush<TColor> : IBrush<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// The pattern.

2
src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Drawing.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <seealso cref="System.IDisposable" />
public abstract class BrushApplicator<TColor> : IDisposable // disposable will be required if/when there is an ImageBrush
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Gets the color for a single pixel.

2
src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs

@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class RecolorBrush<TColor> : IBrush<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="RecolorBrush{TColor}" /> class.

2
src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs

@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class SolidBrush<TColor> : IBrush<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// The color to paint.

4
src/ImageSharp.Drawing/DrawImage.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 100.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Blend<TColor>(this Image<TColor> source, Image<TColor> image, int percent = 50)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return DrawImage(source, image, percent, default(Size), default(Point));
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// <param name="location">The location to draw the blended image.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DrawImage<TColor>(this Image<TColor> source, Image<TColor> image, int percent, Size size, Point location)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
if (size == default(Size))
{

12
src/ImageSharp.Drawing/DrawPath.cs

@ -27,7 +27,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IPen<TColor> pen, Drawable path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Apply(new DrawPathProcessor<TColor>(pen, path, options));
}
@ -41,7 +41,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IPen<TColor> pen, Drawable path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(pen, path, GraphicsOptions.Default);
}
@ -57,7 +57,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Drawable path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), path, options);
}
@ -72,7 +72,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, IBrush<TColor> brush, float thickness, Drawable path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new Pen<TColor>(brush, thickness), path);
}
@ -88,7 +88,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, TColor color, float thickness, Drawable path, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new SolidBrush<TColor>(color), thickness, path, options);
}
@ -103,7 +103,7 @@ namespace ImageSharp
/// <param name="path">The path.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Draw<TColor>(this Image<TColor> source, TColor color, float thickness, Drawable path)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Draw(new SolidBrush<TColor>(color), thickness, path);
}

12
src/ImageSharp.Drawing/FillRegion.cs

@ -24,7 +24,7 @@ namespace ImageSharp
/// <param name="brush">The details how to fill the region of interest.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, IBrush<TColor> brush)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Apply(new FillProcessor<TColor>(brush));
}
@ -37,7 +37,7 @@ namespace ImageSharp
/// <param name="color">The color.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, TColor color)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color));
}
@ -52,7 +52,7 @@ namespace ImageSharp
/// <param name="options">The graphics options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, IBrush<TColor> brush, Region region, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Apply(new FillRegionProcessor<TColor>(brush, region, options));
}
@ -66,7 +66,7 @@ namespace ImageSharp
/// <param name="region">The region.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, IBrush<TColor> brush, Region region)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(brush, region, GraphicsOptions.Default);
}
@ -81,7 +81,7 @@ namespace ImageSharp
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, TColor color, Region region, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), region, options);
}
@ -95,7 +95,7 @@ namespace ImageSharp
/// <param name="region">The region.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Fill<TColor>(this Image<TColor> source, TColor color, Region region)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return source.Fill(new SolidBrush<TColor>(color), region);
}

2
src/ImageSharp.Drawing/Pens/IPen.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Drawing.Pens
/// </summary>
/// <typeparam name="TColor">The type of the color.</typeparam>
public interface IPen<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Creates the applicator for applying this pen to an Image

2
src/ImageSharp.Drawing/Pens/Pens{TColor}.cs

@ -12,7 +12,7 @@ namespace ImageSharp.Drawing.Pens
/// </summary>
/// <typeparam name="TColor">The type of the color.</typeparam>
public class Pens<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f };
private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f };

2
src/ImageSharp.Drawing/Pens/Pen{TColor}.cs

@ -24,7 +24,7 @@ namespace ImageSharp.Drawing.Pens
/// the the pattern will imidiatly repeat without gap.
/// </remarks>
public class Pen<TColor> : IPen<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
private static readonly float[] EmptyPattern = new float[0];
private readonly float[] pattern;

2
src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs

@ -12,7 +12,7 @@ namespace ImageSharp.Drawing.Processors
/// </summary>
/// <typeparam name="TColor">The type of the color.</typeparam>
public struct ColoredPointInfo<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// The color

2
src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Drawing.Processors
/// </summary>
/// <typeparam name="TColor">The type of the color.</typeparam>
public abstract class PenApplicator<TColor> : IDisposable
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Gets the required region.

2
src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs

@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class DrawImageProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="DrawImageProcessor{TColor}"/> class.

2
src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs

@ -18,7 +18,7 @@ namespace ImageSharp.Drawing.Processors
/// <typeparam name="TColor">The type of the color.</typeparam>
/// <seealso cref="ImageSharp.Processing.ImageProcessor{TColor}" />
public class DrawPathProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
private const float AntialiasFactor = 1f;
private const int PaddingFactor = 1; // needs to been the same or greater than AntialiasFactor

2
src/ImageSharp.Drawing/Processors/FillProcessor.cs

@ -17,7 +17,7 @@ namespace ImageSharp.Drawing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class FillProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// The brush.

2
src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs

@ -18,7 +18,7 @@ namespace ImageSharp.Drawing.Processors
/// <typeparam name="TColor">The type of the color.</typeparam>
/// <seealso cref="ImageSharp.Processing.ImageProcessor{TColor}" />
public class FillRegionProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
private const float AntialiasFactor = 1f;
private const int DrawPadding = 1;

2
src/ImageSharp.Formats.Bmp/BmpDecoder.cs

@ -27,7 +27,7 @@ namespace ImageSharp.Formats
{
/// <inheritdoc/>
public void Decode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Guard.NotNull(image, "image");
Guard.NotNull(stream, "stream");

10
src/ImageSharp.Formats.Bmp/BmpDecoderCore.cs

@ -58,7 +58,7 @@ namespace ImageSharp.Formats
/// <para><paramref name="stream"/> is null.</para>
/// </exception>
public void Decode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
this.currentStream = stream;
@ -212,7 +212,7 @@ namespace ImageSharp.Formats
/// <param name="bits">The number of bits per pixel.</param>
/// <param name="inverted">Whether the bitmap is inverted.</param>
private void ReadRgbPalette<TColor>(PixelAccessor<TColor> pixels, byte[] colors, int width, int height, int bits, bool inverted)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// Pixels per byte (bits per pixel)
int ppb = 8 / bits;
@ -267,7 +267,7 @@ namespace ImageSharp.Formats
/// <param name="height">The height of the bitmap.</param>
/// <param name="inverted">Whether the bitmap is inverted.</param>
private void ReadRgb16<TColor>(PixelAccessor<TColor> pixels, int width, int height, bool inverted)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// 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
/// <param name="height">The height of the bitmap.</param>
/// <param name="inverted">Whether the bitmap is inverted.</param>
private void ReadRgb24<TColor>(PixelAccessor<TColor> pixels, int width, int height, bool inverted)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int padding = CalculatePadding(width, 3);
using (PixelArea<TColor> row = new PixelArea<TColor>(width, ComponentOrder.Zyx, padding))
@ -333,7 +333,7 @@ namespace ImageSharp.Formats
/// <param name="height">The height of the bitmap.</param>
/// <param name="inverted">Whether the bitmap is inverted.</param>
private void ReadRgb32<TColor>(PixelAccessor<TColor> pixels, int width, int height, bool inverted)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int padding = CalculatePadding(width, 4);
using (PixelArea<TColor> row = new PixelArea<TColor>(width, ComponentOrder.Zyxw, padding))

2
src/ImageSharp.Formats.Bmp/BmpEncoder.cs

@ -21,7 +21,7 @@ namespace ImageSharp.Formats
/// <inheritdoc/>
public void Encode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
BmpEncoderCore encoder = new BmpEncoderCore();
encoder.Encode(image, stream, this.BitsPerPixel);

8
src/ImageSharp.Formats.Bmp/BmpEncoderCore.cs

@ -33,7 +33,7 @@ namespace ImageSharp.Formats
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
/// <param name="bitsPerPixel">The <see cref="BmpBitsPerPixel"/></param>
public void Encode<TColor>(ImageBase<TColor> image, Stream stream, BmpBitsPerPixel bitsPerPixel)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Guard.NotNull(image, nameof(image));
Guard.NotNull(stream, nameof(stream));
@ -124,7 +124,7 @@ namespace ImageSharp.Formats
/// The <see cref="ImageBase{TColor}"/> containing pixel data.
/// </param>
private void WriteImage<TColor>(EndianBinaryWriter writer, ImageBase<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
using (PixelAccessor<TColor> pixels = image.Lock())
{
@ -148,7 +148,7 @@ namespace ImageSharp.Formats
/// <param name="writer">The <see cref="EndianBinaryWriter"/> containing the stream to write to.</param>
/// <param name="pixels">The <see cref="PixelAccessor{TColor}"/> containing pixel data.</param>
private void Write32Bit<TColor>(EndianBinaryWriter writer, PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
using (PixelArea<TColor> row = new PixelArea<TColor>(pixels.Width, ComponentOrder.Zyxw, this.padding))
{
@ -167,7 +167,7 @@ namespace ImageSharp.Formats
/// <param name="writer">The <see cref="EndianBinaryWriter"/> containing the stream to write to.</param>
/// <param name="pixels">The <see cref="PixelAccessor{TColor}"/> containing pixel data.</param>
private void Write24Bit<TColor>(EndianBinaryWriter writer, PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
using (PixelArea<TColor> row = new PixelArea<TColor>(pixels.Width, ComponentOrder.Zyx, this.padding))
{

2
src/ImageSharp.Formats.Bmp/ImageExtensions.cs

@ -26,7 +26,7 @@ namespace ImageSharp
/// The <see cref="Image{TColoR}"/>.
/// </returns>
public static Image<TColor> SaveAsBmp<TColor>(this Image<TColor> source, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
=> source.Save(stream, new BmpEncoder());
}
}

2
src/ImageSharp.Formats.Gif/GifDecoder.cs

@ -15,7 +15,7 @@ namespace ImageSharp.Formats
{
/// <inheritdoc/>
public void Decode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
new GifDecoderCore<TColor>().Decode(image, stream);
}

2
src/ImageSharp.Formats.Gif/GifDecoderCore.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Formats
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
internal class GifDecoderCore<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// The temp buffer used to reduce allocations.

2
src/ImageSharp.Formats.Gif/GifEncoder.cs

@ -33,7 +33,7 @@ namespace ImageSharp.Formats
/// <inheritdoc/>
public void Encode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
GifEncoderCore encoder = new GifEncoderCore
{

18
src/ImageSharp.Formats.Gif/GifEncoderCore.cs

@ -51,7 +51,7 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="Image{TColor}"/> to encode from.</param>
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
public void Encode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Guard.NotNull(image, nameof(image));
Guard.NotNull(stream, nameof(stream));
@ -121,7 +121,7 @@ namespace ImageSharp.Formats
/// The <see cref="int"/>.
/// </returns>
private int GetTransparentIndex<TColor>(QuantizedImage<TColor> quantized)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// Find the lowest alpha value and make it the transparent index.
int index = 255;
@ -171,7 +171,7 @@ namespace ImageSharp.Formats
/// <param name="writer">The writer to write to the stream with.</param>
/// <param name="tranparencyIndex">The transparency index to set the default background index to.</param>
private void WriteLogicalScreenDescriptor<TColor>(Image<TColor> image, EndianBinaryWriter writer, int tranparencyIndex)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
GifLogicalScreenDescriptor descriptor = new GifLogicalScreenDescriptor
{
@ -237,7 +237,7 @@ namespace ImageSharp.Formats
/// <param name="writer">The stream to write to.</param>
/// <param name="transparencyIndex">The index of the color in the color palette to make transparent.</param>
private void WriteGraphicalControlExtension<TColor>(Image<TColor> image, EndianBinaryWriter writer, int transparencyIndex)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
this.WriteGraphicalControlExtension(image, image.MetaData, writer, transparencyIndex);
}
@ -250,7 +250,7 @@ namespace ImageSharp.Formats
/// <param name="writer">The stream to write to.</param>
/// <param name="transparencyIndex">The index of the color in the color palette to make transparent.</param>
private void WriteGraphicalControlExtension<TColor>(ImageFrame<TColor> imageFrame, EndianBinaryWriter writer, int transparencyIndex)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
this.WriteGraphicalControlExtension(imageFrame, imageFrame.MetaData, writer, transparencyIndex);
}
@ -264,7 +264,7 @@ namespace ImageSharp.Formats
/// <param name="writer">The stream to write to.</param>
/// <param name="transparencyIndex">The index of the color in the color palette to make transparent.</param>
private void WriteGraphicalControlExtension<TColor>(ImageBase<TColor> image, IMetaData metaData, EndianBinaryWriter writer, int transparencyIndex)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// TODO: Check transparency logic.
bool hasTransparent = transparencyIndex < 255;
@ -306,7 +306,7 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="ImageBase{TColor}"/> to be encoded.</param>
/// <param name="writer">The stream to write to.</param>
private void WriteImageDescriptor<TColor>(ImageBase<TColor> image, EndianBinaryWriter writer)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
writer.Write(GifConstants.ImageDescriptorLabel); // 2c
@ -332,7 +332,7 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="ImageBase{TColor}"/> to encode.</param>
/// <param name="writer">The writer to write to the stream with.</param>
private void WriteColorTable<TColor>(QuantizedImage<TColor> image, EndianBinaryWriter writer)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// Grab the palette and write it to the stream.
int pixelCount = image.Palette.Length;
@ -367,7 +367,7 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="QuantizedImage{TColor}"/> containing indexed pixels.</param>
/// <param name="writer">The stream to write to.</param>
private void WriteImageData<TColor>(QuantizedImage<TColor> image, EndianBinaryWriter writer)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
using (LzwEncoder encoder = new LzwEncoder(image.Pixels, (byte)this.bitDepth))
{

2
src/ImageSharp.Formats.Gif/ImageExtensions.cs

@ -27,7 +27,7 @@ namespace ImageSharp
/// The <see cref="Image{TColor}"/>.
/// </returns>
public static Image<TColor> SaveAsGif<TColor>(this Image<TColor> source, Stream stream, int quality = 256)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
=> source.Save(stream, new GifEncoder { Quality = quality });
}
}

2
src/ImageSharp.Formats.Jpeg/ImageExtensions.cs

@ -27,7 +27,7 @@ namespace ImageSharp
/// The <see cref="Image{TColor}"/>.
/// </returns>
public static Image<TColor> SaveAsJpeg<TColor>(this Image<TColor> source, Stream stream, int quality = 75)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
=> source.Save(stream, new JpegEncoder { Quality = quality });
}
}

2
src/ImageSharp.Formats.Jpeg/JpegDecoder.cs

@ -15,7 +15,7 @@ namespace ImageSharp.Formats
{
/// <inheritdoc/>
public void Decode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Guard.NotNull(image, "image");
Guard.NotNull(stream, "stream");

28
src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs

@ -177,7 +177,7 @@ namespace ImageSharp.Formats
/// <param name="stream">The stream, where the image should be.</param>
/// <param name="metadataOnly">Whether to decode metadata only.</param>
public void Decode<TColor>(Image<TColor> image, Stream stream, bool metadataOnly)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
this.ProcessStream(image, stream, metadataOnly);
if (!metadataOnly)
@ -248,7 +248,7 @@ namespace ImageSharp.Formats
/// <param name="cr">The cr chroma component.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void PackYcbCr<TColor>(ref TColor packed, byte y, byte cb, byte cr)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int ccb = cb - 128;
int ccr = cr - 128;
@ -274,7 +274,7 @@ namespace ImageSharp.Formats
/// <param name="stream">The stream</param>
/// <param name="metadataOnly">Whether to decode metadata only.</param>
private void ProcessStream<TColor>(Image<TColor> image, Stream stream, bool metadataOnly)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
this.InputStream = stream;
this.InputProcessor = new InputProcessor(stream, this.Temp);
@ -472,7 +472,7 @@ namespace ImageSharp.Formats
/// </summary>
/// <typeparam name="TColor">The pixel type</typeparam>
private void ProcessBlocksIntoJpegImageChannels<TColor>()
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Parallel.For(
0,
@ -491,7 +491,7 @@ namespace ImageSharp.Formats
/// <typeparam name="TColor">The pixel type</typeparam>
/// <param name="image">The destination image</param>
private void ConvertJpegPixelsToImagePixels<TColor>(Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
if (this.grayImage.IsInitialized)
{
@ -549,7 +549,7 @@ namespace ImageSharp.Formats
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="image">The image to assign the resolution to.</param>
private void AssignResolution<TColor>(Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
if (this.isJfif && this.horizontalResolution > 0 && this.verticalResolution > 0)
{
@ -579,7 +579,7 @@ namespace ImageSharp.Formats
/// <param name="height">The image height.</param>
/// <param name="image">The image.</param>
private void ConvertFromCmyk<TColor>(int width, int height, Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor;
@ -620,7 +620,7 @@ namespace ImageSharp.Formats
/// <param name="height">The image height.</param>
/// <param name="image">The image.</param>
private void ConvertFromGrayScale<TColor>(int width, int height, Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
image.InitPixels(width, height);
@ -655,7 +655,7 @@ namespace ImageSharp.Formats
/// <param name="height">The height.</param>
/// <param name="image">The image.</param>
private void ConvertFromRGB<TColor>(int width, int height, Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor;
image.InitPixels(width, height);
@ -696,7 +696,7 @@ namespace ImageSharp.Formats
/// <param name="height">The image height.</param>
/// <param name="image">The image.</param>
private void ConvertFromYCbCr<TColor>(int width, int height, Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor;
image.InitPixels(width, height);
@ -737,7 +737,7 @@ namespace ImageSharp.Formats
/// <param name="height">The image height.</param>
/// <param name="image">The image.</param>
private void ConvertFromYcck<TColor>(int width, int height, Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor;
@ -862,7 +862,7 @@ namespace ImageSharp.Formats
/// <param name="xx">The x-position within the image.</param>
/// <param name="yy">The y-position within the image.</param>
private void PackCmyk<TColor>(ref TColor packed, byte c, byte m, byte y, int xx, int yy)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// Get keyline
float keyline = (255 - this.blackImage[xx, yy]) / 255F;
@ -887,7 +887,7 @@ namespace ImageSharp.Formats
/// <param name="xx">The x-position within the image.</param>
/// <param name="yy">The y-position within the image.</param>
private void PackYcck<TColor>(ref TColor packed, byte y, byte cb, byte cr, int xx, int yy)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// 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
/// <param name="remaining">The remaining bytes in the segment block.</param>
/// <param name="image">The image.</param>
private void ProcessApp1Marker<TColor>(int remaining, Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
if (remaining < 6)
{

2
src/ImageSharp.Formats.Jpeg/JpegEncoder.cs

@ -62,7 +62,7 @@ namespace ImageSharp.Formats
/// <inheritdoc/>
public void Encode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// Ensure that quality can be set but has a fallback.
if (image.MetaData.Quality > 0)

12
src/ImageSharp.Formats.Jpeg/JpegEncoderCore.cs

@ -157,7 +157,7 @@ namespace ImageSharp.Formats
/// <param name="quality">The quality.</param>
/// <param name="sample">The subsampling mode.</param>
public void Encode<TColor>(Image<TColor> image, Stream stream, int quality, JpegSubsample sample)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Guard.NotNull(image, nameof(image));
Guard.NotNull(stream, nameof(stream));
@ -287,7 +287,7 @@ namespace ImageSharp.Formats
Block8x8F* cbBlock,
Block8x8F* crBlock,
PixelArea<TColor> rgbBytes)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
float* yBlockRaw = (float*)yBlock;
float* cbBlockRaw = (float*)cbBlock;
@ -433,7 +433,7 @@ namespace ImageSharp.Formats
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="pixels">The pixel accessor providing access to the image pixels.</param>
private void Encode444<TColor>(PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// TODO: Need a JpegScanEncoder<TColor> class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.)
Block8x8F b = default(Block8x8F);
@ -704,7 +704,7 @@ namespace ImageSharp.Formats
/// <param name="image">The image.</param>
/// <typeparam name="TColor">The pixel format.</typeparam>
private void WriteProfiles<TColor>(Image<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
image.MetaData.SyncProfiles();
this.WriteProfile(image.MetaData.ExifProfile);
@ -772,7 +772,7 @@ namespace ImageSharp.Formats
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="pixels">The pixel accessor providing access to the image pixels.</param>
private void WriteStartOfScan<TColor>(PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// TODO: Need a JpegScanEncoder<TColor> 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
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="pixels">The pixel accessor providing access to the image pixels.</param>
private void Encode420<TColor>(PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// TODO: Need a JpegScanEncoder<TColor> class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.)
Block8x8F b = default(Block8x8F);

6
src/ImageSharp.Formats.Jpeg/Utils/JpegUtils.cs

@ -25,7 +25,7 @@ namespace ImageSharp.Formats.Jpg
PixelArea<TColor> dest,
int sourceY,
int sourceX)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
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<TColor>(PixelArea<TColor> area, int fromX, int fromY)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return fromX <= 0 || fromY <= 0 || fromX >= area.Width || fromY >= area.Height;
}
private static void StretchPixels<TColor>(PixelArea<TColor> area, int fromX, int fromY)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
if (IsInvalidStretchStartingPosition(area, fromX, fromY))
{

2
src/ImageSharp.Formats.Png/ImageExtensions.cs

@ -29,7 +29,7 @@ namespace ImageSharp
/// The <see cref="Image{TColor}"/>.
/// </returns>
public static Image<TColor> SaveAsPng<TColor>(this Image<TColor> source, Stream stream, int quality = int.MaxValue)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
=> source.Save(stream, new PngEncoder { Quality = quality });
}
}

2
src/ImageSharp.Formats.Png/PngDecoder.cs

@ -37,7 +37,7 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="ImageBase{TColor}"/> to decode to.</param>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
public void Decode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
new PngDecoderCore().Decode(image, stream);
}

16
src/ImageSharp.Formats.Png/PngDecoderCore.cs

@ -138,7 +138,7 @@ namespace ImageSharp.Formats
/// Thrown if the image is larger than the maximum allowable size.
/// </exception>
public void Decode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Image<TColor> currentImage = image;
this.currentStream = stream;
@ -262,7 +262,7 @@ namespace ImageSharp.Formats
/// <param name="image">The image to read to.</param>
/// <param name="data">The data containing physical data.</param>
private void ReadPhysicalChunk<TColor>(Image<TColor> image, byte[] data)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
data.ReverseBytes(0, 4);
data.ReverseBytes(4, 4);
@ -325,7 +325,7 @@ namespace ImageSharp.Formats
/// <param name="dataStream">The <see cref="MemoryStream"/> containing data.</param>
/// <param name="pixels"> The pixel data.</param>
private void ReadScanlines<TColor>(MemoryStream dataStream, PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
this.bytesPerPixel = this.CalculateBytesPerPixel();
this.bytesPerScanline = this.CalculateScanlineLength(this.header.Width) + 1;
@ -356,7 +356,7 @@ namespace ImageSharp.Formats
/// <param name="compressedStream">The compressed pixel data stream.</param>
/// <param name="pixels">The image pixel accessor.</param>
private void DecodePixelData<TColor>(Stream compressedStream, PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
byte[] previousScanline = ArrayPool<byte>.Shared.Rent(this.bytesPerScanline);
byte[] scanline = ArrayPool<byte>.Shared.Rent(this.bytesPerScanline);
@ -429,7 +429,7 @@ namespace ImageSharp.Formats
/// <param name="compressedStream">The compressed pixel data stream.</param>
/// <param name="pixels">The image pixel accessor.</param>
private void DecodeInterlacedPixelData<TColor>(Stream compressedStream, PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
byte[] previousScanline = ArrayPool<byte>.Shared.Rent(this.bytesPerScanline);
byte[] scanline = ArrayPool<byte>.Shared.Rent(this.bytesPerScanline);
@ -518,7 +518,7 @@ namespace ImageSharp.Formats
/// <param name="row">The current image row.</param>
/// <param name="pixels">The image pixels</param>
private void ProcessDefilteredScanline<TColor>(byte[] defilteredScanline, int row, PixelAccessor<TColor> pixels)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
TColor color = default(TColor);
switch (this.PngColorType)
@ -643,7 +643,7 @@ namespace ImageSharp.Formats
/// <param name="pixelOffset">The column start index. Always 0 for none interlaced images.</param>
/// <param name="increment">The column increment. Always 1 for none interlaced images.</param>
private void ProcessInterlacedDefilteredScanline<TColor>(byte[] defilteredScanline, int row, PixelAccessor<TColor> pixels, int pixelOffset = 0, int increment = 1)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
TColor color = default(TColor);
@ -761,7 +761,7 @@ namespace ImageSharp.Formats
/// <param name="data">The <see cref="T:byte[]"/> containing data.</param>
/// <param name="length">The maximum length to read.</param>
private void ReadTextChunk<TColor>(Image<TColor> image, byte[] data, int length)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int zeroIndex = 0;

2
src/ImageSharp.Formats.Png/PngEncoder.cs

@ -57,7 +57,7 @@ namespace ImageSharp.Formats
/// <inheritdoc/>
public void Encode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
PngEncoderCore encoder = new PngEncoderCore
{

16
src/ImageSharp.Formats.Png/PngEncoderCore.cs

@ -132,7 +132,7 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="ImageBase{TColor}"/> to encode from.</param>
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
public void Encode<TColor>(Image<TColor> image, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Guard.NotNull(image, nameof(image));
Guard.NotNull(stream, nameof(stream));
@ -262,7 +262,7 @@ namespace ImageSharp.Formats
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <param name="header">The <see cref="PngHeader"/>.</param>
private void CollectIndexedBytes<TColor>(ImageBase<TColor> image, Stream stream, PngHeader header)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// Quantize the image and get the pixels.
QuantizedImage<TColor> quantized = this.WritePaletteChunk(stream, header, image);
@ -277,7 +277,7 @@ namespace ImageSharp.Formats
/// <param name="row">The row index.</param>
/// <param name="rawScanline">The raw scanline.</param>
private void CollectGrayscaleBytes<TColor>(PixelAccessor<TColor> pixels, int row, byte[] rawScanline)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// Copy the pixels across from the image.
// Reuse the chunk type buffer.
@ -311,7 +311,7 @@ namespace ImageSharp.Formats
/// <param name="row">The row index.</param>
/// <param name="rawScanline">The raw scanline.</param>
private void CollectColorBytes<TColor>(PixelAccessor<TColor> pixels, int row, byte[] rawScanline)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
// We can use the optimized PixelAccessor here and copy the bytes in unmanaged memory.
using (PixelArea<TColor> pixelRow = new PixelArea<TColor>(this.width, rawScanline, this.bytesPerPixel == 4 ? ComponentOrder.Xyzw : ComponentOrder.Xyz))
@ -332,7 +332,7 @@ namespace ImageSharp.Formats
/// <param name="result">The filtered scanline result.</param>
/// <returns>The <see cref="T:byte[]"/></returns>
private byte[] EncodePixelRow<TColor>(PixelAccessor<TColor> pixels, int row, byte[] previousScanline, byte[] rawScanline, byte[] result)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
switch (this.PngColorType)
{
@ -486,7 +486,7 @@ namespace ImageSharp.Formats
/// <param name="image">The image to encode.</param>
/// <returns>The <see cref="QuantizedImage{TColor}"/></returns>
private QuantizedImage<TColor> WritePaletteChunk<TColor>(Stream stream, PngHeader header, ImageBase<TColor> image)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
if (this.Quality > 256)
{
@ -554,7 +554,7 @@ namespace ImageSharp.Formats
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <param name="imageBase">The image base.</param>
private void WritePhysicalChunk<TColor>(Stream stream, ImageBase<TColor> imageBase)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Image<TColor> image = imageBase as Image<TColor>;
if (image != null && image.MetaData.HorizontalResolution > 0 && image.MetaData.VerticalResolution > 0)
@ -600,7 +600,7 @@ namespace ImageSharp.Formats
/// <param name="pixels">The pixel accessor.</param>
/// <param name="stream">The stream.</param>
private void WriteDataChunks<TColor>(PixelAccessor<TColor> pixels, Stream stream)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
int bytesPerScanline = this.width * this.bytesPerPixel;
byte[] previousScanline = new byte[bytesPerScanline];

4
src/ImageSharp.Processing/Binarization/BinaryThreshold.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> BinaryThreshold<TColor>(this Image<TColor> source, float threshold)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return BinaryThreshold(source, threshold, source.Bounds);
}
@ -38,7 +38,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> BinaryThreshold<TColor>(this Image<TColor> source, float threshold, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new BinaryThresholdProcessor<TColor>(threshold), rectangle);
return source;

8
src/ImageSharp.Processing/Binarization/Dither.cs

@ -24,7 +24,7 @@ namespace ImageSharp
/// <param name="index">The component index to test the threshold against. Must range from 0 to 3.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Dither<TColor>(this Image<TColor> source, IOrderedDither dither, int index = 0)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Dither(source, dither, source.Bounds, index);
}
@ -41,7 +41,7 @@ namespace ImageSharp
/// <param name="index">The component index to test the threshold against. Must range from 0 to 3.</param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor> Dither<TColor>(this Image<TColor> source, IOrderedDither dither, Rectangle rectangle, int index = 0)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new OrderedDitherProcessor<TColor>(dither, index), rectangle);
return source;
@ -56,7 +56,7 @@ namespace ImageSharp
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Dither<TColor>(this Image<TColor> source, IErrorDiffuser diffuser, float threshold)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Dither(source, diffuser, threshold, source.Bounds);
}
@ -73,7 +73,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor> Dither<TColor>(this Image<TColor> source, IErrorDiffuser diffuser, float threshold, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new ErrorDiffusionDitherProcessor<TColor>(diffuser, threshold), rectangle);
return source;

4
src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> BlackWhite<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return BlackWhite(source, source.Bounds);
}
@ -37,7 +37,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> BlackWhite<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new BlackWhiteProcessor<TColor>(), rectangle);
return source;

4
src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="colorBlindness">The type of color blindness simulator to apply.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> ColorBlindness<TColor>(this Image<TColor> source, ColorBlindness colorBlindness)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return ColorBlindness(source, colorBlindness, source.Bounds);
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> ColorBlindness<TColor>(this Image<TColor> source, ColorBlindness colorBlindness, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
IImageProcessor<TColor> processor;

4
src/ImageSharp.Processing/ColorMatrix/Grayscale.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Grayscale<TColor>(this Image<TColor> source, GrayscaleMode mode = GrayscaleMode.Bt709)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Grayscale(source, source.Bounds, mode);
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Grayscale<TColor>(this Image<TColor> source, Rectangle rectangle, GrayscaleMode mode = GrayscaleMode.Bt709)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
IImageProcessor<TColor> processor = mode == GrayscaleMode.Bt709
? (IImageProcessor<TColor>)new GrayscaleBt709Processor<TColor>()

4
src/ImageSharp.Processing/ColorMatrix/Hue.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="degrees">The angle in degrees to adjust the image.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Hue<TColor>(this Image<TColor> source, float degrees)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Hue(source, degrees, source.Bounds);
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Hue<TColor>(this Image<TColor> source, float degrees, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new HueProcessor<TColor>(degrees), rectangle);
return source;

4
src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Kodachrome<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Kodachrome(source, source.Bounds);
}
@ -37,7 +37,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Kodachrome<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new KodachromeProcessor<TColor>(), rectangle);
return source;

4
src/ImageSharp.Processing/ColorMatrix/Lomograph.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Lomograph<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Lomograph(source, source.Bounds);
}
@ -37,7 +37,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Lomograph<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new LomographProcessor<TColor>(), rectangle);
return source;

4
src/ImageSharp.Processing/ColorMatrix/Polaroid.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Polaroid<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Polaroid(source, source.Bounds);
}
@ -37,7 +37,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Polaroid<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new PolaroidProcessor<TColor>(), rectangle);
return source;

4
src/ImageSharp.Processing/ColorMatrix/Saturation.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="amount">The new saturation of the image. Must be between -100 and 100.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Saturation<TColor>(this Image<TColor> source, int amount)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Saturation(source, amount, source.Bounds);
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Saturation<TColor>(this Image<TColor> source, int amount, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new SaturationProcessor<TColor>(amount), rectangle);
return source;

4
src/ImageSharp.Processing/ColorMatrix/Sepia.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor> Sepia<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Sepia(source, source.Bounds);
}
@ -37,7 +37,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor> Sepia<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new SepiaProcessor<TColor>(), rectangle);
return source;

4
src/ImageSharp.Processing/Convolution/BoxBlur.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> BoxBlur<TColor>(this Image<TColor> source, int radius = 7)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return BoxBlur(source, radius, source.Bounds);
}
@ -38,7 +38,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> BoxBlur<TColor>(this Image<TColor> source, int radius, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new BoxBlurProcessor<TColor>(radius), rectangle);
return source;

12
src/ImageSharp.Processing/Convolution/DetectEdges.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DetectEdges<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return DetectEdges(source, source.Bounds, new SobelProcessor<TColor> { Grayscale = true });
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DetectEdges<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return DetectEdges(source, rectangle, new SobelProcessor<TColor> { Grayscale = true });
}
@ -53,7 +53,7 @@ namespace ImageSharp
/// <param name="grayscale">Whether to convert the image to Grayscale first. Defaults to true.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DetectEdges<TColor>(this Image<TColor> source, EdgeDetection filter, bool grayscale = true)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return DetectEdges(source, filter, source.Bounds, grayscale);
}
@ -70,7 +70,7 @@ namespace ImageSharp
/// <param name="grayscale">Whether to convert the image to Grayscale first. Defaults to true.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DetectEdges<TColor>(this Image<TColor> source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
IEdgeDetectorProcessor<TColor> processor;
@ -128,7 +128,7 @@ namespace ImageSharp
/// <param name="filter">The filter for detecting edges.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DetectEdges<TColor>(this Image<TColor> source, IEdgeDetectorProcessor<TColor> filter)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return DetectEdges(source, source.Bounds, filter);
}
@ -144,7 +144,7 @@ namespace ImageSharp
/// <param name="filter">The filter for detecting edges.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> DetectEdges<TColor>(this Image<TColor> source, Rectangle rectangle, IEdgeDetectorProcessor<TColor> filter)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(filter, rectangle);
return source;

4
src/ImageSharp.Processing/Convolution/GaussianBlur.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> GaussianBlur<TColor>(this Image<TColor> source, float sigma = 3f)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return GaussianBlur(source, sigma, source.Bounds);
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> GaussianBlur<TColor>(this Image<TColor> source, float sigma, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new GaussianBlurProcessor<TColor>(sigma), rectangle);
return source;

4
src/ImageSharp.Processing/Convolution/GaussianSharpen.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> GaussianSharpen<TColor>(this Image<TColor> source, float sigma = 3f)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return GaussianSharpen(source, sigma, source.Bounds);
}
@ -39,7 +39,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> GaussianSharpen<TColor>(this Image<TColor> source, float sigma, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new GaussianSharpenProcessor<TColor>(sigma), rectangle);
return source;

4
src/ImageSharp.Processing/Effects/Alpha.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="percent">The new opacity of the image. Must be between 0 and 100.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Alpha<TColor>(this Image<TColor> source, int percent)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Alpha(source, percent, source.Bounds);
}
@ -38,7 +38,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor> Alpha<TColor>(this Image<TColor> source, int percent, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new AlphaProcessor<TColor>(percent), rectangle);
return source;

2
src/ImageSharp.Processing/Effects/BackgroundColor.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="color">The color to set as the background.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> BackgroundColor<TColor>(this Image<TColor> source, TColor color)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new BackgroundColorProcessor<TColor>(color), source.Bounds);
return source;

4
src/ImageSharp.Processing/Effects/Brightness.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="amount">The new brightness of the image. Must be between -100 and 100.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Brightness<TColor>(this Image<TColor> source, int amount)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Brightness(source, amount, source.Bounds);
}
@ -38,7 +38,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Brightness<TColor>(this Image<TColor> source, int amount, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new BrightnessProcessor<TColor>(amount), rectangle);
return source;

4
src/ImageSharp.Processing/Effects/Contrast.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="amount">The new contrast of the image. Must be between -100 and 100.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Contrast<TColor>(this Image<TColor> source, int amount)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Contrast(source, amount, source.Bounds);
}
@ -38,7 +38,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Contrast<TColor>(this Image<TColor> source, int amount, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new ContrastProcessor<TColor>(amount), rectangle);
return source;

4
src/ImageSharp.Processing/Effects/Invert.cs

@ -21,7 +21,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor> Invert<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Invert(source, source.Bounds);
}
@ -36,7 +36,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor> Invert<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
source.ApplyProcessor(new InvertProcessor<TColor>(), rectangle);
return source;

4
src/ImageSharp.Processing/Effects/OilPainting.cs

@ -23,7 +23,7 @@ namespace ImageSharp
/// <param name="brushSize">The number of neighboring pixels used in calculating each individual pixel value.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> OilPaint<TColor>(this Image<TColor> source, int levels = 10, int brushSize = 15)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return OilPaint(source, levels, brushSize, source.Bounds);
}
@ -40,7 +40,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> OilPaint<TColor>(this Image<TColor> source, int levels, int brushSize, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
Guard.MustBeGreaterThan(levels, 0, nameof(levels));

4
src/ImageSharp.Processing/Effects/Pixelate.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="size">The size of the pixels.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Pixelate<TColor>(this Image<TColor> source, int size = 4)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Pixelate(source, size, source.Bounds);
}
@ -38,7 +38,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Pixelate<TColor>(this Image<TColor> source, int size, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
if (size <= 0 || size > source.Height || size > source.Width)
{

10
src/ImageSharp.Processing/Overlays/Glow.cs

@ -21,7 +21,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Glow<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Glow(source, NamedColors<TColor>.Black, source.Bounds.Width * .5F, source.Bounds);
}
@ -34,7 +34,7 @@ namespace ImageSharp
/// <param name="color">The color to set as the glow.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Glow<TColor>(this Image<TColor> source, TColor color)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Glow(source, color, source.Bounds.Width * .5F, source.Bounds);
}
@ -47,7 +47,7 @@ namespace ImageSharp
/// <param name="radius">The the radius.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Glow<TColor>(this Image<TColor> source, float radius)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Glow(source, NamedColors<TColor>.Black, radius, source.Bounds);
}
@ -62,7 +62,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Glow<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Glow(source, NamedColors<TColor>.Black, 0, rectangle);
}
@ -79,7 +79,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Glow<TColor>(this Image<TColor> source, TColor color, float radius, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
GlowProcessor<TColor> processor = new GlowProcessor<TColor>(color) { Radius = radius, };
source.ApplyProcessor(processor, rectangle);

10
src/ImageSharp.Processing/Overlays/Vignette.cs

@ -21,7 +21,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Vignette<TColor>(this Image<TColor> source)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Vignette(source, NamedColors<TColor>.Black, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds);
}
@ -34,7 +34,7 @@ namespace ImageSharp
/// <param name="color">The color to set as the vignette.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Vignette<TColor>(this Image<TColor> source, TColor color)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Vignette(source, color, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds);
}
@ -48,7 +48,7 @@ namespace ImageSharp
/// <param name="radiusY">The the y-radius.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Vignette<TColor>(this Image<TColor> source, float radiusX, float radiusY)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Vignette(source, NamedColors<TColor>.Black, radiusX, radiusY, source.Bounds);
}
@ -63,7 +63,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Vignette<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
return Vignette(source, NamedColors<TColor>.Black, 0, 0, rectangle);
}
@ -81,7 +81,7 @@ namespace ImageSharp
/// </param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Vignette<TColor>(this Image<TColor> source, TColor color, float radiusX, float radiusY, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
VignetteProcessor<TColor> processor = new VignetteProcessor<TColor>(color) { RadiusX = radiusX, RadiusY = radiusY };
source.ApplyProcessor(processor, rectangle);

2
src/ImageSharp.Processing/Processors/Binarization/BinaryThresholdProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class BinaryThresholdProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="BinaryThresholdProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class ErrorDiffusionDitherProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="ErrorDiffusionDitherProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/Binarization/OrderedDitherProcessor.cs

@ -15,7 +15,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class OrderedDitherProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="OrderedDitherProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class BlackWhiteProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class AchromatomalyProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class AchromatopsiaProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class DeuteranomalyProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class DeuteranopiaProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class ProtanomalyProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class ProtanopiaProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class TritanomalyProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class TritanopiaProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/ColorMatrixFilter.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public abstract class ColorMatrixFilter<TColor> : ImageProcessor<TColor>, IColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public abstract Matrix4x4 Matrix { get; }

2
src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class GrayscaleBt601Processor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class GrayscaleBt709Processor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/HueProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class HueProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="HueProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/ColorMatrix/IColorMatrixFilter.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public interface IColorMatrixFilter<TColor> : IImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Gets the <see cref="Matrix4x4"/> used to alter the image.

2
src/ImageSharp.Processing/Processors/ColorMatrix/KodachromeProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class KodachromeProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4()

2
src/ImageSharp.Processing/Processors/ColorMatrix/LomographProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class LomographProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
private static readonly TColor VeryDarkGreen = ColorBuilder<TColor>.FromRGBA(0, 10, 0, 255);

2
src/ImageSharp.Processing/Processors/ColorMatrix/PolaroidProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class PolaroidProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
private static TColor veryDarkOrange = ColorBuilder<TColor>.FromRGB(102, 34, 0);
private static TColor lightOrange = ColorBuilder<TColor>.FromRGBA(255, 153, 102, 178);

2
src/ImageSharp.Processing/Processors/ColorMatrix/SaturationProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class SaturationProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="SaturationProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/ColorMatrix/SepiaProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class SepiaProcessor<TColor> : ColorMatrixFilter<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <inheritdoc/>
public override Matrix4x4 Matrix => new Matrix4x4

2
src/ImageSharp.Processing/Processors/Convolution/BoxBlurProcessor.cs

@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class BoxBlurProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// The maximum size of the kernel in either direction.

2
src/ImageSharp.Processing/Processors/Convolution/Convolution2DProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class Convolution2DProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="Convolution2DProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/Convolution/Convolution2PassProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class Convolution2PassProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="Convolution2PassProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/Convolution/ConvolutionProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public class ConvolutionProcessor<TColor> : ImageProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="ConvolutionProcessor{TColor}"/> class.

2
src/ImageSharp.Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs

@ -12,7 +12,7 @@ namespace ImageSharp.Processing.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
public abstract class EdgeDetector2DProcessor<TColor> : ImageProcessor<TColor>, IEdgeDetectorProcessor<TColor>
where TColor : struct, IPackedPixel, IEquatable<TColor>
where TColor : struct, IPixel<TColor>
{
/// <summary>
/// Initializes a new instance of the <see cref="EdgeDetector2DProcessor{TColor}"/> class.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save