Browse Source

Overlays and base processors

af/merge-core
James Jackson-South 8 years ago
parent
commit
091cb8a3b5
  1. 6
      src/ImageSharp/PixelFormats/PixelBlenderMode.cs
  2. 28
      src/ImageSharp/Processing/Delegate.cs
  3. 2
      src/ImageSharp/Processing/Filters/Processors/LomographProcessor.cs
  4. 2
      src/ImageSharp/Processing/Filters/Processors/PolaroidProcessor.cs
  5. 33
      src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs
  6. 35
      src/ImageSharp/Processing/Overlays/GlowExtensions.cs
  7. 15
      src/ImageSharp/Processing/Overlays/Processors/BackgroundColorProcessor.cs
  8. 2
      src/ImageSharp/Processing/Overlays/Processors/GlowProcessor.cs
  9. 2
      src/ImageSharp/Processing/Overlays/Processors/VignetteProcessor.cs
  10. 37
      src/ImageSharp/Processing/Overlays/VignetteExtensions.cs
  11. 29
      src/ImageSharp/Processing/ProcessingExtensions.cs
  12. 4
      src/ImageSharp/Processing/Processors/CloningImageProcessor.cs
  13. 4
      src/ImageSharp/Processing/Processors/DelegateProcessor.cs
  14. 0
      src/ImageSharp/Processing/Quantization/Box.cs
  15. 0
      src/ImageSharp/Processing/Quantization/IQuantizer{TPixel}.cs
  16. 0
      src/ImageSharp/Processing/Quantization/OctreeQuantizer{TPixel}.cs
  17. 0
      src/ImageSharp/Processing/Quantization/PaletteQuantizer{TPixel}.cs
  18. 0
      src/ImageSharp/Processing/Quantization/Quantization.cs
  19. 1
      src/ImageSharp/Processing/Quantization/Quantize.cs
  20. 0
      src/ImageSharp/Processing/Quantization/QuantizedImage{TPixel}.cs
  21. 0
      src/ImageSharp/Processing/Quantization/QuantizerBase{TPixel}.cs
  22. 0
      src/ImageSharp/Processing/Quantization/WuQuantizer{TPixel}.cs
  23. 0
      src/ImageSharp/Processing/Transforms/Processors/AffineTransformProcessor.cs
  24. 0
      src/ImageSharp/Processing/Transforms/Processors/AutoOrientProcessor.cs
  25. 0
      src/ImageSharp/Processing/Transforms/Processors/CenteredAffineTransformProcessor.cs
  26. 0
      src/ImageSharp/Processing/Transforms/Processors/CenteredProjectiveTransformProcessor.cs
  27. 0
      src/ImageSharp/Processing/Transforms/Processors/CropProcessor.cs
  28. 0
      src/ImageSharp/Processing/Transforms/Processors/EntropyCropProcessor.cs
  29. 0
      src/ImageSharp/Processing/Transforms/Processors/FlipProcessor.cs
  30. 0
      src/ImageSharp/Processing/Transforms/Processors/InterpolatedTransformProcessorBase.cs
  31. 0
      src/ImageSharp/Processing/Transforms/Processors/ProjectiveTransformProcessor.cs
  32. 0
      src/ImageSharp/Processing/Transforms/Processors/ResizeProcessor.cs
  33. 0
      src/ImageSharp/Processing/Transforms/Processors/RotateProcessor.cs
  34. 0
      src/ImageSharp/Processing/Transforms/Processors/SkewProcessor.cs
  35. 0
      src/ImageSharp/Processing/Transforms/Processors/TransformProcessorBase.cs
  36. 0
      src/ImageSharp/Processing/Transforms/Processors/WeightsBuffer.cs
  37. 0
      src/ImageSharp/Processing/Transforms/Processors/WeightsWindow.cs
  38. 2
      tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs
  39. 1
      tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs
  40. 1
      tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs
  41. 1
      tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs
  42. 11
      tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs
  43. 1
      tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs
  44. 1
      tests/ImageSharp.Benchmarks/Samplers/Crop.cs
  45. 5
      tests/ImageSharp.Benchmarks/Samplers/Glow.cs
  46. 1
      tests/ImageSharp.Benchmarks/Samplers/Resize.cs
  47. 3
      tests/ImageSharp.Tests/Drawing/BeziersTests.cs
  48. 2
      tests/ImageSharp.Tests/Drawing/BlendedShapes.cs
  49. 3
      tests/ImageSharp.Tests/Drawing/DrawPathTests.cs
  50. 9
      tests/ImageSharp.Tests/Drawing/FillPatternTests.cs
  51. 2
      tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs
  52. 3
      tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs
  53. 3
      tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs
  54. 3
      tests/ImageSharp.Tests/Drawing/LineTests.cs
  55. 3
      tests/ImageSharp.Tests/Drawing/PolygonTests.cs
  56. 2
      tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs
  57. 3
      tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs
  58. 3
      tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs
  59. 3
      tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs
  60. 1
      tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs
  61. 2
      tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs
  62. 1
      tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs
  63. 1
      tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs
  64. 2
      tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs
  65. 3
      tests/ImageSharp.Tests/Image/ImageProcessingContextTests.cs
  66. 2
      tests/ImageSharp.Tests/Image/ImageRotationTests.cs
  67. 2
      tests/ImageSharp.Tests/Issues/Issue412.cs
  68. 89
      tests/ImageSharp.Tests/Memory/Fast2DArrayTests.cs
  69. 6
      tests/ImageSharp.Tests/MetaData/Profiles/ICC/DataWriter/IccDataWriter.MatrixTests.cs
  70. 34
      tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs
  71. 2
      tests/ImageSharp.Tests/Processing/DelegateTest.cs
  72. 3
      tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs
  73. 8
      tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs
  74. 10
      tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs
  75. 1
      tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs
  76. 1
      tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs
  77. 1
      tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs
  78. 1
      tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs
  79. 1
      tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs
  80. 1
      tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs
  81. 3
      tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs
  82. 1
      tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs
  83. 1
      tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs
  84. 3
      tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs
  85. 3
      tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs
  86. 2
      tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs
  87. 2
      tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs
  88. 2
      tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs
  89. 14
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs
  90. 2
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs
  91. 2
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs
  92. 1
      tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
  93. 1
      tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
  94. 1
      tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs
  95. 1
      tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceCodecTests.cs

