Browse Source

Added extra interface IPackedPixel so we can easier add extra interfaces.

Former-commit-id: 6fbacd8b3fc9f85f4fd8571c20ff5fd12e5057b8
Former-commit-id: 44b521a163f472068e0dea15334c9361c8bc5a28
Former-commit-id: d53a1519d6bc0573a50bbf397ebde59e61873957
af/merge-core
dirk 10 years ago
parent
commit
7cc5398365
  1. 2
      src/ImageProcessorCore/Colors/Color.cs
  2. 16
      src/ImageProcessorCore/Colors/PackedPixel/IPackedPixel.cs
  3. 4
      src/ImageProcessorCore/Filters/Alpha.cs
  4. 2
      src/ImageProcessorCore/Filters/BackgroundColor.cs
  5. 4
      src/ImageProcessorCore/Filters/BinaryThreshold.cs
  6. 4
      src/ImageProcessorCore/Filters/BlackWhite.cs
  7. 4
      src/ImageProcessorCore/Filters/Blend.cs
  8. 4
      src/ImageProcessorCore/Filters/Brightness.cs
  9. 4
      src/ImageProcessorCore/Filters/ColorBlindness.cs
  10. 4
      src/ImageProcessorCore/Filters/Contrast.cs
  11. 10
      src/ImageProcessorCore/Filters/Glow.cs
  12. 4
      src/ImageProcessorCore/Filters/Grayscale.cs
  13. 4
      src/ImageProcessorCore/Filters/Hue.cs
  14. 4
      src/ImageProcessorCore/Filters/Invert.cs
  15. 4
      src/ImageProcessorCore/Filters/Kodachrome.cs
  16. 4
      src/ImageProcessorCore/Filters/Lomograph.cs
  17. 4
      src/ImageProcessorCore/Filters/Polaroid.cs
  18. 4
      src/ImageProcessorCore/Filters/Saturation.cs
  19. 4
      src/ImageProcessorCore/Filters/Sepia.cs
  20. 10
      src/ImageProcessorCore/Filters/Vignette.cs
  21. 2
      src/ImageProcessorCore/Formats/Bmp/BmpDecoder.cs
  22. 2
      src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs
  23. 2
      src/ImageProcessorCore/Formats/Bmp/BmpEncoder.cs
  24. 2
      src/ImageProcessorCore/Formats/Gif/GifDecoder.cs
  25. 2
      src/ImageProcessorCore/Formats/Gif/GifDecoderCore.cs
  26. 2
      src/ImageProcessorCore/Formats/Gif/GifEncoder.cs
  27. 10
      src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs
  28. 2
      src/ImageProcessorCore/Formats/IImageDecoder.cs
  29. 2
      src/ImageProcessorCore/Formats/IImageEncoder.cs
  30. 2
      src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs
  31. 2
      src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id
  32. 2
      src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs
  33. 4
      src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs
  34. 2
      src/ImageProcessorCore/Formats/Png/PngDecoder.cs
  35. 6
      src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs
  36. 2
      src/ImageProcessorCore/Formats/Png/PngEncoder.cs
  37. 8
      src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs
  38. 2
      src/ImageProcessorCore/Image/Image.cs
  39. 9
      src/ImageProcessorCore/Image/ImageIOExtensions.cs
  40. 16
      src/ImageProcessorCore/Image/ImageProcessingExtensions.cs
  41. 2
      src/ImageProcessorCore/Profiles/Exif/ExifProfile.cs
  42. 2
      src/ImageProcessorCore/Quantizers/IQuantizer.cs
  43. 2
      src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs
  44. 2
      src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs
  45. 2
      src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs
  46. 4
      src/ImageProcessorCore/Quantizers/Quantize.cs
  47. 2
      src/ImageProcessorCore/Quantizers/QuantizedImage.cs
  48. 2
      src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs
  49. 4
      src/ImageProcessorCore/Samplers/AutoOrient.cs
  50. 4
      src/ImageProcessorCore/Samplers/BoxBlur.cs
  51. 4
      src/ImageProcessorCore/Samplers/Crop.cs
  52. 12
      src/ImageProcessorCore/Samplers/DetectEdges.cs
  53. 2
      src/ImageProcessorCore/Samplers/EntropyCrop.cs
  54. 2
      src/ImageProcessorCore/Samplers/Flip.cs
  55. 4
      src/ImageProcessorCore/Samplers/GuassianBlur.cs
  56. 4
      src/ImageProcessorCore/Samplers/GuassianSharpen.cs
  57. 4
      src/ImageProcessorCore/Samplers/OilPainting.cs
  58. 2
      src/ImageProcessorCore/Samplers/Pad.cs
  59. 4
      src/ImageProcessorCore/Samplers/Pixelate.cs
  60. 2
      src/ImageProcessorCore/Samplers/Processors/CompandingResizeProcessor.cs
  61. 2
      src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs
  62. 2
      src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2PassFilter.cs
  63. 2
      src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs
  64. 2
      src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs
  65. 2
      src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
  66. 2
      src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianBlurProcessor.cs
  67. 2
      src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs
  68. 2
      src/ImageProcessorCore/Samplers/Processors/EntropyCropProcessor.cs
  69. 2
      src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs
  70. 2
      src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs
  71. 2
      src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs
  72. 12
      src/ImageProcessorCore/Samplers/Resize.cs
  73. 6
      src/ImageProcessorCore/Samplers/Rotate.cs
  74. 2
      src/ImageProcessorCore/Samplers/RotateFlip.cs
  75. 4
      src/ImageProcessorCore/Samplers/Skew.cs

2
src/ImageProcessorCore/Colors/Color.cs

@ -17,7 +17,7 @@ namespace ImageProcessorCore
/// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
/// as it avoids the need to create new values for modification operations.
/// </remarks>
public partial struct Color : IPackedVector<uint>, IEquatable<Color>
public partial struct Color : IPackedPixel<uint>, IEquatable<Color>
{
/// <summary>
/// The maximum byte value.

16
src/ImageProcessorCore/Colors/PackedPixel/IPackedPixel.cs

@ -0,0 +1,16 @@
// <copyright file="IPackedVector.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageProcessorCore
{
/// <summary>
/// An interface that represents a packed pixel type.
/// </summary>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public interface IPackedPixel<TPacked> : IPackedVector<TPacked>
where TPacked : struct
{
}
}

4
src/ImageProcessorCore/Filters/Alpha.cs

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

2
src/ImageProcessorCore/Filters/BackgroundColor.cs

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

4
src/ImageProcessorCore/Filters/BinaryThreshold.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="threshold">The threshold to apply binerization of the image. Must be between 0 and 1.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> BinaryThreshold<TColor, TPacked>(this Image<TColor, TPacked> source, float threshold)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return BinaryThreshold(source, threshold, source.Bounds);
@ -39,7 +39,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> BinaryThreshold<TColor, TPacked>(this Image<TColor, TPacked> source, float threshold, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, new BinaryThresholdProcessor<TColor, TPacked>(threshold));

4
src/ImageProcessorCore/Filters/BlackWhite.cs

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

4
src/ImageProcessorCore/Filters/Blend.cs

@ -22,7 +22,7 @@ namespace ImageProcessorCore
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 100.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Blend<TColor, TPacked>(this Image<TColor, TPacked> source, ImageBase<TColor, TPacked> image, int percent = 50)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Blend(source, image, percent, source.Bounds);
@ -41,7 +41,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Blend<TColor, TPacked>(this Image<TColor, TPacked> source, ImageBase<TColor, TPacked> image, int percent, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, new BlendProcessor<TColor, TPacked>(image, percent));

4
src/ImageProcessorCore/Filters/Brightness.cs

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

4
src/ImageProcessorCore/Filters/ColorBlindness.cs

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

4
src/ImageProcessorCore/Filters/Contrast.cs

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

10
src/ImageProcessorCore/Filters/Glow.cs

@ -20,7 +20,7 @@ namespace ImageProcessorCore
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Glow<TColor, TPacked>(this Image<TColor, TPacked> source)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Glow(source, default(TColor), source.Bounds.Width * .5F, source.Bounds);
@ -35,7 +35,7 @@ namespace ImageProcessorCore
/// <param name="color">The color to set as the glow.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Glow<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Glow(source, color, source.Bounds.Width * .5F, source.Bounds);
@ -50,7 +50,7 @@ namespace ImageProcessorCore
/// <param name="radius">The the radius.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Glow<TColor, TPacked>(this Image<TColor, TPacked> source, float radius)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Glow(source, default(TColor), radius, source.Bounds);
@ -67,7 +67,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Glow<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Glow(source, default(TColor), 0, rectangle);
@ -86,7 +86,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Glow<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color, float radius, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
GlowProcessor<TColor, TPacked> processor = new GlowProcessor<TColor, TPacked> { Radius = radius, };

4
src/ImageProcessorCore/Filters/Grayscale.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Grayscale<TColor, TPacked>(this Image<TColor, TPacked> source, GrayscaleMode mode = GrayscaleMode.Bt709)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Grayscale(source, source.Bounds, mode);
@ -39,7 +39,7 @@ namespace ImageProcessorCore
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Grayscale<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle, GrayscaleMode mode = GrayscaleMode.Bt709)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
IImageFilter<TColor, TPacked> processor = mode == GrayscaleMode.Bt709