6
src/ImageSharp/PixelFormats/PixelBlenderMode.cs

@ -1,14 +1,10 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Collections.Generic;
using System.Text;
namespace SixLabors.ImageSharp.PixelFormats
{
/// <summary>
/// The various blending modes.
/// Enumerates the various blending modes.
/// </summary>
public enum PixelBlenderMode
{

28
src/ImageSharp/Processing/Delegate.cs

@ -1,28 +0,0 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
namespace SixLabors.ImageSharp
{
/// <summary>
/// Extension methods for the <see cref="Image{TPixel}"/> type.
/// </summary>
public static partial class ImageExtensions
{
/// <summary>
/// Applies the given operation to the mutable image.
/// Useful when we need to extract information like Width/Height to parameterize the next operation working on the <see cref="IImageProcessingContext{TPixel}"/> chain.
/// To achieve this the method actually implements an "inline" <see cref="IImageProcessor{TPixel}"/> with <paramref name="operation"/> as it's processing logic.
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image to mutate.</param>
/// <param name="operation">The operation to perform on the source.</param>
/// <returns>The <see cref="IImageProcessingContext{TPixel}"/> to allow chaining of operations.</returns>
public static IImageProcessingContext<TPixel> Apply<TPixel>(this IImageProcessingContext<TPixel> source, Action<Image<TPixel>> operation)
where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new DelegateProcessor<TPixel>(operation));
}
}

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

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Filters.Processors

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

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Filters.Processors

33
src/ImageSharp/Processing/Overlays/BackgroundColor.cs → src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs

@ -1,17 +1,16 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp
namespace SixLabors.ImageSharp.Processing.Overlays
{
/// <summary>
/// Extension methods for the <see cref="Image{TPixel}"/> type.
/// Adds extensions that allow the application of a background color to the <see cref="Image{TPixel}"/> type.
/// </summary>
public static partial class ImageExtensions
public static class BackgroundColorExtensions
{
/// <summary>
/// Replaces the background color of image with the given one.
@ -19,11 +18,10 @@ namespace SixLabors.ImageSharp
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="color">The color to set as the background.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, GraphicsOptions options)
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color)
where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(source.MemoryManager, color, options));
=> BackgroundColor(source, color, GraphicsOptions.Default);
/// <summary>
/// Replaces the background color of image with the given one.
@ -34,11 +32,10 @@ namespace SixLabors.ImageSharp
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Rectangle rectangle, GraphicsOptions options)
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(source.MemoryManager, color, options), rectangle);
=> BackgroundColor(source, color, rectangle, GraphicsOptions.Default);
/// <summary>
/// Replaces the background color of image with the given one.
@ -46,12 +43,11 @@ namespace SixLabors.ImageSharp
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="color">The color to set as the background.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color)
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
{
return BackgroundColor(source, color, GraphicsOptions.Default);
}
=> source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(color, options));
/// <summary>
/// Replaces the background color of image with the given one.
@ -62,11 +58,10 @@ namespace SixLabors.ImageSharp
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Rectangle rectangle)
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Rectangle rectangle, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
{
return BackgroundColor(source, color, rectangle, GraphicsOptions.Default);
}
=> source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(color, options), rectangle);
}
}

35
src/ImageSharp/Processing/Overlays/Glow.cs → src/ImageSharp/Processing/Overlays/GlowExtensions.cs