4
src/ImageProcessorCore/Filters/Hue.cs

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

4
src/ImageProcessorCore/Filters/Invert.cs

@ -20,7 +20,7 @@ namespace ImageProcessorCore
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor, TPacked> Invert<TColor, TPacked>(this Image<TColor, TPacked> source)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Invert(source, source.Bounds);
@ -37,7 +37,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor, TPacked> Invert<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, new InvertProcessor<TColor, TPacked>());

4
src/ImageProcessorCore/Filters/Kodachrome.cs

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

4
src/ImageProcessorCore/Filters/Lomograph.cs

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

4
src/ImageProcessorCore/Filters/Polaroid.cs

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

4
src/ImageProcessorCore/Filters/Saturation.cs

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

4
src/ImageProcessorCore/Filters/Sepia.cs

@ -20,7 +20,7 @@ namespace ImageProcessorCore
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor, TPacked> Sepia<TColor, TPacked>(this Image<TColor, TPacked> source)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Sepia(source, source.Bounds);
@ -37,7 +37,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image"/>.</returns>
public static Image<TColor, TPacked> Sepia<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, new SepiaProcessor<TColor, TPacked>());

10
src/ImageProcessorCore/Filters/Vignette.cs

@ -20,7 +20,7 @@ namespace ImageProcessorCore
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Vignette<TColor, TPacked>(this Image<TColor, TPacked> source)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Vignette(source, default(TColor), source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds);
@ -35,7 +35,7 @@ namespace ImageProcessorCore
/// <param name="color">The color to set as the vignette.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Vignette<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Vignette(source, color, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds);
@ -51,7 +51,7 @@ namespace ImageProcessorCore
/// <param name="radiusY">The the y-radius.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Vignette<TColor, TPacked>(this Image<TColor, TPacked> source, float radiusX, float radiusY)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Vignette(source, default(TColor), radiusX, radiusY, source.Bounds);
@ -68,7 +68,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Vignette<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Vignette(source, default(TColor), 0, 0, rectangle);
@ -88,7 +88,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Vignette<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color, float radiusX, float radiusY, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
VignetteProcessor<TColor, TPacked> processor = new VignetteProcessor<TColor, TPacked> { RadiusX = radiusX, RadiusY = radiusY };

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

@ -71,7 +71,7 @@ namespace ImageProcessorCore.Formats
/// <inheritdoc/>
public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Guard.NotNull(image, "image");

2
src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs

@ -61,7 +61,7 @@ namespace ImageProcessorCore.Formats
/// <para><paramref name="stream"/> is null.</para>
/// </exception>
public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
this.currentStream = stream;

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

@ -44,7 +44,7 @@ namespace ImageProcessorCore.Formats
/// <inheritdoc/>
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
BmpEncoderCore encoder = new BmpEncoderCore();

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

@ -56,7 +56,7 @@ namespace ImageProcessorCore.Formats
/// <inheritdoc/>
public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
new GifDecoderCore<TColor, TPacked>().Decode(image, stream);

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

@ -14,7 +14,7 @@ namespace ImageProcessorCore.Formats
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
internal class GifDecoderCore<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

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

@ -48,7 +48,7 @@ namespace ImageProcessorCore.Formats
/// <inheritdoc/>
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
GifEncoderCore encoder = new GifEncoderCore

10
src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs

@ -47,7 +47,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The <see cref="Image{TColor, TPacked}"/> to encode from.</param>
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Guard.NotNull(image, nameof(image));
@ -116,7 +116,7 @@ namespace ImageProcessorCore.Formats
/// The <see cref="int"/>.
/// </returns>
private static int GetTransparentIndex<TColor, TPacked>(QuantizedImage<TColor, TPacked> quantized)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
// Find the lowest alpha value and make it the transparent index.
@ -153,7 +153,7 @@ namespace ImageProcessorCore.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, TPacked>(Image<TColor, TPacked> image, EndianBinaryWriter writer, int tranparencyIndex)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
GifLogicalScreenDescriptor descriptor = new GifLogicalScreenDescriptor
@ -302,7 +302,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The <see cref="ImageBase{TColor, TPacked}"/> to encode.</param>
/// <param name="writer">The writer to write to the stream with.</param>
private void WriteColorTable<TColor, TPacked>(QuantizedImage<TColor, TPacked> image, EndianBinaryWriter writer)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
// Grab the palette and write it to the stream.
@ -337,7 +337,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The <see cref="QuantizedImage{TColor, TPacked}"/> containing indexed pixels.</param>
/// <param name="writer">The stream to write to.</param>
private void WriteImageData<TColor, TPacked>(QuantizedImage<TColor, TPacked> image, EndianBinaryWriter writer)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
byte[] indexedPixels = image.Pixels;

2
src/ImageProcessorCore/Formats/IImageDecoder.cs

@ -46,7 +46,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The <see cref="ImageBase{TColor, TPacked}"/> to decode to.</param>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct;
}
}

2
src/ImageProcessorCore/Formats/IImageEncoder.cs

@ -45,7 +45,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The <see cref="Image{TColor, TPacked}"/> to encode from.</param>
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct;
}
}

2
src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs

@ -77,7 +77,7 @@ namespace ImageProcessorCore.Formats
/// <inheritdoc/>
public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Guard.NotNull(image, "image");

2
src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id

@ -1 +1 @@
4b157cb3b1a798514be3c1b13c1ed4294bf9d6f1
8dbd88f93229d332f2ca8e61d85d4ac6a66773ef

2
src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs

@ -79,7 +79,7 @@ namespace ImageProcessorCore.Formats
/// <inheritdoc/>
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
JpegEncoderCore encode = new JpegEncoderCore();

4
src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs

@ -431,7 +431,7 @@ namespace ImageProcessorCore.Formats
// Encode writes the Image m to w in JPEG 4:2:0 baseline format with the given
// options. Default parameters are used if a nil *Options is passed.
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream, int quality, JpegSubsample sample)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Guard.NotNull(image, nameof(image));
@ -571,7 +571,7 @@ namespace ImageProcessorCore.Formats
}
private void WriteProfiles<TColor, TPacked>(Image<TColor, TPacked> image)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
WriteProfile(image.ExifProfile);

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

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

6
src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs

@ -91,7 +91,7 @@ namespace ImageProcessorCore.Formats
/// Thrown if the image is larger than the maximum allowable size.
/// </exception>
public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Image<TColor, TPacked> currentImage = image;
@ -163,7 +163,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The image to read to.</param>
/// <param name="data">The data containing physical data.</param>
private void ReadPhysicalChunk<TColor, TPacked>(Image<TColor, TPacked> image, byte[] data)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Array.Reverse(data, 0, 4);
@ -450,7 +450,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The image to decode to.</param>
/// <param name="data">The <see cref="T:byte[]"/> containing data.</param>
private void ReadTextChunk<TColor, TPacked>(Image<TColor, TPacked> image, byte[] data)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
int zeroIndex = 0;

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

@ -73,7 +73,7 @@ namespace ImageProcessorCore.Formats
/// <inheritdoc/>
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
PngEncoderCore encoder = new PngEncoderCore

8
src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs

@ -96,7 +96,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The <see cref="ImageBase{TColor, TPacked}"/> to encode from.</param>
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
public void Encode<TColor, TPacked>(ImageBase<TColor, TPacked> image, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Guard.NotNull(image, nameof(image));
@ -233,7 +233,7 @@ namespace ImageProcessorCore.Formats
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <param name="header">The <see cref="PngHeader"/>.</param>
private void CollectIndexedBytes<TColor, TPacked>(ImageBase<TColor, TPacked> image, Stream stream, PngHeader header)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
// Quatize the image and get the pixels
@ -483,7 +483,7 @@ namespace ImageProcessorCore.Formats
/// <param name="image">The image to encode.</param>
/// <returns>The <see cref="QuantizedImage{TColor, TPacked}"/></returns>
private QuantizedImage<TColor, TPacked> WritePaletteChunk<TColor, TPacked>(Stream stream, PngHeader header, ImageBase<TColor, TPacked> image)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
if (this.Quality > 256)
@ -553,7 +553,7 @@ namespace ImageProcessorCore.Formats
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <param name="imageBase">The image base.</param>
private void WritePhysicalChunk<TColor, TPacked>(Stream stream, ImageBase<TColor, TPacked> imageBase)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Image<TColor, TPacked> image = imageBase as Image<TColor, TPacked>;

2
src/ImageProcessorCore/Image/Image.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[DebuggerDisplay("Image: {Width}x{Height}")]
public class Image<TColor, TPacked> : ImageBase<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

9
src/ImageProcessorCore/Image/ImageIOExtensions.cs

@ -26,7 +26,7 @@ namespace ImageProcessorCore
/// The <see cref="Image{TColor,TPacked}"/>.
/// </returns>
public static Image<TColor, TPacked> SaveAsBmp<TColor, TPacked>(this Image<TColor, TPacked> source, Stream stream)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
=> source.Save(stream, new BmpEncoder());
@ -45,7 +45,8 @@ namespace ImageProcessorCore
/// The <see cref="Image{TColor,TPacked}"/>.
/// </returns>
public static Image<TColor, TPacked> SaveAsPng<TColor, TPacked>(this Image<TColor, TPacked> source, Stream stream, int quality = int.MaxValue)
where TColor : IPackedVector<TPacked> where TPacked : struct
where TColor : IPackedPixel<TPacked>
where TPacked : struct
=> source.Save(stream, new PngEncoder { Quality = quality });
/// <summary>
@ -61,7 +62,7 @@ namespace ImageProcessorCore
/// The <see cref="Image{TColor,TPacked}"/>.
/// </returns>
public static Image<TColor, TPacked> SaveAsJpeg<TColor, TPacked>(this Image<TColor, TPacked> source, Stream stream, int quality = 75)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
=> source.Save(stream, new JpegEncoder { Quality = quality });
@ -78,7 +79,7 @@ namespace ImageProcessorCore
/// The <see cref="Image{TColor,TPacked}"/>.
/// </returns>
public static Image<TColor, TPacked> SaveAsGif<TColor, TPacked>(this Image<TColor, TPacked> source, Stream stream, int quality = 256)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
=> source.Save(stream, new GifEncoder { Quality = quality });
}

16
src/ImageProcessorCore/Image/ImageProcessingExtensions.cs

@ -23,7 +23,7 @@ namespace ImageProcessorCore
/// <param name="processor">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, IImageFilter<TColor, TPacked> processor)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Process(source, source.Bounds, processor);
@ -42,7 +42,7 @@ namespace ImageProcessorCore
/// <param name="processor">The processors to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle sourceRectangle, IImageFilter<TColor, TPacked> processor)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return PerformAction(source, (sourceImage) => processor.Apply(sourceImage, sourceRectangle));
@ -58,7 +58,7 @@ namespace ImageProcessorCore
/// <param name="processor">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, IImageSampler<TColor, TPacked> processor)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Process(source, source.Bounds, processor);
@ -77,7 +77,7 @@ namespace ImageProcessorCore
/// <param name="processor">The processors to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle sourceRectangle, IImageSampler<TColor, TPacked> processor)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return PerformAction(source, true, (sourceImage, targetImage) => processor.Apply(targetImage, sourceImage, sourceRectangle));
@ -97,7 +97,7 @@ namespace ImageProcessorCore
/// <param name="sampler">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, IImageSampler<TColor, TPacked> sampler)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Process(source, width, height, source.Bounds, default(Rectangle), sampler);
@ -124,7 +124,7 @@ namespace ImageProcessorCore
/// <param name="sampler">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, Rectangle sourceRectangle, Rectangle targetRectangle, IImageSampler<TColor, TPacked> sampler)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return PerformAction(source, false, (sourceImage, targetImage) => sampler.Apply(targetImage, sourceImage, width, height, targetRectangle, sourceRectangle));
@ -139,7 +139,7 @@ namespace ImageProcessorCore
/// <param name="action">The <see cref="Action"/> to perform against the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
private static Image<TColor, TPacked> PerformAction<TColor, TPacked>(Image<TColor, TPacked> source, Action<ImageBase<TColor, TPacked>> action)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
action(source);
@ -162,7 +162,7 @@ namespace ImageProcessorCore
/// <param name="action">The <see cref="Action"/> to perform against the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
private static Image<TColor, TPacked> PerformAction<TColor, TPacked>(Image<TColor, TPacked> source, bool clone, Action<ImageBase<TColor, TPacked>, ImageBase<TColor, TPacked>> action)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Image<TColor, TPacked> transformedImage = clone