@ -3,16 +3,15 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp
namespace SixLabors.ImageSharp.Processing.Overlays
{
/// <summary>
/// Extension methods for the <see cref="Image{TPixel}"/> type.
/// Adds extensions that allow the application of a radial glow to the <see cref="Image{TPixel}"/> type.
/// </summary>
public static partial class ImageExtensions
public static class GlowExtensions
{
/// <summary>
/// Applies a radial glow effect to an image.
@ -22,9 +21,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source)
where TPixel : struct, IPixel<TPixel>
{
return Glow(source, GraphicsOptions.Default);
}
=> Glow(source, GraphicsOptions.Default);
/// <summary>
/// Applies a radial glow effect to an image.
@ -48,9 +45,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, float radius)
where TPixel : struct, IPixel<TPixel>
{
return Glow(source, radius, GraphicsOptions.Default);
}
=> Glow(source, radius, GraphicsOptions.Default);
/// <summary>
/// Applies a radial glow effect to an image.
@ -63,7 +58,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel>
=> source.Glow(rectangle, GraphicsOptions.Default);
=> source.Glow(rectangle, GraphicsOptions.Default);
/// <summary>
/// Applies a radial glow effect to an image.
@ -78,7 +73,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radius, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel>
=> source.Glow(color, ValueSize.Absolute(radius), rectangle, GraphicsOptions.Default);
=> source.Glow(color, ValueSize.Absolute(radius), rectangle, GraphicsOptions.Default);
/// <summary>
/// Applies a radial glow effect to an image.
@ -89,7 +84,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f), options);
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f), options);
/// <summary>
/// Applies a radial glow effect to an image.
@ -101,7 +96,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.Glow(color, ValueSize.PercentageOfWidth(0.5f), options);
=> source.Glow(color, ValueSize.PercentageOfWidth(0.5f), options);
/// <summary>
/// Applies a radial glow effect to an image.
@ -113,7 +108,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, float radius, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.Absolute(radius), options);
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.Absolute(radius), options);
/// <summary>
/// Applies a radial glow effect to an image.
@ -127,7 +122,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f), rectangle, options);
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f), rectangle, options);
/// <summary>
/// Applies a radial glow effect to an image.
@ -143,7 +138,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radius, Rectangle rectangle, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.Glow(color, ValueSize.Absolute(radius), rectangle, options);
=> source.Glow(color, ValueSize.Absolute(radius), rectangle, options);
/// <summary>
/// Applies a radial glow effect to an image.
@ -159,7 +154,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
private static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, ValueSize radius, Rectangle rectangle, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options), rectangle);
=> source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options), rectangle);
/// <summary>
/// Applies a radial glow effect to an image.
@ -172,6 +167,6 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
private static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, ValueSize radius, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options));
=> source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options));
}
}

15
src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs → src/ImageSharp/Processing/Overlays/Processors/BackgroundColorProcessor.cs

@ -8,7 +8,7 @@ using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors
namespace SixLabors.ImageSharp.Processing.Overlays.Processors
{
/// <summary>
/// Sets the background color of the image.
@ -17,18 +17,14 @@ namespace SixLabors.ImageSharp.Processing.Processors
internal class BackgroundColorProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
{
private readonly MemoryManager memoryManager;
/// <summary>
/// Initializes a new instance of the <see cref="BackgroundColorProcessor{TPixel}"/> class.
/// </summary>
/// <param name="memoryManager">The <see cref="MemoryManager"/> to use for buffer allocations.</param>
/// <param name="color">The <typeparamref name="TPixel"/> to set the background color to.</param>
/// <param name="options">The options defining blending algorithm and amount.</param>
public BackgroundColorProcessor(MemoryManager memoryManager, TPixel color, GraphicsOptions options)
public BackgroundColorProcessor(TPixel color, GraphicsOptions options)
{
this.Value = color;
this.memoryManager = memoryManager;
this.GraphicsOptions = options;
}
@ -69,13 +65,14 @@ namespace SixLabors.ImageSharp.Processing.Processors
int width = maxX - minX;
using (IBuffer<TPixel> colors = this.memoryManager.Allocate<TPixel>(width))
using (IBuffer<float> amount = this.memoryManager.Allocate<float>(width))
using (IBuffer<TPixel> colors = source.MemoryManager.Allocate<TPixel>(width))
using (IBuffer<float> amount = source.MemoryManager.Allocate<float>(width))
{
// Be careful! Do not capture colorSpan & amountSpan in the lambda below!
Span<TPixel> colorSpan = colors.Span;
Span<float> amountSpan = amount.Span;
// TODO: Use Span.Fill?
for (int i = 0; i < width; i++)
{
colorSpan[i] = this.Value;
@ -92,7 +89,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
Span<TPixel> destination = source.GetPixelRowSpan(y - startY).Slice(minX - startX, width);
// This switched color & destination in the 2nd and 3rd places because we are applying the target color under the current one
blender.Blend(this.memoryManager, destination, colors.Span, destination, amount.Span);
blender.Blend(source.MemoryManager, destination, colors.Span, destination, amount.Span);
});
}
}

2
src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs → src/ImageSharp/Processing/Overlays/Processors/GlowProcessor.cs

@ -11,7 +11,7 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
namespace SixLabors.ImageSharp.Processing.Overlays.Processors
{
/// <summary>
/// An <see cref="IImageProcessor{TPixel}"/> that applies a radial glow effect an <see cref="Image{TPixel}"/>.

2
src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs → src/ImageSharp/Processing/Overlays/Processors/VignetteProcessor.cs

@ -11,7 +11,7 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Overlays
namespace SixLabors.ImageSharp.Processing.Overlays.Processors
{
/// <summary>
/// An <see cref="IImageProcessor{TPixel}"/> that applies a radial vignette effect to an <see cref="Image{TPixel}"/>.

37
src/ImageSharp/Processing/Overlays/Vignette.cs → src/ImageSharp/Processing/Overlays/VignetteExtensions.cs

@ -3,16 +3,15 @@
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp
namespace SixLabors.ImageSharp.Processing.Overlays
{
/// <summary>
/// Extension methods for the <see cref="Image{TPixel}"/> type.
/// Adds extensions that allow the application of a radial glow to the <see cref="Image{TPixel}"/> type.
/// </summary>
public static partial class ImageExtensions
public static class VignetteExtensions
{
/// <summary>
/// Applies a radial vignette effect to an image.
@ -22,9 +21,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source)
where TPixel : struct, IPixel<TPixel>
{
return Vignette(source, GraphicsOptions.Default);
}
=> Vignette(source, GraphicsOptions.Default);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -35,9 +32,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color)
where TPixel : struct, IPixel<TPixel>
{
return Vignette(source, color, GraphicsOptions.Default);
}
=> Vignette(source, color, GraphicsOptions.Default);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -49,9 +44,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, float radiusX, float radiusY)
where TPixel : struct, IPixel<TPixel>
{
return Vignette(source, radiusX, radiusY, GraphicsOptions.Default);
}
=> Vignette(source, radiusX, radiusY, GraphicsOptions.Default);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -64,9 +57,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel>
{
return Vignette(source, rectangle, GraphicsOptions.Default);
}
=> Vignette(source, rectangle, GraphicsOptions.Default);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -82,7 +73,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radiusX, float radiusY, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel>
=> source.Vignette(color, radiusX, radiusY, rectangle, GraphicsOptions.Default);
=> source.Vignette(color, radiusX, radiusY, rectangle, GraphicsOptions.Default);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -93,7 +84,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options);
=> source.VignetteInternal(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -105,7 +96,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(color, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options);
=> source.VignetteInternal(color, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -118,7 +109,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, float radiusX, float radiusY, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(NamedColors<TPixel>.Black, radiusX, radiusY, options);
=> source.VignetteInternal(NamedColors<TPixel>.Black, radiusX, radiusY, options);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -132,7 +123,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), rectangle, options);
=> source.VignetteInternal(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), rectangle, options);
/// <summary>
/// Applies a radial vignette effect to an image.
@ -149,7 +140,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radiusX, float radiusY, Rectangle rectangle, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(color, radiusX, radiusY, rectangle, options);
=> source.VignetteInternal(color, radiusX, radiusY, rectangle, options);
private static IImageProcessingContext<TPixel> VignetteInternal<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, ValueSize radiusX, ValueSize radiusY, Rectangle rectangle, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel>

29
src/ImageSharp/ApplyProcessors.cs → src/ImageSharp/Processing/ProcessingExtensions.cs