2
src/ImageProcessorCore/Profiles/Exif/ExifProfile.cs

@ -118,7 +118,7 @@ namespace ImageProcessorCore
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public Image<TColor, TPacked> CreateThumbnail<TColor, TPacked>()
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
this.InitializeValues();

2
src/ImageProcessorCore/Quantizers/IQuantizer.cs

@ -11,7 +11,7 @@ namespace ImageProcessorCore.Quantizers
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public interface IQuantizer<TColor, TPacked> : IQuantizer
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs

@ -15,7 +15,7 @@ namespace ImageProcessorCore.Quantizers
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public sealed class OctreeQuantizer<TColor, TPacked> : Quantizer<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs

@ -14,7 +14,7 @@ namespace ImageProcessorCore.Quantizers
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class Quantizer<TColor, TPacked> : IQuantizer<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs

@ -17,7 +17,7 @@ namespace ImageProcessorCore.Quantizers
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class PaletteQuantizer<TColor, TPacked> : Quantizer<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

4
src/ImageProcessorCore/Quantizers/Quantize.cs

@ -22,7 +22,7 @@ namespace ImageProcessorCore
/// <param name="maxColors">The maximum number of colors to return. Defaults to 256.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Quantize<TColor, TPacked>(this Image<TColor, TPacked> source, Quantization mode = Quantization.Octree, int maxColors = 256)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
IQuantizer<TColor, TPacked> quantizer;
@ -54,7 +54,7 @@ namespace ImageProcessorCore
/// <param name="maxColors">The maximum number of colors to return.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Quantize<TColor, TPacked>(this Image<TColor, TPacked> source, IQuantizer<TColor, TPacked> quantizer, int maxColors)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
QuantizedImage<TColor, TPacked> quantizedImage = quantizer.Quantize(source, maxColors);

2
src/ImageProcessorCore/Quantizers/QuantizedImage.cs

@ -14,7 +14,7 @@ namespace ImageProcessorCore.Quantizers
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class QuantizedImage<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs

@ -35,7 +35,7 @@ namespace ImageProcessorCore.Quantizers
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public sealed class WuQuantizer<TColor, TPacked> : IQuantizer<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

4
src/ImageProcessorCore/Samplers/AutoOrient.cs

@ -18,7 +18,7 @@ namespace ImageProcessorCore
/// <param name="source">The image to auto rotate.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> AutoOrient<TColor, TPacked>(this Image<TColor, TPacked> source)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Orientation orientation = GetExifOrientation(source);
@ -63,7 +63,7 @@ namespace ImageProcessorCore
/// <param name="source">The image to auto rotate.</param>
/// <returns>The <see cref="Orientation"/></returns>
private static Orientation GetExifOrientation<TColor, TPacked>(Image<TColor, TPacked> source)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
if (source.ExifProfile == null)

4
src/ImageProcessorCore/Samplers/BoxBlur.cs

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

4
src/ImageProcessorCore/Samplers/Crop.cs

@ -22,7 +22,7 @@ namespace ImageProcessorCore
/// <param name="height">The target image height.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/></returns>
public static Image<TColor, TPacked> Crop<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Crop(source, width, height, source.Bounds);
@ -45,7 +45,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> Crop<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, Rectangle sourceRectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
Guard.MustBeGreaterThan(width, 0, nameof(width));