@ -4,14 +4,27 @@
using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
namespace SixLabors.ImageSharp
namespace SixLabors.ImageSharp.Processing
{
/// <summary>
/// Extension methods for the <see cref="Image{TPixel}"/> type.
/// Adds extensions that allow the processing of images to the <see cref="Image{TPixel}"/> type.
/// </summary>
public static partial class ImageExtensions
public static class ProcessingExtensions
{
/// <summary>
/// Applies the given operation to the mutable image.
/// Useful when we need to extract information like Width/Height to parametrize the next operation working on the <see cref="IImageProcessingContext{TPixel}"/> chain.
/// To achieve this the method actually implements an "inline" <see cref="IImageProcessor{TPixel}"/> with <paramref name="operation"/> as it's processing logic.
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image to mutate.</param>
/// <param name="operation">The operation to perform on the source.</param>
/// <returns>The <see cref="IImageProcessingContext{TPixel}"/> to allow chaining of operations.</returns>
public static IImageProcessingContext<TPixel> Apply<TPixel>(this IImageProcessingContext<TPixel> source, Action<Image<TPixel>> operation)
where TPixel : struct, IPixel<TPixel> => source.ApplyProcessor(new DelegateProcessor<TPixel>(operation));
/// <summary>
/// Mutates the source image by applying the image operation to it.
/// </summary>
@ -52,7 +65,7 @@ namespace SixLabors.ImageSharp
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image to clone.</param>
/// <param name="operation">The operation to perform on the clone.</param>
/// <returns>The new <see cref="Image{TPixel}"/></returns>
/// <returns>The new <see cref="SixLabors.ImageSharp.Image{TPixel}"/></returns>
public static Image<TPixel> Clone<TPixel>(this Image<TPixel> source, Action<IImageProcessingContext<TPixel>> operation)
where TPixel : struct, IPixel<TPixel>
{
@ -70,7 +83,7 @@ namespace SixLabors.ImageSharp
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image to clone.</param>
/// <param name="operations">The operations to perform on the clone.</param>
/// <returns>The new <see cref="Image{TPixel}"/></returns>
/// <returns>The new <see cref="SixLabors.ImageSharp.Image{TPixel}"/></returns>
public static Image<TPixel> Clone<TPixel>(this Image<TPixel> source, params IImageProcessor<TPixel>[] operations)
where TPixel : struct, IPixel<TPixel>
{
@ -83,14 +96,14 @@ namespace SixLabors.ImageSharp
}
/// <summary>
/// Applies the given <see cref="IImageProcessor{TPixel}"/> collection against the context
/// Applies the given <see cref="SixLabors.ImageSharp.IImageProcessor{TPixel}"/> collection against the context
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image processing context.</param>
/// <param name="operations">The operations to perform on the source.</param>
/// <returns>The <see cref="IImageProcessingContext{TPixel}"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessor{TPixel}"/> to allow chaining of operations.</returns>
public static IImageProcessingContext<TPixel> ApplyProcessors<TPixel>(this IImageProcessingContext<TPixel> source, params IImageProcessor<TPixel>[] operations)
where TPixel : struct, IPixel<TPixel>
where TPixel : struct, IPixel<TPixel>
{
foreach (IImageProcessor<TPixel> p in operations)
{

4
src/ImageSharp/Processing/Processors/CloningImageProcessor.cs

@ -6,10 +6,10 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
namespace SixLabors.ImageSharp.Processing.Processors
{
/// <summary>
/// Allows the application of processors to images.
/// Allows the application of processing algorithms to a clone of the original image.
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
internal abstract class CloningImageProcessor<TPixel> : ICloningImageProcessor<TPixel>

4
src/ImageSharp/Processing/Processors/DelegateProcessor.cs

@ -5,10 +5,10 @@ using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing
namespace SixLabors.ImageSharp.Processing.Processors
{
/// <summary>
/// Allows the application of processors to images.
/// Allows the application of processing algorithms to images via an action delegate
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
internal class DelegateProcessor<TPixel> : ImageProcessor<TPixel>

0
src/ImageSharp/Quantizers/Box.cs → src/ImageSharp/Processing/Quantization/Box.cs

0
src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs → src/ImageSharp/Processing/Quantization/IQuantizer{TPixel}.cs

0
src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs → src/ImageSharp/Processing/Quantization/OctreeQuantizer{TPixel}.cs

0
src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs → src/ImageSharp/Processing/Quantization/PaletteQuantizer{TPixel}.cs

0
src/ImageSharp/Quantizers/Quantization.cs → src/ImageSharp/Processing/Quantization/Quantization.cs

1
src/ImageSharp/Quantizers/Quantize.cs → src/ImageSharp/Processing/Quantization/Quantize.cs

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Quantizers;
namespace SixLabors.ImageSharp

0
src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs → src/ImageSharp/Processing/Quantization/QuantizedImage{TPixel}.cs

0
src/ImageSharp/Quantizers/QuantizerBase{TPixel}.cs → src/ImageSharp/Processing/Quantization/QuantizerBase{TPixel}.cs

0
src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs → src/ImageSharp/Processing/Quantization/WuQuantizer{TPixel}.cs

0
src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/AffineTransformProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/AutoOrientProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/CenteredAffineTransformProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/CenteredAffineTransformProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/CenteredProjectiveTransformProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/CenteredProjectiveTransformProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/CropProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/EntropyCropProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/FlipProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/InterpolatedTransformProcessorBase.cs → src/ImageSharp/Processing/Transforms/Processors/InterpolatedTransformProcessorBase.cs

0
src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/ProjectiveTransformProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/ResizeProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/RotateProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs → src/ImageSharp/Processing/Transforms/Processors/SkewProcessor.cs

0
src/ImageSharp/Processing/Processors/Transforms/TransformProcessorBase.cs → src/ImageSharp/Processing/Transforms/Processors/TransformProcessorBase.cs

0
src/ImageSharp/Processing/Processors/Transforms/WeightsBuffer.cs → src/ImageSharp/Processing/Transforms/Processors/WeightsBuffer.cs

0
src/ImageSharp/Processing/Processors/Transforms/WeightsWindow.cs → src/ImageSharp/Processing/Transforms/Processors/WeightsWindow.cs

2
tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs

@ -12,7 +12,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
public class DrawBeziers : BenchmarkBase
{

1
tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs

@ -13,6 +13,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
public class DrawLines : BenchmarkBase
{

1
tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs

@ -14,6 +14,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
public class DrawPolygon : BenchmarkBase
{

1
tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs

@ -14,6 +14,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
public class FillPolygon : BenchmarkBase
{

11
tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs

@ -15,6 +15,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
public class FillRectangle : BenchmarkBase
{
@ -39,7 +40,7 @@ namespace SixLabors.ImageSharp.Benchmarks
{
using (Image<Rgba32> image = new Image<Rgba32>(800, 800))
{
image.Mutate(x => x.Fill(Rgba32.HotPink, new CoreRectangle(10, 10, 190, 140)));
image.Mutate(x => x.Fill(Rgba32.HotPink, new CoreRectangle(10, 10, 190, 140)));
return new CoreSize(image.Width, image.Height);
}
@ -53,10 +54,10 @@ namespace SixLabors.ImageSharp.Benchmarks
image.Mutate(x => x.FillPolygon(
Rgba32.HotPink,
new SixLabors.Primitives.PointF[] {
new Vector2(10, 10),
new Vector2(200, 10),
new Vector2(200, 150),
new Vector2(10, 150) }));
new Vector2(10, 10),
new Vector2(200, 10),
new Vector2(200, 150),
new Vector2(10, 150) }));
return new CoreSize(image.Width, image.Height);
}

1
tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs

@ -14,6 +14,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using SixLabors.ImageSharp.Drawing.Brushes;
using CoreBrushes = ImageSharp.Drawing.Brushes.Brushes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
public class FillWithPattern
{

1
tests/ImageSharp.Benchmarks/Samplers/Crop.cs

@ -11,6 +11,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using CoreSize = SixLabors.Primitives.Size;

5
tests/ImageSharp.Benchmarks/Samplers/Glow.cs

@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
using CoreSize = SixLabors.Primitives.Size;
using SixLabors.ImageSharp.Processing;
using System.Numerics;
@ -18,8 +18,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using SixLabors.ImageSharp.Memory;
using SixLabors.Primitives;
using SixLabors.ImageSharp.Helpers;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
public class Glow : BenchmarkBase
{

1
tests/ImageSharp.Benchmarks/Samplers/Resize.cs

@ -11,6 +11,7 @@ namespace SixLabors.ImageSharp.Benchmarks
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using CoreSize = SixLabors.Primitives.Size;

3
tests/ImageSharp.Tests/Drawing/BeziersTests.cs

@ -12,6 +12,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class Beziers : FileTestBase
{
[Fact]

2
tests/ImageSharp.Tests/Drawing/BlendedShapes.cs

@ -11,6 +11,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
public class BlendedShapes
{
public static IEnumerable<object[]> modes = ((PixelBlenderMode[])Enum.GetValues(typeof(PixelBlenderMode)))

3
tests/ImageSharp.Tests/Drawing/DrawPathTests.cs

@ -11,6 +11,9 @@ using ShapePath = SixLabors.Shapes.Path;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class DrawPathTests : FileTestBase
{
[Fact]

9
tests/ImageSharp.Tests/Drawing/FillPatternTests.cs

@ -11,6 +11,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
public class FillPatternBrushTests : FileTestBase
{
private void Test(string name, Rgba32 background, IBrush<Rgba32> brush, Rgba32[,] expectedPattern)
@ -28,9 +31,9 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
// lets pick random spots to start checking
Random r = new Random();
Fast2DArray<Rgba32> expectedPatternFast = new Fast2DArray<Rgba32>(expectedPattern);
int xStride = expectedPatternFast.Width;
int yStride = expectedPatternFast.Height;
DenseMatrix<Rgba32> expectedPatternFast = new DenseMatrix<Rgba32>(expectedPattern);
int xStride = expectedPatternFast.Columns;
int yStride = expectedPatternFast.Rows;
int offsetX = r.Next(image.Width / xStride) * xStride;
int offsetY = r.Next(image.Height / yStride) * yStride;
for (int x = 0; x < xStride; x++)

2
tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs

@ -12,6 +12,8 @@ using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
public class FillRegionProcessorTests
{
[Theory]

3
tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs

@ -12,6 +12,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class FillSolidBrushTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs

@ -12,6 +12,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class LineComplexPolygonTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/LineTests.cs

@ -10,6 +10,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class LineTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/PolygonTests.cs

@ -13,6 +13,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class PolygonTests : FileTestBase
{
[Fact]

2
tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs

@ -10,6 +10,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Processing;
public class RecolorImageTest : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs

@ -9,6 +9,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
[GroupOutput("Drawing")]
public class SolidBezierTests
{

3
tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs

@ -11,6 +11,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class SolidComplexPolygonTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs

@ -14,6 +14,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class SolidPolygonTests : FileTestBase
{
[Fact]

1
tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using Xunit.Abstractions;

2
tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs

@ -14,6 +14,8 @@ namespace SixLabors.ImageSharp.Tests
{
using System;
using SixLabors.ImageSharp.Processing;
public class GeneralFormatTests : FileTestBase
{
[Theory]

1
tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs

@ -13,6 +13,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
using SixLabors.Primitives;

1
tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs

@ -14,6 +14,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Quantizers;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;

2
tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs

@ -10,6 +10,8 @@ using SixLabors.ImageSharp.Formats.Png;
namespace SixLabors.ImageSharp.Tests.Formats.Png
{
using SixLabors.ImageSharp.Processing;
public class PngSmokeTests
{
[Theory]

3
tests/ImageSharp.Tests/Image/ImageProcessingContextTests.cs

@ -1,11 +1,14 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
//using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Processing;
public class ImageProcessingContextTests
{
[Fact]

2
tests/ImageSharp.Tests/Image/ImageRotationTests.cs

@ -7,6 +7,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Processing;
public class ImageRotationTests
{
[Fact]

2
tests/ImageSharp.Tests/Issues/Issue412.cs

@ -8,6 +8,8 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Tests.Issues
{
using SixLabors.ImageSharp.Processing;
public class Issue412
{
[Theory]

89
tests/ImageSharp.Tests/Memory/Fast2DArrayTests.cs

@ -1,89 +0,0 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.ImageSharp.Tests.Memory
{
using System;
using SixLabors.ImageSharp.Memory;
using Xunit;
public class Fast2DArrayTests
{
private static readonly float[,] FloydSteinbergMatrix =
{
{ 0, 0, 7 },
{ 3, 5, 1 }
};
[Fact]
public void Fast2DArrayThrowsOnNullInitializer()
{
Assert.Throws<ArgumentNullException>(() =>
{
var fast = new Fast2DArray<float>(null);
});
}
[Fact]
public void Fast2DArrayThrowsOnEmptyZeroWidth()
{
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
var fast = new Fast2DArray<float>(0, 10);
});
}
[Fact]
public void Fast2DArrayThrowsOnEmptyZeroHeight()
{
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
var fast = new Fast2DArray<float>(10, 0);
});
}
[Fact]
public void Fast2DArrayThrowsOnEmptyInitializer()
{
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
var fast = new Fast2DArray<float>(new float[0, 0]);
});
}
[Fact]
public void Fast2DArrayReturnsCorrectDimensions()
{
var fast = new Fast2DArray<float>(FloydSteinbergMatrix);
Assert.True(fast.Width == FloydSteinbergMatrix.GetLength(1));
Assert.True(fast.Height == FloydSteinbergMatrix.GetLength(0));
}
[Fact]
public void Fast2DArrayGetReturnsCorrectResults()
{
Fast2DArray<float> fast = FloydSteinbergMatrix;
for (int row = 0; row < fast.Height; row++)
{
for (int column = 0; column < fast.Width; column++)
{
Assert.True(Math.Abs(fast[row, column] - FloydSteinbergMatrix[row, column]) < Constants.Epsilon);
}
}
}
[Fact]
public void Fast2DArrayGetSetReturnsCorrectResults()
{
var fast = new Fast2DArray<float>(4, 4);
const float Val = 5F;
fast[3, 3] = Val;
Assert.True(Math.Abs(Val - fast[3, 3]) < Constants.Epsilon);
}
}
}

6
tests/ImageSharp.Tests/MetaData/Profiles/ICC/DataWriter/IccDataWriter.MatrixTests.cs

@ -8,6 +8,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Icc
{
using SixLabors.ImageSharp.Primitives;
public class IccDataWriterMatrixTests
{
[Theory]
@ -35,8 +37,8 @@ namespace SixLabors.ImageSharp.Tests.Icc
}
[Theory]
[MemberData(nameof(IccTestDataMatrix.Matrix2D_Fast2DArrayTestData), MemberType = typeof(IccTestDataMatrix))]
internal void WriteMatrix2D_Fast2DArray(byte[] expected, int xCount, int yCount, bool isSingle, Fast2DArray<float> data)
[MemberData(nameof(IccTestDataMatrix.Matrix2D_DenseMatrixTestData), MemberType = typeof(IccTestDataMatrix))]
internal void WriteMatrix2D_DenseMatrix(byte[] expected, int xCount, int yCount, bool isSingle, DenseMatrix<float> data)
{
IccDataWriter writer = CreateWriter();

34
tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs

@ -7,16 +7,18 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{
using SixLabors.ImageSharp.Primitives;
public class OrderedDitherFactoryTests
{
private static readonly Fast2DArray<uint> Expected2x2Matrix = new Fast2DArray<uint>(
private static readonly DenseMatrix<uint> Expected2x2Matrix = new DenseMatrix<uint>(
new uint[2, 2]
{
{ 0, 2 },
{ 3, 1 }
});
private static readonly Fast2DArray<uint> Expected3x3Matrix = new Fast2DArray<uint>(
private static readonly DenseMatrix<uint> Expected3x3Matrix = new DenseMatrix<uint>(
new uint[3, 3]
{
{ 0, 5, 2 },
@ -24,7 +26,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{ 3, 6, 1 }
});
private static readonly Fast2DArray<uint> Expected4x4Matrix = new Fast2DArray<uint>(
private static readonly DenseMatrix<uint> Expected4x4Matrix = new DenseMatrix<uint>(
new uint[4, 4]
{
{ 0, 8, 2, 10 },
@ -33,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{ 15, 7, 13, 5 }
});
private static readonly Fast2DArray<uint> Expected8x8Matrix = new Fast2DArray<uint>(
private static readonly DenseMatrix<uint> Expected8x8Matrix = new DenseMatrix<uint>(
new uint[8, 8]
{
{ 0, 32, 8, 40, 2, 34, 10, 42 },
@ -50,10 +52,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void OrderedDitherFactoryCreatesCorrect2x2Matrix()
{
Fast2DArray<uint> actual = OrderedDitherFactory.CreateDitherMatrix(2);
for (int y = 0; y < actual.Height; y++)
DenseMatrix<uint> actual = OrderedDitherFactory.CreateDitherMatrix(2);
for (int y = 0; y < actual.Rows; y++)
{
for (int x = 0; x < actual.Width; x++)
for (int x = 0; x < actual.Columns; x++)
{
Assert.Equal(Expected2x2Matrix[y, x], actual[y, x]);
}
@ -63,10 +65,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void OrderedDitherFactoryCreatesCorrect3x3Matrix()
{
Fast2DArray<uint> actual = OrderedDitherFactory.CreateDitherMatrix(3);
for (int y = 0; y < actual.Height; y++)
DenseMatrix<uint> actual = OrderedDitherFactory.CreateDitherMatrix(3);
for (int y = 0; y < actual.Rows; y++)
{
for (int x = 0; x < actual.Width; x++)
for (int x = 0; x < actual.Columns; x++)
{
Assert.Equal(Expected3x3Matrix[y, x], actual[y, x]);
}
@ -76,10 +78,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void OrderedDitherFactoryCreatesCorrect4x4Matrix()
{
Fast2DArray<uint> actual = OrderedDitherFactory.CreateDitherMatrix(4);
for (int y = 0; y < actual.Height; y++)
DenseMatrix<uint> actual = OrderedDitherFactory.CreateDitherMatrix(4);
for (int y = 0; y < actual.Rows; y++)
{
for (int x = 0; x < actual.Width; x++)
for (int x = 0; x < actual.Columns; x++)
{
Assert.Equal(Expected4x4Matrix[y, x], actual[y, x]);
}
@ -89,10 +91,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void OrderedDitherFactoryCreatesCorrect8x8Matrix()
{
Fast2DArray<uint> actual = OrderedDitherFactory.CreateDitherMatrix(8);
for (int y = 0; y < actual.Height; y++)
DenseMatrix<uint> actual = OrderedDitherFactory.CreateDitherMatrix(8);
for (int y = 0; y < actual.Rows; y++)
{
for (int x = 0; x < actual.Width; x++)
for (int x = 0; x < actual.Columns; x++)
{
Assert.Equal(Expected8x8Matrix[y, x], actual[y, x]);
}

2
tests/ImageSharp.Tests/Processing/DelegateTest.cs

@ -8,6 +8,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing
{
using SixLabors.ImageSharp.Processing.Processors;
public class DelegateTest : BaseImageOperationsExtensionTest
{
[Fact]

3
tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs

@ -8,6 +8,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Effects
{
using SixLabors.ImageSharp.Processing.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
public class BackgroundColorTest : BaseImageOperationsExtensionTest
{
[Fact]

8
tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs

@ -2,16 +2,14 @@
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Overlays
{
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
public class GlowTest : BaseImageOperationsExtensionTest
{
[Fact]

10
tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs

@ -1,18 +1,14 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Tests.TestUtilities;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Overlays;
using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Overlays
{
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
public class VignetteTest : BaseImageOperationsExtensionTest
{
[Fact]

1
tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs

@ -11,6 +11,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Binarization;
public class BinaryDitherTests : FileTestBase

1
tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Binarization;
public class BinaryThresholdTest : FileTestBase

1
tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Convolution;
public class BoxBlurTest : FileTestBase

1
tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Convolution;
public class GaussianBlurTest : FileTestBase

1
tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Convolution;
public class GaussianSharpenTest : FileTestBase

1
tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs

@ -11,6 +11,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Dithering;
public class DitherTests : FileTestBase

3
tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs

@ -9,6 +9,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class BackgroundColorTest : FileTestBase
{
[Theory]

1
tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Effects;
public class OilPaintTest : FileTestBase

1
tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Effects;
public class PixelateTest : FileTestBase

3
tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs

@ -9,6 +9,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Overlays
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class GlowTest : FileTestBase
{
[Theory]

3
tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs

@ -9,6 +9,9 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Overlays
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Overlays;
public class VignetteTest : FileTestBase
{
[Theory]

2
tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs

@ -6,6 +6,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
using SixLabors.ImageSharp.Processing;
public class CropTest : FileTestBase
{
[Theory]

2
tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs

@ -6,6 +6,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
using SixLabors.ImageSharp.Processing;
public class EntropyCropTest : FileTestBase
{
public static readonly TheoryData<float> EntropyCropValues

2
tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs

@ -6,6 +6,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
using SixLabors.ImageSharp.Processing;
public class PadTest : FileTestBase
{
[Theory]

14
tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs

@ -6,6 +6,8 @@ using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Primitives;
internal static class IccTestDataMatrix
{
#region 2D
@ -42,12 +44,12 @@ namespace SixLabors.ImageSharp.Tests
/// <summary>
/// 3x3 Matrix
/// </summary>
public static readonly Fast2DArray<float> Single_Fast2DArray_ValGrad = new Fast2DArray<float>(Single_2DArray_ValGrad);
public static readonly DenseMatrix<float> Single_DenseMatrix_ValGrad = new DenseMatrix<float>(Single_2DArray_ValGrad);
/// <summary>
/// 3x3 Matrix
/// </summary>
public static readonly Fast2DArray<float> Single_Fast2DArray_ValIdentity = new Fast2DArray<float>(Single_2DArray_ValIdentity);
public static readonly DenseMatrix<float> Single_DenseMatrix_ValIdentity = new DenseMatrix<float>(Single_2DArray_ValIdentity);
/// <summary>
/// 3x3 Matrix
@ -110,11 +112,11 @@ namespace SixLabors.ImageSharp.Tests
new object[] { Single_2D_Grad, 3, 3, true, Single_2DArray_ValGrad },
};
public static readonly object[][] Matrix2D_Fast2DArrayTestData =
public static readonly object[][] Matrix2D_DenseMatrixTestData =
{
new object[] { Fix16_2D_Grad, 3, 3, false, Single_Fast2DArray_ValGrad },
new object[] { Fix16_2D_Identity, 3, 3, false, Single_Fast2DArray_ValIdentity },
new object[] { Single_2D_Grad, 3, 3, true, Single_Fast2DArray_ValGrad },
new object[] { Fix16_2D_Grad, 3, 3, false, Single_DenseMatrix_ValGrad },
new object[] { Fix16_2D_Identity, 3, 3, false, Single_DenseMatrix_ValIdentity },
new object[] { Single_2D_Grad, 3, 3, true, Single_DenseMatrix_ValGrad },
};
public static readonly object[][] Matrix2D_Matrix4x4TestData =

2
tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs

@ -9,6 +9,8 @@ using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Processing;
/// <summary>
/// Provides <see cref="Image{TPixel}" /> instances for parametric unit tests.
/// </summary>

2
tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs

@ -13,6 +13,8 @@ namespace SixLabors.ImageSharp.Tests
{
using Castle.Core.Internal;
using SixLabors.ImageSharp.Processing;
public interface ITestImageProvider
{
PixelTypes PixelType { get; }

1
tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

@ -17,6 +17,7 @@ namespace SixLabors.ImageSharp.Tests
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.Processing;
using Xunit;

1
tests/ImageSharp.Tests/TestUtilities/TestUtils.cs

@ -10,6 +10,7 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using SixLabors.Primitives;

1
tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs

@ -13,6 +13,7 @@ namespace SixLabors.ImageSharp.Tests
using Xunit;
using Xunit.Abstractions;
using SixLabors.ImageSharp.Processing;
public class ImageComparerTests
{

1
tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceCodecTests.cs

@ -3,6 +3,7 @@ namespace SixLabors.ImageSharp.Tests
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;

Loading…
Cancel
Save