12
src/ImageProcessorCore/Samplers/DetectEdges.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return DetectEdges(source, source.Bounds, new SobelProcessor<TColor, TPacked> { Grayscale = true });
@ -39,7 +39,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return DetectEdges(source, rectangle, new SobelProcessor<TColor, TPacked> { Grayscale = true });
@ -55,7 +55,7 @@ namespace ImageProcessorCore
/// <param name="grayscale">Whether to convert the image to Grayscale first. Defaults to true.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, EdgeDetection filter, bool grayscale = true)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return DetectEdges(source, filter, source.Bounds, grayscale);
@ -74,7 +74,7 @@ namespace ImageProcessorCore
/// <param name="grayscale">Whether to convert the image to Grayscale first. Defaults to true.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
IEdgeDetectorFilter<TColor, TPacked> processor;
@ -134,7 +134,7 @@ namespace ImageProcessorCore
/// <param name="filter">The filter for detecting edges.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, IEdgeDetectorFilter<TColor, TPacked> filter)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return DetectEdges(source, source.Bounds, filter);
@ -152,7 +152,7 @@ namespace ImageProcessorCore
/// <param name="filter">The filter for detecting edges.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle, IEdgeDetectorFilter<TColor, TPacked> filter)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, filter);

2
src/ImageProcessorCore/Samplers/EntropyCrop.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="threshold">The threshold for entropic density.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> EntropyCrop<TColor, TPacked>(this Image<TColor, TPacked> source, float threshold = .5f)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
EntropyCropProcessor<TColor, TPacked> processor = new EntropyCropProcessor<TColor, TPacked>(threshold);

2
src/ImageProcessorCore/Samplers/Flip.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> Flip<TColor, TPacked>(this Image<TColor, TPacked> source, FlipType flipType)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
FlipProcessor<TColor, TPacked> processor = new FlipProcessor<TColor, TPacked>(flipType);

4
src/ImageProcessorCore/Samplers/GuassianBlur.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> GuassianBlur<TColor, TPacked>(this Image<TColor, TPacked> source, float sigma = 3f)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return GuassianBlur(source, sigma, source.Bounds);
@ -39,7 +39,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> GuassianBlur<TColor, TPacked>(this Image<TColor, TPacked> source, float sigma, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, new GuassianBlurProcessor<TColor, TPacked>(sigma));

4
src/ImageProcessorCore/Samplers/GuassianSharpen.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> GuassianSharpen<TColor, TPacked>(this Image<TColor, TPacked> source, float sigma = 3f)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return GuassianSharpen(source, sigma, source.Bounds);
@ -39,7 +39,7 @@ namespace ImageProcessorCore
/// </param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> GuassianSharpen<TColor, TPacked>(this Image<TColor, TPacked> source, float sigma, Rectangle rectangle)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, new GuassianSharpenProcessor<TColor, TPacked>(sigma));

4
src/ImageProcessorCore/Samplers/OilPainting.cs

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

2
src/ImageProcessorCore/Samplers/Pad.cs

@ -20,7 +20,7 @@ namespace ImageProcessorCore
/// <param name="height">The new height.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Pad<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
ResizeOptions options = new ResizeOptions

4
src/ImageProcessorCore/Samplers/Pixelate.cs

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

2
src/ImageProcessorCore/Samplers/Processors/CompandingResizeProcessor.cs

@ -16,7 +16,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class CompandingResizeProcessor<TColor, TPacked> : ResamplingWeightedProcessor<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs

@ -11,7 +11,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class BoxBlurProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2PassFilter.cs

@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class Convolution2PassFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs

@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class EdgeDetectorCompassFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>, IEdgeDetectorFilter<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs

@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class KirschProcessor<TColor, TPacked> : EdgeDetectorCompassFilter<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs

@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class RobinsonProcessor<TColor, TPacked> : EdgeDetectorCompassFilter<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianBlurProcessor.cs

@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class GuassianBlurProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs

@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class GuassianSharpenProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/EntropyCropProcessor.cs

@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class EntropyCropProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs

@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class FlipProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs

@ -18,7 +18,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class ResizeProcessor<TColor, TPacked> : ResamplingWeightedProcessor<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

2
src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs

@ -16,7 +16,7 @@ namespace ImageProcessorCore.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class RotateProcessor<TColor, TPacked> : Matrix3x2Processor<TColor, TPacked>
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>

12
src/ImageProcessorCore/Samplers/Resize.cs

@ -22,7 +22,7 @@ namespace ImageProcessorCore
/// <returns>The <see cref="Image{TColor, TPacked}"/></returns>
/// <remarks>Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image</remarks>
public static Image<TColor, TPacked> Resize<TColor, TPacked>(this Image<TColor, TPacked> source, ResizeOptions options)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
// Ensure size is populated across both dimensions.
@ -52,7 +52,7 @@ namespace ImageProcessorCore
/// <returns>The <see cref="Image{TColor, TPacked}"/></returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static Image<TColor, TPacked> Resize<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Resize(source, width, height, new BicubicResampler(), false);
@ -70,7 +70,7 @@ namespace ImageProcessorCore
/// <returns>The <see cref="Image{TColor, TPacked}"/></returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static Image<TColor, TPacked> Resize<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, bool compand)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Resize(source, width, height, new BicubicResampler(), compand);
@ -88,7 +88,7 @@ namespace ImageProcessorCore
/// <returns>The <see cref="Image{TColor, TPacked}"/></returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static Image<TColor, TPacked> Resize<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, IResampler sampler)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Resize(source, width, height, sampler, false);
@ -107,7 +107,7 @@ namespace ImageProcessorCore
/// <returns>The <see cref="Image{TColor, TPacked}"/></returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static Image<TColor, TPacked> Resize<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, IResampler sampler, bool compand)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Resize(source, width, height, sampler, source.Bounds, new Rectangle(0, 0, width, height), compand);
@ -133,7 +133,7 @@ namespace ImageProcessorCore
/// <returns>The <see cref="Image{TColor, TPacked}"/></returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static Image<TColor, TPacked> Resize<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand = false)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
if (width == 0 && height > 0)

6
src/ImageProcessorCore/Samplers/Rotate.cs

@ -21,7 +21,7 @@ namespace ImageProcessorCore
/// <param name="degrees">The angle in degrees to perform the rotation.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> Rotate<TColor, TPacked>(this Image<TColor, TPacked> source, float degrees)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Rotate(source, degrees, true);
@ -36,7 +36,7 @@ namespace ImageProcessorCore
/// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> Rotate<TColor, TPacked>(this Image<TColor, TPacked> source, RotateType rotateType)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Rotate(source, (float)rotateType, false);
@ -52,7 +52,7 @@ namespace ImageProcessorCore
/// <param name="expand">Whether to expand the image to fit the rotated result.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> Rotate<TColor, TPacked>(this Image<TColor, TPacked> source, float degrees, bool expand)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
RotateProcessor<TColor, TPacked> processor = new RotateProcessor<TColor, TPacked> { Angle = degrees, Expand = expand };

2
src/ImageProcessorCore/Samplers/RotateFlip.cs

@ -19,7 +19,7 @@ namespace ImageProcessorCore
/// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> RotateFlip<TColor, TPacked>(this Image<TColor, TPacked> source, RotateType rotateType, FlipType flipType)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return source.Rotate(rotateType).Flip(flipType);

4
src/ImageProcessorCore/Samplers/Skew.cs

@ -22,7 +22,7 @@ namespace ImageProcessorCore
/// <param name="degreesY">The angle in degrees to perform the rotation along the y-axis.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> Skew<TColor, TPacked>(this Image<TColor, TPacked> source, float degreesX, float degreesY)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
return Skew(source, degreesX, degreesY, true);
@ -39,7 +39,7 @@ namespace ImageProcessorCore
/// <param name="expand">Whether to expand the image to fit the skewed result.</param>
/// <returns>The <see cref="Image"/></returns>
public static Image<TColor, TPacked> Skew<TColor, TPacked>(this Image<TColor, TPacked> source, float degreesX, float degreesY, bool expand)
where TColor : IPackedVector<TPacked>
where TColor : IPackedPixel<TPacked>
where TPacked : struct
{
SkewProcessor<TColor, TPacked> processor = new SkewProcessor<TColor, TPacked> { AngleX = degreesX, AngleY = degreesY, Expand = expand };

Loading…
Cancel
Save