Browse Source

Establish naming convention + move missed primitives

- `KnownXXX`. Any open-ended collection of algorithms e.g. `KnownQuantizers`, `KnownResamplers`
- `XXXMode`. Any closed operation enumeration  e.g `AnchorPositionMode`, `FlipMode`
- `XXXType`. Any enumeration of a data type e.g `ExifDataType`.
pull/487/head
James Jackson-South 9 years ago
parent
commit
fd16a60c1a
  1. 2
      src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
  2. 1
      src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
  3. 1
      src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs
  4. 2
      src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs
  5. 1
      src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs
  6. 1
      src/ImageSharp/MetaData/Profiles/Exif/ExifWriter.cs
  7. 2
      src/ImageSharp/Primitives/LongRational.cs
  8. 2
      src/ImageSharp/Primitives/Rational.cs
  9. 2
      src/ImageSharp/Primitives/SignedRational.cs
  10. 4
      src/ImageSharp/Processing/Dithering/DiffuseExtensions.cs
  11. 2
      src/ImageSharp/Processing/Dithering/DitherExtensions.cs
  12. 2
      src/ImageSharp/Processing/Dithering/KnownDiffusers.cs
  13. 2
      src/ImageSharp/Processing/Dithering/KnownDitherMatrices.cs
  14. 24
      src/ImageSharp/Processing/Filters/ColorBlindnessExtensions.cs
  15. 2
      src/ImageSharp/Processing/Filters/ColorBlindnessMode.cs
  16. 2
      src/ImageSharp/Processing/Filters/KnownMatrixFilters.cs
  17. 2
      src/ImageSharp/Processing/Filters/Processors/AchromatomalyProcessor.cs
  18. 2
      src/ImageSharp/Processing/Filters/Processors/AchromatopsiaProcessor.cs
  19. 2
      src/ImageSharp/Processing/Filters/Processors/BlackWhiteProcessor.cs
  20. 2
      src/ImageSharp/Processing/Filters/Processors/BrightnessProcessor.cs
  21. 2
      src/ImageSharp/Processing/Filters/Processors/ContrastProcessor.cs
  22. 2
      src/ImageSharp/Processing/Filters/Processors/DeuteranomalyProcessor.cs
  23. 2
      src/ImageSharp/Processing/Filters/Processors/DeuteranopiaProcessor.cs
  24. 2
      src/ImageSharp/Processing/Filters/Processors/GrayscaleBt601Processor.cs
  25. 2
      src/ImageSharp/Processing/Filters/Processors/GrayscaleBt709Processor.cs
  26. 2
      src/ImageSharp/Processing/Filters/Processors/HueProcessor.cs
  27. 2
      src/ImageSharp/Processing/Filters/Processors/InvertProcessor.cs
  28. 2
      src/ImageSharp/Processing/Filters/Processors/KodachromeProcessor.cs
  29. 2
      src/ImageSharp/Processing/Filters/Processors/LomographProcessor.cs
  30. 2
      src/ImageSharp/Processing/Filters/Processors/OpacityProcessor.cs
  31. 2
      src/ImageSharp/Processing/Filters/Processors/PolaroidProcessor.cs
  32. 2
      src/ImageSharp/Processing/Filters/Processors/ProtanomalyProcessor.cs
  33. 2
      src/ImageSharp/Processing/Filters/Processors/ProtanopiaProcessor.cs
  34. 2
      src/ImageSharp/Processing/Filters/Processors/SaturateProcessor.cs
  35. 2
      src/ImageSharp/Processing/Filters/Processors/SepiaProcessor.cs
  36. 2
      src/ImageSharp/Processing/Filters/Processors/TritanomalyProcessor.cs
  37. 2
      src/ImageSharp/Processing/Filters/Processors/TritanopiaProcessor.cs
  38. 2
      src/ImageSharp/Processing/Quantization/KnownQuantizers.cs
  39. 2
      src/ImageSharp/Processing/Quantization/OctreeQuantizer.cs
  40. 2
      src/ImageSharp/Processing/Quantization/PaletteQuantizer.cs
  41. 2
      src/ImageSharp/Processing/Quantization/QuantizeExtensions.cs
  42. 2
      src/ImageSharp/Processing/Quantization/WuQuantizer.cs
  43. 2
      src/ImageSharp/Processing/Transforms/AnchorPositionMode.cs
  44. 6
      src/ImageSharp/Processing/Transforms/FlipExtensions.cs
  45. 2
      src/ImageSharp/Processing/Transforms/FlipMode.cs
  46. 2
      src/ImageSharp/Processing/Transforms/KnownResamplers.cs
  47. 2
      src/ImageSharp/Processing/Transforms/OrientationMode.cs
  48. 2
      src/ImageSharp/Processing/Transforms/PadExtensions.cs
  49. 54
      src/ImageSharp/Processing/Transforms/Processors/AutoOrientProcessor.cs
  50. 16
      src/ImageSharp/Processing/Transforms/Processors/FlipProcessor.cs
  51. 2
      src/ImageSharp/Processing/Transforms/Processors/RotateProcessor.cs
  52. 2
      src/ImageSharp/Processing/Transforms/Processors/SkewProcessor.cs
  53. 8
      src/ImageSharp/Processing/Transforms/ResizeExtensions.cs
  54. 64
      src/ImageSharp/Processing/Transforms/ResizeHelper.cs
  55. 2
      src/ImageSharp/Processing/Transforms/ResizeMode.cs
  56. 4
      src/ImageSharp/Processing/Transforms/ResizeOptions.cs
  57. 8
      src/ImageSharp/Processing/Transforms/RotateExtensions.cs
  58. 8
      src/ImageSharp/Processing/Transforms/RotateFlipExtensions.cs
  59. 2
      src/ImageSharp/Processing/Transforms/RotateMode.cs
  60. 2
      src/ImageSharp/Processing/Transforms/SkewExtensions.cs
  61. 4
      src/ImageSharp/Processing/Transforms/TransformExtensions.cs
  62. 2
      tests/ImageSharp.Tests/Drawing/DrawImageTest.cs
  63. 6
      tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs
  64. 2
      tests/ImageSharp.Tests/MetaData/ImageMetaDataTests.cs
  65. 2
      tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs
  66. 2
      tests/ImageSharp.Tests/Numerics/RationalTests.cs
  67. 2
      tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
  68. 4
      tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs
  69. 4
      tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs
  70. 20
      tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs
  71. 4
      tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs
  72. 30
      tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs
  73. 30
      tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs
  74. 22
      tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs
  75. 6
      tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs
  76. 24
      tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs
  77. 12
      tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs
  78. 2
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeProfilingBenchmarks.cs
  79. 38
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
  80. 16
      tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs
  81. 14
      tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs
  82. 32
      tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs
  83. 48
      tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs
  84. 10
      tests/ImageSharp.Tests/Processing/Transforms/FlipTests.cs
  85. 2
      tests/ImageSharp.Tests/Processing/Transforms/PadTest.cs
  86. 6
      tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs
  87. 28
      tests/ImageSharp.Tests/Processing/Transforms/RotateFlipTests.cs
  88. 10
      tests/ImageSharp.Tests/Processing/Transforms/RotateTests.cs

2
src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs

@ -3,7 +3,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.Formats.Jpeg.Common;
using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder;
using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder;
@ -11,6 +10,7 @@ using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.MetaData.Profiles.Icc; using SixLabors.ImageSharp.MetaData.Profiles.Icc;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives; using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort

1
src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs

@ -12,6 +12,7 @@ using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.MetaData.Profiles.Icc; using SixLabors.ImageSharp.MetaData.Profiles.Icc;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
{ {

1
src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.MetaData.Profiles.Exif namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
{ {

2
src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs

@ -1,10 +1,12 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.MetaData.Profiles.Exif namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
{ {

1
src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs

@ -4,6 +4,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.MetaData.Profiles.Exif namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
{ {

1
src/ImageSharp/MetaData/Profiles/Exif/ExifWriter.cs

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Text; using System.Text;
using SixLabors.ImageSharp.Primitives;
namespace SixLabors.ImageSharp.MetaData.Profiles.Exif namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
{ {

2
src/ImageSharp/MetaData/Profiles/Exif/LongRational.cs → src/ImageSharp/Primitives/LongRational.cs

@ -5,7 +5,7 @@ using System;
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
namespace SixLabors.ImageSharp.MetaData.Profiles.Exif namespace SixLabors.ImageSharp.Primitives
{ {
/// <summary> /// <summary>
/// Represents a number that can be expressed as a fraction /// Represents a number that can be expressed as a fraction

2
src/ImageSharp/MetaData/Profiles/Exif/Rational.cs → src/ImageSharp/Primitives/Rational.cs

@ -4,7 +4,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace SixLabors.ImageSharp.MetaData.Profiles.Exif namespace SixLabors.ImageSharp.Primitives
{ {
/// <summary> /// <summary>
/// Represents a number that can be expressed as a fraction. /// Represents a number that can be expressed as a fraction.

2
src/ImageSharp/MetaData/Profiles/Exif/SignedRational.cs → src/ImageSharp/Primitives/SignedRational.cs

@ -4,7 +4,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace SixLabors.ImageSharp.MetaData.Profiles.Exif namespace SixLabors.ImageSharp.Primitives
{ {
/// <summary> /// <summary>
/// Represents a number that can be expressed as a fraction. /// Represents a number that can be expressed as a fraction.

4
src/ImageSharp/Processing/Dithering/DiffuseExtensions.cs

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Dithering
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Diffuse<TPixel>(this IImageProcessingContext<TPixel> source) public static IImageProcessingContext<TPixel> Diffuse<TPixel>(this IImageProcessingContext<TPixel> source)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Diffuse(source, DiffuseMode.FloydSteinberg, .5F); => Diffuse(source, KnownDiffusers.FloydSteinberg, .5F);
/// <summary> /// <summary>
/// Dithers the image reducing it to a web-safe palette using error diffusion. /// Dithers the image reducing it to a web-safe palette using error diffusion.
@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Processing.Dithering
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Diffuse<TPixel>(this IImageProcessingContext<TPixel> source, float threshold) public static IImageProcessingContext<TPixel> Diffuse<TPixel>(this IImageProcessingContext<TPixel> source, float threshold)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Diffuse(source, DiffuseMode.FloydSteinberg, threshold); => Diffuse(source, KnownDiffusers.FloydSteinberg, threshold);
/// <summary> /// <summary>
/// Dithers the image reducing it to a web-safe palette using error diffusion. /// Dithers the image reducing it to a web-safe palette using error diffusion.

2
src/ImageSharp/Processing/Dithering/DitherExtensions.cs

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Dithering
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Dither<TPixel>(this IImageProcessingContext<TPixel> source) public static IImageProcessingContext<TPixel> Dither<TPixel>(this IImageProcessingContext<TPixel> source)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Dither(source, DitherMode.BayerDither4x4); => Dither(source, KnownDitherMatrices.BayerDither4x4);
/// <summary> /// <summary>
/// Dithers the image reducing it to a web-safe palette using ordered dithering. /// Dithers the image reducing it to a web-safe palette using ordered dithering.

2
src/ImageSharp/Processing/Dithering/DiffuseMode.cs → src/ImageSharp/Processing/Dithering/KnownDiffusers.cs

@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp.Processing.Dithering
/// <summary> /// <summary>
/// Contains reusable static instances of known error diffusion algorithms /// Contains reusable static instances of known error diffusion algorithms
/// </summary> /// </summary>
public static class DiffuseMode public static class KnownDiffusers
{ {
/// <summary> /// <summary>
/// Gets the error diffuser that implements the Atkinson algorithm. /// Gets the error diffuser that implements the Atkinson algorithm.

2
src/ImageSharp/Processing/Dithering/DitherMode.cs → src/ImageSharp/Processing/Dithering/KnownDitherMatrices.cs

@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp.Processing.Dithering
/// <summary> /// <summary>
/// Contains reusable static instances of known ordered dither matrices /// Contains reusable static instances of known ordered dither matrices
/// </summary> /// </summary>
public class DitherMode public class KnownDitherMatrices
{ {
/// <summary> /// <summary>
/// Gets the order ditherer using the 2x2 Bayer dithering matrix /// Gets the order ditherer using the 2x2 Bayer dithering matrix

24
src/ImageSharp/Processing/Filters/ColorBlindnessExtensions.cs

@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Processing.Filters
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="colorBlindness">The type of color blindness simulator to apply.</param> /// <param name="colorBlindness">The type of color blindness simulator to apply.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> ColorBlindness<TPixel>(this IImageProcessingContext<TPixel> source, ColorBlindness colorBlindness) public static IImageProcessingContext<TPixel> ColorBlindness<TPixel>(this IImageProcessingContext<TPixel> source, ColorBlindnessMode colorBlindness)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(GetProcessor<TPixel>(colorBlindness)); => source.ApplyProcessor(GetProcessor<TPixel>(colorBlindness));
@ -29,33 +29,33 @@ namespace SixLabors.ImageSharp.Processing.Filters
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="colorBlindness">The type of color blindness simulator to apply.</param> /// <param name="colorBlindnessMode">The type of color blindness simulator to apply.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> ColorBlindness<TPixel>(this IImageProcessingContext<TPixel> source, ColorBlindness colorBlindness, Rectangle rectangle) public static IImageProcessingContext<TPixel> ColorBlindness<TPixel>(this IImageProcessingContext<TPixel> source, ColorBlindnessMode colorBlindnessMode, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(GetProcessor<TPixel>(colorBlindness), rectangle); => source.ApplyProcessor(GetProcessor<TPixel>(colorBlindnessMode), rectangle);
private static IImageProcessor<TPixel> GetProcessor<TPixel>(ColorBlindness colorBlindness) private static IImageProcessor<TPixel> GetProcessor<TPixel>(ColorBlindnessMode colorBlindness)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
switch (colorBlindness) switch (colorBlindness)
{ {
case Filters.ColorBlindness.Achromatomaly: case ColorBlindnessMode.Achromatomaly:
return new AchromatomalyProcessor<TPixel>(); return new AchromatomalyProcessor<TPixel>();
case Filters.ColorBlindness.Achromatopsia: case ColorBlindnessMode.Achromatopsia:
return new AchromatopsiaProcessor<TPixel>(); return new AchromatopsiaProcessor<TPixel>();
case Filters.ColorBlindness.Deuteranomaly: case ColorBlindnessMode.Deuteranomaly:
return new DeuteranomalyProcessor<TPixel>(); return new DeuteranomalyProcessor<TPixel>();
case Filters.ColorBlindness.Deuteranopia: case ColorBlindnessMode.Deuteranopia:
return new DeuteranopiaProcessor<TPixel>(); return new DeuteranopiaProcessor<TPixel>();
case Filters.ColorBlindness.Protanomaly: case ColorBlindnessMode.Protanomaly:
return new ProtanomalyProcessor<TPixel>(); return new ProtanomalyProcessor<TPixel>();
case Filters.ColorBlindness.Protanopia: case ColorBlindnessMode.Protanopia:
return new ProtanopiaProcessor<TPixel>(); return new ProtanopiaProcessor<TPixel>();
case Filters.ColorBlindness.Tritanomaly: case ColorBlindnessMode.Tritanomaly:
return new TritanomalyProcessor<TPixel>(); return new TritanomalyProcessor<TPixel>();
default: default:
return new TritanopiaProcessor<TPixel>(); return new TritanopiaProcessor<TPixel>();

2
src/ImageSharp/Processing/Filters/ColorBlindness.cs → src/ImageSharp/Processing/Filters/ColorBlindnessMode.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Processing.Filters
/// <summary> /// <summary>
/// Enumerates the various types of defined color blindness filters. /// Enumerates the various types of defined color blindness filters.
/// </summary> /// </summary>
public enum ColorBlindness public enum ColorBlindnessMode
{ {
/// <summary> /// <summary>
/// Partial color desensitivity. /// Partial color desensitivity.

2
src/ImageSharp/Processing/Filters/MatrixFilters.cs → src/ImageSharp/Processing/Filters/KnownMatrixFilters.cs

@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Processing.Filters
/// <summary> /// <summary>
/// A collection of known <see cref="Matrix4x4"/> values for composing filters /// A collection of known <see cref="Matrix4x4"/> values for composing filters
/// </summary> /// </summary>
public static class MatrixFilters public static class KnownMatrixFilters
{ {
/// <summary> /// <summary>
/// Gets a filter recreating Achromatomaly (Color desensitivity) color blindness /// Gets a filter recreating Achromatomaly (Color desensitivity) color blindness

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="AchromatomalyProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="AchromatomalyProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public AchromatomalyProcessor() public AchromatomalyProcessor()
: base(MatrixFilters.AchromatomalyFilter) : base(KnownMatrixFilters.AchromatomalyFilter)
{ {
} }
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="AchromatopsiaProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="AchromatopsiaProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public AchromatopsiaProcessor() public AchromatopsiaProcessor()
: base(MatrixFilters.AchromatopsiaFilter) : base(KnownMatrixFilters.AchromatopsiaFilter)
{ {
} }
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="BlackWhiteProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="BlackWhiteProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public BlackWhiteProcessor() public BlackWhiteProcessor()
: base(MatrixFilters.BlackWhiteFilter) : base(KnownMatrixFilters.BlackWhiteFilter)
{ {
} }
} }

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

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </remarks> /// </remarks>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param> /// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
public BrightnessProcessor(float amount) public BrightnessProcessor(float amount)
: base(MatrixFilters.CreateBrightnessFilter(amount)) : base(KnownMatrixFilters.CreateBrightnessFilter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </remarks> /// </remarks>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param> /// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
public ContrastProcessor(float amount) public ContrastProcessor(float amount)
: base(MatrixFilters.CreateContrastFilter(amount)) : base(KnownMatrixFilters.CreateContrastFilter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="DeuteranomalyProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="DeuteranomalyProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public DeuteranomalyProcessor() public DeuteranomalyProcessor()
: base(MatrixFilters.DeuteranomalyFilter) : base(KnownMatrixFilters.DeuteranomalyFilter)
{ {
} }
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="DeuteranopiaProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="DeuteranopiaProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public DeuteranopiaProcessor() public DeuteranopiaProcessor()
: base(MatrixFilters.DeuteranopiaFilter) : base(KnownMatrixFilters.DeuteranopiaFilter)
{ {
} }
} }

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

@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </summary> /// </summary>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param> /// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
public GrayscaleBt601Processor(float amount) public GrayscaleBt601Processor(float amount)
: base(MatrixFilters.CreateGrayscaleBt601Filter(amount)) : base(KnownMatrixFilters.CreateGrayscaleBt601Filter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </summary> /// </summary>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param> /// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
public GrayscaleBt709Processor(float amount) public GrayscaleBt709Processor(float amount)
: base(MatrixFilters.CreateGrayscaleBt709Filter(amount)) : base(KnownMatrixFilters.CreateGrayscaleBt709Filter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </summary> /// </summary>
/// <param name="degrees">The angle of rotation in degrees</param> /// <param name="degrees">The angle of rotation in degrees</param>
public HueProcessor(float degrees) public HueProcessor(float degrees)
: base(MatrixFilters.CreateHueFilter(degrees)) : base(KnownMatrixFilters.CreateHueFilter(degrees))
{ {
this.Degrees = degrees; this.Degrees = degrees;
} }

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

@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </summary> /// </summary>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param> /// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
public InvertProcessor(float amount) public InvertProcessor(float amount)
: base(MatrixFilters.CreateInvertFilter(amount)) : base(KnownMatrixFilters.CreateInvertFilter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="KodachromeProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="KodachromeProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public KodachromeProcessor() public KodachromeProcessor()
: base(MatrixFilters.KodachromeFilter) : base(KnownMatrixFilters.KodachromeFilter)
{ {
} }
} }

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

@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="LomographProcessor{TPixel}" /> class. /// Initializes a new instance of the <see cref="LomographProcessor{TPixel}" /> class.
/// </summary> /// </summary>
public LomographProcessor() public LomographProcessor()
: base(MatrixFilters.LomographFilter) : base(KnownMatrixFilters.LomographFilter)
{ {
} }

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

@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </summary> /// </summary>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param> /// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
public OpacityProcessor(float amount) public OpacityProcessor(float amount)
: base(MatrixFilters.CreateOpacityFilter(amount)) : base(KnownMatrixFilters.CreateOpacityFilter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="PolaroidProcessor{TPixel}" /> class. /// Initializes a new instance of the <see cref="PolaroidProcessor{TPixel}" /> class.
/// </summary> /// </summary>
public PolaroidProcessor() public PolaroidProcessor()
: base(MatrixFilters.PolaroidFilter) : base(KnownMatrixFilters.PolaroidFilter)
{ {
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="ProtanomalyProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="ProtanomalyProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public ProtanomalyProcessor() public ProtanomalyProcessor()
: base(MatrixFilters.ProtanomalyFilter) : base(KnownMatrixFilters.ProtanomalyFilter)
{ {
} }
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="ProtanopiaProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="ProtanopiaProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public ProtanopiaProcessor() public ProtanopiaProcessor()
: base(MatrixFilters.ProtanopiaFilter) : base(KnownMatrixFilters.ProtanopiaFilter)
{ {
} }
} }

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

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </remarks> /// </remarks>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param> /// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
public SaturateProcessor(float amount) public SaturateProcessor(float amount)
: base(MatrixFilters.CreateSaturateFilter(amount)) : base(KnownMatrixFilters.CreateSaturateFilter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// </summary> /// </summary>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param> /// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
public SepiaProcessor(float amount) public SepiaProcessor(float amount)
: base(MatrixFilters.CreateSepiaFilter(amount)) : base(KnownMatrixFilters.CreateSepiaFilter(amount))
{ {
this.Amount = amount; this.Amount = amount;
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="TritanomalyProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="TritanomalyProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public TritanomalyProcessor() public TritanomalyProcessor()
: base(MatrixFilters.TritanomalyFilter) : base(KnownMatrixFilters.TritanomalyFilter)
{ {
} }
} }

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

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Filters.Processors
/// Initializes a new instance of the <see cref="TritanopiaProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="TritanopiaProcessor{TPixel}"/> class.
/// </summary> /// </summary>
public TritanopiaProcessor() public TritanopiaProcessor()
: base(MatrixFilters.TritanopiaFilter) : base(KnownMatrixFilters.TritanopiaFilter)
{ {
} }
} }

2
src/ImageSharp/Processing/Quantization/QuantizationMode.cs → src/ImageSharp/Processing/Quantization/KnownQuantizers.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Processing.Quantization
/// <summary> /// <summary>
/// Contains reusable static instances of known quantizing algorithms /// Contains reusable static instances of known quantizing algorithms
/// </summary> /// </summary>
public static class QuantizationMode public static class KnownQuantizers
{ {
/// <summary> /// <summary>
/// Gets the adaptive Octree quantizer. Fast with good quality. /// Gets the adaptive Octree quantizer. Fast with good quality.

2
src/ImageSharp/Processing/Quantization/OctreeQuantizer.cs

@ -75,6 +75,6 @@ namespace SixLabors.ImageSharp.Processing.Quantization
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> new OctreeFrameQuantizer<TPixel>(this); => new OctreeFrameQuantizer<TPixel>(this);
private static IErrorDiffuser GetDiffuser(bool dither) => dither ? DiffuseMode.FloydSteinberg : null; private static IErrorDiffuser GetDiffuser(bool dither) => dither ? KnownDiffusers.FloydSteinberg : null;
} }
} }

2
src/ImageSharp/Processing/Quantization/PaletteQuantizer.cs

@ -58,6 +58,6 @@ namespace SixLabors.ImageSharp.Processing.Quantization
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> new PaletteFrameQuantizer<TPixel>(this); => new PaletteFrameQuantizer<TPixel>(this);
private static IErrorDiffuser GetDiffuser(bool dither) => dither ? DiffuseMode.FloydSteinberg : null; private static IErrorDiffuser GetDiffuser(bool dither) => dither ? KnownDiffusers.FloydSteinberg : null;
} }
} }

2
src/ImageSharp/Processing/Quantization/QuantizeExtensions.cs

@ -19,7 +19,7 @@ namespace SixLabors.ImageSharp.Processing.Quantization
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Quantize<TPixel>(this IImageProcessingContext<TPixel> source) public static IImageProcessingContext<TPixel> Quantize<TPixel>(this IImageProcessingContext<TPixel> source)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Quantize(source, QuantizationMode.Octree); => Quantize(source, KnownQuantizers.Octree);
/// <summary> /// <summary>
/// Applies quantization to the image. /// Applies quantization to the image.

2
src/ImageSharp/Processing/Quantization/WuQuantizer.cs

@ -75,6 +75,6 @@ namespace SixLabors.ImageSharp.Processing.Quantization
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> new WuFrameQuantizer<TPixel>(this); => new WuFrameQuantizer<TPixel>(this);
private static IErrorDiffuser GetDiffuser(bool dither) => dither ? DiffuseMode.FloydSteinberg : null; private static IErrorDiffuser GetDiffuser(bool dither) => dither ? KnownDiffusers.FloydSteinberg : null;
} }
} }

2
src/ImageSharp/Processing/Transforms/AnchorPosition.cs → src/ImageSharp/Processing/Transforms/AnchorPositionMode.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <summary> /// <summary>
/// Enumerated anchor positions to apply to resized images. /// Enumerated anchor positions to apply to resized images.
/// </summary> /// </summary>
public enum AnchorPosition public enum AnchorPositionMode
{ {
/// <summary> /// <summary>
/// Anchors the position of the image to the center of it's bounding container. /// Anchors the position of the image to the center of it's bounding container.

6
src/ImageSharp/Processing/Transforms/FlipExtensions.cs

@ -16,10 +16,10 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image to rotate, flip, or both.</param> /// <param name="source">The image to rotate, flip, or both.</param>
/// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param> /// <param name="flipMode">The <see cref="FlipMode"/> to perform the flip.</param>
/// <returns>The <see cref="Image{TPixel}"/></returns> /// <returns>The <see cref="Image{TPixel}"/></returns>
public static IImageProcessingContext<TPixel> Flip<TPixel>(this IImageProcessingContext<TPixel> source, FlipType flipType) public static IImageProcessingContext<TPixel> Flip<TPixel>(this IImageProcessingContext<TPixel> source, FlipMode flipMode)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new FlipProcessor<TPixel>(flipType)); => source.ApplyProcessor(new FlipProcessor<TPixel>(flipMode));
} }
} }

2
src/ImageSharp/Processing/Transforms/FlipType.cs → src/ImageSharp/Processing/Transforms/FlipMode.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <summary> /// <summary>
/// Provides enumeration over how a image should be flipped. /// Provides enumeration over how a image should be flipped.
/// </summary> /// </summary>
public enum FlipType public enum FlipMode
{ {
/// <summary> /// <summary>
/// Don't flip the image. /// Don't flip the image.

2
src/ImageSharp/Processing/Transforms/ResampleMode.cs → src/ImageSharp/Processing/Transforms/KnownResamplers.cs

@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <summary> /// <summary>
/// Contains reusable static instances of known resampling algorithms /// Contains reusable static instances of known resampling algorithms
/// </summary> /// </summary>
public static class ResampleMode public static class KnownResamplers
{ {
/// <summary> /// <summary>
/// Gets the Bicubic sampler that implements the bicubic kernel algorithm W(x) /// Gets the Bicubic sampler that implements the bicubic kernel algorithm W(x)

2
src/ImageSharp/Processing/Transforms/OrientationType.cs → src/ImageSharp/Processing/Transforms/OrientationMode.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <summary> /// <summary>
/// Enumerates the available orientation values supplied by EXIF metadata. /// Enumerates the available orientation values supplied by EXIF metadata.
/// </summary> /// </summary>
internal enum OrientationType : ushort internal enum OrientationMode : ushort
{ {
/// <summary> /// <summary>
/// Unknown rotation. /// Unknown rotation.

2
src/ImageSharp/Processing/Transforms/PadExtensions.cs

@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
{ {
Size = new Size(width, height), Size = new Size(width, height),
Mode = ResizeMode.BoxPad, Mode = ResizeMode.BoxPad,
Sampler = ResampleMode.NearestNeighbor Sampler = KnownResamplers.NearestNeighbor
}; };
return source.Resize(options); return source.Resize(options);

54
src/ImageSharp/Processing/Transforms/Processors/AutoOrientProcessor.cs

@ -19,42 +19,42 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors
/// <inheritdoc/> /// <inheritdoc/>
protected override void BeforeImageApply(Image<TPixel> source, Rectangle sourceRectangle) protected override void BeforeImageApply(Image<TPixel> source, Rectangle sourceRectangle)
{ {
OrientationType orientation = GetExifOrientation(source); OrientationMode orientation = GetExifOrientation(source);
Size size = sourceRectangle.Size; Size size = sourceRectangle.Size;
switch (orientation) switch (orientation)
{ {
case OrientationType.TopRight: case OrientationMode.TopRight:
new FlipProcessor<TPixel>(FlipType.Horizontal).Apply(source, sourceRectangle); new FlipProcessor<TPixel>(FlipMode.Horizontal).Apply(source, sourceRectangle);
break; break;
case OrientationType.BottomRight: case OrientationMode.BottomRight:
new RotateProcessor<TPixel>((int)RotateType.Rotate180, size).Apply(source, sourceRectangle); new RotateProcessor<TPixel>((int)RotateMode.Rotate180, size).Apply(source, sourceRectangle);
break; break;
case OrientationType.BottomLeft: case OrientationMode.BottomLeft:
new FlipProcessor<TPixel>(FlipType.Vertical).Apply(source, sourceRectangle); new FlipProcessor<TPixel>(FlipMode.Vertical).Apply(source, sourceRectangle);
break; break;
case OrientationType.LeftTop: case OrientationMode.LeftTop:
new RotateProcessor<TPixel>((int)RotateType.Rotate90, size).Apply(source, sourceRectangle); new RotateProcessor<TPixel>((int)RotateMode.Rotate90, size).Apply(source, sourceRectangle);
new FlipProcessor<TPixel>(FlipType.Horizontal).Apply(source, sourceRectangle); new FlipProcessor<TPixel>(FlipMode.Horizontal).Apply(source, sourceRectangle);
break; break;
case OrientationType.RightTop: case OrientationMode.RightTop:
new RotateProcessor<TPixel>((int)RotateType.Rotate90, size).Apply(source, sourceRectangle); new RotateProcessor<TPixel>((int)RotateMode.Rotate90, size).Apply(source, sourceRectangle);
break; break;
case OrientationType.RightBottom: case OrientationMode.RightBottom:
new FlipProcessor<TPixel>(FlipType.Vertical).Apply(source, sourceRectangle); new FlipProcessor<TPixel>(FlipMode.Vertical).Apply(source, sourceRectangle);
new RotateProcessor<TPixel>((int)RotateType.Rotate270, size).Apply(source, sourceRectangle); new RotateProcessor<TPixel>((int)RotateMode.Rotate270, size).Apply(source, sourceRectangle);
break; break;
case OrientationType.LeftBottom: case OrientationMode.LeftBottom:
new RotateProcessor<TPixel>((int)RotateType.Rotate270, size).Apply(source, sourceRectangle); new RotateProcessor<TPixel>((int)RotateMode.Rotate270, size).Apply(source, sourceRectangle);
break; break;
case OrientationType.Unknown: case OrientationMode.Unknown:
case OrientationType.TopLeft: case OrientationMode.TopLeft:
default: default:
break; break;
} }
@ -70,32 +70,32 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors
/// Returns the current EXIF orientation /// Returns the current EXIF orientation
/// </summary> /// </summary>
/// <param name="source">The image to auto rotate.</param> /// <param name="source">The image to auto rotate.</param>
/// <returns>The <see cref="OrientationType"/></returns> /// <returns>The <see cref="OrientationMode"/></returns>
private static OrientationType GetExifOrientation(Image<TPixel> source) private static OrientationMode GetExifOrientation(Image<TPixel> source)
{ {
if (source.MetaData.ExifProfile == null) if (source.MetaData.ExifProfile == null)
{ {
return OrientationType.Unknown; return OrientationMode.Unknown;
} }
ExifValue value = source.MetaData.ExifProfile.GetValue(ExifTag.Orientation); ExifValue value = source.MetaData.ExifProfile.GetValue(ExifTag.Orientation);
if (value == null) if (value == null)
{ {
return OrientationType.Unknown; return OrientationMode.Unknown;
} }
OrientationType orientation; OrientationMode orientation;
if (value.DataType == ExifDataType.Short) if (value.DataType == ExifDataType.Short)
{ {
orientation = (OrientationType)value.Value; orientation = (OrientationMode)value.Value;
} }
else else
{ {
orientation = (OrientationType)Convert.ToUInt16(value.Value); orientation = (OrientationMode)Convert.ToUInt16(value.Value);
source.MetaData.ExifProfile.RemoveValue(ExifTag.Orientation); source.MetaData.ExifProfile.RemoveValue(ExifTag.Orientation);
} }
source.MetaData.ExifProfile.SetValue(ExifTag.Orientation, (ushort)OrientationType.TopLeft); source.MetaData.ExifProfile.SetValue(ExifTag.Orientation, (ushort)OrientationMode.TopLeft);
return orientation; return orientation;
} }

16
src/ImageSharp/Processing/Transforms/Processors/FlipProcessor.cs

@ -21,27 +21,27 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="FlipProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="FlipProcessor{TPixel}"/> class.
/// </summary> /// </summary>
/// <param name="flipType">The <see cref="FlipType"/> used to perform flipping.</param> /// <param name="flipMode">The <see cref="Transforms.FlipMode"/> used to perform flipping.</param>
public FlipProcessor(FlipType flipType) public FlipProcessor(FlipMode flipMode)
{ {
this.FlipType = flipType; this.FlipMode = flipMode;
} }
/// <summary> /// <summary>
/// Gets the <see cref="FlipType"/> used to perform flipping. /// Gets the <see cref="Transforms.FlipMode"/> used to perform flipping.
/// </summary> /// </summary>
public FlipType FlipType { get; } public FlipMode FlipMode { get; }
/// <inheritdoc/> /// <inheritdoc/>
protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle sourceRectangle, Configuration configuration) protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle sourceRectangle, Configuration configuration)
{ {
switch (this.FlipType) switch (this.FlipMode)
{ {
// No default needed as we have already set the pixels. // No default needed as we have already set the pixels.
case FlipType.Vertical: case FlipMode.Vertical:
this.FlipX(source, configuration); this.FlipX(source, configuration);
break; break;
case FlipType.Horizontal: case FlipMode.Horizontal:
this.FlipY(source, configuration); this.FlipY(source, configuration);
break; break;
} }

2
src/ImageSharp/Processing/Transforms/Processors/RotateProcessor.cs

@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors
/// <param name="degrees">The angle of rotation in degrees.</param> /// <param name="degrees">The angle of rotation in degrees.</param>
/// <param name="sourceSize">The source image size</param> /// <param name="sourceSize">The source image size</param>
public RotateProcessor(float degrees, Size sourceSize) public RotateProcessor(float degrees, Size sourceSize)
: this(degrees, ResampleMode.Bicubic, sourceSize) : this(degrees, KnownResamplers.Bicubic, sourceSize)
{ {
} }

2
src/ImageSharp/Processing/Transforms/Processors/SkewProcessor.cs

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors
/// <param name="degreesY">The angle in degrees to perform the skew along the y-axis.</param> /// <param name="degreesY">The angle in degrees to perform the skew along the y-axis.</param>
/// <param name="sourceSize">The source image size</param> /// <param name="sourceSize">The source image size</param>
public SkewProcessor(float degreesX, float degreesY, Size sourceSize) public SkewProcessor(float degreesX, float degreesY, Size sourceSize)
: this(degreesX, degreesY, ResampleMode.Bicubic, sourceSize) : this(degreesX, degreesY, KnownResamplers.Bicubic, sourceSize)
{ {
} }

8
src/ImageSharp/Processing/Transforms/ResizeExtensions.cs

@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks> /// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, Size size) public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, Size size)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Resize(source, size.Width, size.Height, ResampleMode.Bicubic, false); => Resize(source, size.Width, size.Height, KnownResamplers.Bicubic, false);
/// <summary> /// <summary>
/// Resizes an image to the given <see cref="Size"/>. /// Resizes an image to the given <see cref="Size"/>.
@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks> /// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, Size size, bool compand) public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, Size size, bool compand)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Resize(source, size.Width, size.Height, ResampleMode.Bicubic, compand); => Resize(source, size.Width, size.Height, KnownResamplers.Bicubic, compand);
/// <summary> /// <summary>
/// Resizes an image to the given width and height. /// Resizes an image to the given width and height.
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks> /// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, int width, int height) public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, int width, int height)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Resize(source, width, height, ResampleMode.Bicubic, false); => Resize(source, width, height, KnownResamplers.Bicubic, false);
/// <summary> /// <summary>
/// Resizes an image to the given width and height. /// Resizes an image to the given width and height.
@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks> /// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, int width, int height, bool compand) public static IImageProcessingContext<TPixel> Resize<TPixel>(this IImageProcessingContext<TPixel> source, int width, int height, bool compand)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Resize(source, width, height, ResampleMode.Bicubic, compand); => Resize(source, width, height, KnownResamplers.Bicubic, compand);
/// <summary> /// <summary>
/// Resizes an image to the given width and height with the given sampler. /// Resizes an image to the given width and height with the given sampler.

64
src/ImageSharp/Processing/Transforms/ResizeHelper.cs

@ -87,14 +87,14 @@ namespace SixLabors.ImageSharp.Processing.Transforms
{ {
switch (options.Position) switch (options.Position)
{ {
case AnchorPosition.Top: case AnchorPositionMode.Top:
case AnchorPosition.TopLeft: case AnchorPositionMode.TopLeft:
case AnchorPosition.TopRight: case AnchorPositionMode.TopRight:
destinationY = 0; destinationY = 0;
break; break;
case AnchorPosition.Bottom: case AnchorPositionMode.Bottom:
case AnchorPosition.BottomLeft: case AnchorPositionMode.BottomLeft:
case AnchorPosition.BottomRight: case AnchorPositionMode.BottomRight:
destinationY = (int)MathF.Round(height - (sourceHeight * ratio)); destinationY = (int)MathF.Round(height - (sourceHeight * ratio));
break; break;
default: default:
@ -128,14 +128,14 @@ namespace SixLabors.ImageSharp.Processing.Transforms
{ {
switch (options.Position) switch (options.Position)
{ {
case AnchorPosition.Left: case AnchorPositionMode.Left:
case AnchorPosition.TopLeft: case AnchorPositionMode.TopLeft:
case AnchorPosition.BottomLeft: case AnchorPositionMode.BottomLeft:
destinationX = 0; destinationX = 0;
break; break;
case AnchorPosition.Right: case AnchorPositionMode.Right:
case AnchorPosition.TopRight: case AnchorPositionMode.TopRight:
case AnchorPosition.BottomRight: case AnchorPositionMode.BottomRight:
destinationX = (int)MathF.Round(width - (sourceWidth * ratio)); destinationX = (int)MathF.Round(width - (sourceWidth * ratio));
break; break;
default: default:
@ -177,14 +177,14 @@ namespace SixLabors.ImageSharp.Processing.Transforms
switch (options.Position) switch (options.Position)
{ {
case AnchorPosition.Left: case AnchorPositionMode.Left:
case AnchorPosition.TopLeft: case AnchorPositionMode.TopLeft:
case AnchorPosition.BottomLeft: case AnchorPositionMode.BottomLeft:
destinationX = 0; destinationX = 0;
break; break;
case AnchorPosition.Right: case AnchorPositionMode.Right:
case AnchorPosition.TopRight: case AnchorPositionMode.TopRight:
case AnchorPosition.BottomRight: case AnchorPositionMode.BottomRight:
destinationX = (int)MathF.Round(width - (sourceWidth * ratio)); destinationX = (int)MathF.Round(width - (sourceWidth * ratio));
break; break;
default: default:
@ -199,14 +199,14 @@ namespace SixLabors.ImageSharp.Processing.Transforms
switch (options.Position) switch (options.Position)
{ {
case AnchorPosition.Top: case AnchorPositionMode.Top:
case AnchorPosition.TopLeft: case AnchorPositionMode.TopLeft:
case AnchorPosition.TopRight: case AnchorPositionMode.TopRight:
destinationY = 0; destinationY = 0;
break; break;
case AnchorPosition.Bottom: case AnchorPositionMode.Bottom:
case AnchorPosition.BottomLeft: case AnchorPositionMode.BottomLeft:
case AnchorPosition.BottomRight: case AnchorPositionMode.BottomRight:
destinationY = (int)MathF.Round(height - (sourceHeight * ratio)); destinationY = (int)MathF.Round(height - (sourceHeight * ratio));
break; break;
default: default:
@ -247,35 +247,35 @@ namespace SixLabors.ImageSharp.Processing.Transforms
switch (options.Position) switch (options.Position)
{ {
case AnchorPosition.Left: case AnchorPositionMode.Left:
destinationY = (height - sourceHeight) / 2; destinationY = (height - sourceHeight) / 2;
destinationX = 0; destinationX = 0;
break; break;
case AnchorPosition.Right: case AnchorPositionMode.Right:
destinationY = (height - sourceHeight) / 2; destinationY = (height - sourceHeight) / 2;
destinationX = width - sourceWidth; destinationX = width - sourceWidth;
break; break;
case AnchorPosition.TopRight: case AnchorPositionMode.TopRight:
destinationY = 0; destinationY = 0;
destinationX = width - sourceWidth; destinationX = width - sourceWidth;
break; break;
case AnchorPosition.Top: case AnchorPositionMode.Top:
destinationY = 0; destinationY = 0;
destinationX = (width - sourceWidth) / 2; destinationX = (width - sourceWidth) / 2;
break; break;
case AnchorPosition.TopLeft: case AnchorPositionMode.TopLeft:
destinationY = 0; destinationY = 0;
destinationX = 0; destinationX = 0;
break; break;
case AnchorPosition.BottomRight: case AnchorPositionMode.BottomRight:
destinationY = height - sourceHeight; destinationY = height - sourceHeight;
destinationX = width - sourceWidth; destinationX = width - sourceWidth;
break; break;
case AnchorPosition.Bottom: case AnchorPositionMode.Bottom:
destinationY = height - sourceHeight; destinationY = height - sourceHeight;
destinationX = (width - sourceWidth) / 2; destinationX = (width - sourceWidth) / 2;
break; break;
case AnchorPosition.BottomLeft: case AnchorPositionMode.BottomLeft:
destinationY = height - sourceHeight; destinationY = height - sourceHeight;
destinationX = 0; destinationX = 0;
break; break;

2
src/ImageSharp/Processing/Transforms/ResizeMode.cs

@ -4,7 +4,7 @@
namespace SixLabors.ImageSharp.Processing.Transforms namespace SixLabors.ImageSharp.Processing.Transforms
{ {
/// <summary> /// <summary>
/// Enumerated resize modes to apply to images. /// Provides enumeration over how the image should be resized.
/// </summary> /// </summary>
public enum ResizeMode public enum ResizeMode
{ {

4
src/ImageSharp/Processing/Transforms/ResizeOptions.cs

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <summary> /// <summary>
/// Gets or sets the anchor position. /// Gets or sets the anchor position.
/// </summary> /// </summary>
public AnchorPosition Position { get; set; } = AnchorPosition.Center; public AnchorPositionMode Position { get; set; } = AnchorPositionMode.Center;
/// <summary> /// <summary>
/// Gets or sets the center coordinates. /// Gets or sets the center coordinates.
@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <summary> /// <summary>
/// Gets or sets the sampler to perform the resize operation. /// Gets or sets the sampler to perform the resize operation.
/// </summary> /// </summary>
public IResampler Sampler { get; set; } = ResampleMode.Bicubic; public IResampler Sampler { get; set; } = KnownResamplers.Bicubic;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to compress /// Gets or sets a value indicating whether to compress

8
src/ImageSharp/Processing/Transforms/RotateExtensions.cs

@ -17,11 +17,11 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image to rotate.</param> /// <param name="source">The image to rotate.</param>
/// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param> /// <param name="rotateMode">The <see cref="RotateMode"/> to perform the rotation.</param>
/// <returns>The <see cref="Image{TPixel}"/></returns> /// <returns>The <see cref="Image{TPixel}"/></returns>
public static IImageProcessingContext<TPixel> Rotate<TPixel>(this IImageProcessingContext<TPixel> source, RotateType rotateType) public static IImageProcessingContext<TPixel> Rotate<TPixel>(this IImageProcessingContext<TPixel> source, RotateMode rotateMode)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Rotate(source, (float)rotateType); => Rotate(source, (float)rotateMode);
/// <summary> /// <summary>
/// Rotates an image by the given angle in degrees. /// Rotates an image by the given angle in degrees.
@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <returns>The <see cref="Image{TPixel}"/></returns> /// <returns>The <see cref="Image{TPixel}"/></returns>
public static IImageProcessingContext<TPixel> Rotate<TPixel>(this IImageProcessingContext<TPixel> source, float degrees) public static IImageProcessingContext<TPixel> Rotate<TPixel>(this IImageProcessingContext<TPixel> source, float degrees)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Rotate(source, degrees, ResampleMode.Bicubic); => Rotate(source, degrees, KnownResamplers.Bicubic);
/// <summary> /// <summary>
/// Rotates an image by the given angle in degrees using the specified sampling algorithm. /// Rotates an image by the given angle in degrees using the specified sampling algorithm.

8
src/ImageSharp/Processing/Transforms/RotateFlipExtensions.cs

@ -15,11 +15,11 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image to rotate, flip, or both.</param> /// <param name="source">The image to rotate, flip, or both.</param>
/// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param> /// <param name="rotateMode">The <see cref="RotateMode"/> to perform the rotation.</param>
/// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param> /// <param name="flipMode">The <see cref="FlipMode"/> to perform the flip.</param>
/// <returns>The <see cref="Image{TPixel}"/></returns> /// <returns>The <see cref="Image{TPixel}"/></returns>
public static IImageProcessingContext<TPixel> RotateFlip<TPixel>(this IImageProcessingContext<TPixel> source, RotateType rotateType, FlipType flipType) public static IImageProcessingContext<TPixel> RotateFlip<TPixel>(this IImageProcessingContext<TPixel> source, RotateMode rotateMode, FlipMode flipMode)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Rotate(rotateType).Flip(flipType); => source.Rotate(rotateMode).Flip(flipMode);
} }
} }

2
src/ImageSharp/Processing/Transforms/RotateType.cs → src/ImageSharp/Processing/Transforms/RotateMode.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <summary> /// <summary>
/// Provides enumeration over how the image should be rotated. /// Provides enumeration over how the image should be rotated.
/// </summary> /// </summary>
public enum RotateType public enum RotateMode
{ {
/// <summary> /// <summary>
/// Do not rotate the image. /// Do not rotate the image.

2
src/ImageSharp/Processing/Transforms/SkewExtensions.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <returns>The <see cref="Image{TPixel}"/></returns> /// <returns>The <see cref="Image{TPixel}"/></returns>
public static IImageProcessingContext<TPixel> Skew<TPixel>(this IImageProcessingContext<TPixel> source, float degreesX, float degreesY) public static IImageProcessingContext<TPixel> Skew<TPixel>(this IImageProcessingContext<TPixel> source, float degreesX, float degreesY)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Skew(source, degreesX, degreesY, ResampleMode.Bicubic); => Skew(source, degreesX, degreesY, KnownResamplers.Bicubic);
/// <summary> /// <summary>
/// Skews an image by the given angles in degrees using the specified sampling algorithm. /// Skews an image by the given angles in degrees using the specified sampling algorithm.

4
src/ImageSharp/Processing/Transforms/TransformExtensions.cs

@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <returns>The <see cref="Image{TPixel}"/></returns> /// <returns>The <see cref="Image{TPixel}"/></returns>
public static IImageProcessingContext<TPixel> Transform<TPixel>(this IImageProcessingContext<TPixel> source, Matrix3x2 matrix) public static IImageProcessingContext<TPixel> Transform<TPixel>(this IImageProcessingContext<TPixel> source, Matrix3x2 matrix)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Transform(source, matrix, ResampleMode.Bicubic); => Transform(source, matrix, KnownResamplers.Bicubic);
/// <summary> /// <summary>
/// Transforms an image by the given matrix using the specified sampling algorithm. /// Transforms an image by the given matrix using the specified sampling algorithm.
@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// <returns>The <see cref="Image{TPixel}"/></returns> /// <returns>The <see cref="Image{TPixel}"/></returns>
internal static IImageProcessingContext<TPixel> Transform<TPixel>(this IImageProcessingContext<TPixel> source, Matrix4x4 matrix) internal static IImageProcessingContext<TPixel> Transform<TPixel>(this IImageProcessingContext<TPixel> source, Matrix4x4 matrix)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Transform(source, matrix, ResampleMode.Bicubic); => Transform(source, matrix, KnownResamplers.Bicubic);
/// <summary> /// <summary>
/// Applies a projective transform to the image by the given matrix using the specified sampling algorithm. /// Applies a projective transform to the image by the given matrix using the specified sampling algorithm.

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

@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.Tests
// We pass a new rectangle here based on the dest bounds since we've offset the matrix // We pass a new rectangle here based on the dest bounds since we've offset the matrix
blend.Mutate(x => x.Transform( blend.Mutate(x => x.Transform(
centeredMatrix, centeredMatrix,
ResampleMode.Bicubic, KnownResamplers.Bicubic,
new Rectangle(0, 0, destBounds.Width, destBounds.Height))); new Rectangle(0, 0, destBounds.Width, destBounds.Height)));
var position = new Point((image.Width - blend.Width) / 2, (image.Height - blend.Height) / 2); var position = new Point((image.Width - blend.Width) / 2, (image.Height - blend.Height) / 2);

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

@ -74,7 +74,7 @@ namespace SixLabors.ImageSharp.Tests
{ {
using (FileStream output = File.OpenWrite($"{path}/Octree-{file.FileName}")) using (FileStream output = File.OpenWrite($"{path}/Octree-{file.FileName}"))
{ {
image.Mutate(x => x.Quantize(QuantizationMode.Octree)); image.Mutate(x => x.Quantize(KnownQuantizers.Octree));
image.Save(output, mimeType); image.Save(output, mimeType);
} }
@ -84,7 +84,7 @@ namespace SixLabors.ImageSharp.Tests
{ {
using (FileStream output = File.OpenWrite($"{path}/Wu-{file.FileName}")) using (FileStream output = File.OpenWrite($"{path}/Wu-{file.FileName}"))
{ {
image.Mutate(x => x.Quantize(QuantizationMode.Wu)); image.Mutate(x => x.Quantize(KnownQuantizers.Wu));
image.Save(output, mimeType); image.Save(output, mimeType);
} }
} }
@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Tests
{ {
using (FileStream output = File.OpenWrite($"{path}/Palette-{file.FileName}")) using (FileStream output = File.OpenWrite($"{path}/Palette-{file.FileName}"))
{ {
image.Mutate(x => x.Quantize(QuantizationMode.Palette)); image.Mutate(x => x.Quantize(KnownQuantizers.Palette));
image.Save(output, mimeType); image.Save(output, mimeType);
} }
} }

2
tests/ImageSharp.Tests/MetaData/ImageMetaDataTests.cs

@ -6,6 +6,8 @@ using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.MetaData; using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using Xunit; using Xunit;
namespace SixLabors.ImageSharp.Tests namespace SixLabors.ImageSharp.Tests

2
tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs

@ -9,6 +9,8 @@ using System.Text;
using SixLabors.ImageSharp.MetaData; using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using Xunit; using Xunit;
namespace SixLabors.ImageSharp.Tests namespace SixLabors.ImageSharp.Tests

2
tests/ImageSharp.Tests/Numerics/RationalTests.cs

@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.Primitives;
using Xunit; using Xunit;
namespace SixLabors.ImageSharp.Tests namespace SixLabors.ImageSharp.Tests

2
tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs

@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.Primitives;
using Xunit; using Xunit;
namespace SixLabors.ImageSharp.Tests namespace SixLabors.ImageSharp.Tests

4
tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs

@ -20,8 +20,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
public BinaryDitherTest() public BinaryDitherTest()
{ {
this.orderedDither = DitherMode.BayerDither4x4; this.orderedDither = KnownDitherMatrices.BayerDither4x4;
this.errorDiffuser = DiffuseMode.FloydSteinberg; this.errorDiffuser = KnownDiffusers.FloydSteinberg;
} }
[Fact] [Fact]

4
tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs

@ -25,8 +25,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
public DitherTest() public DitherTest()
{ {
this.orderedDither = DitherMode.BayerDither4x4; this.orderedDither = KnownDitherMatrices.BayerDither4x4;
this.errorDiffuser = DiffuseMode.FloydSteinberg; this.errorDiffuser = KnownDiffusers.FloydSteinberg;
} }
[Fact] [Fact]

20
tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs

@ -17,19 +17,19 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters
public class ColorBlindnessTest : BaseImageOperationsExtensionTest public class ColorBlindnessTest : BaseImageOperationsExtensionTest
{ {
public static IEnumerable<object[]> TheoryData = new[] { public static IEnumerable<object[]> TheoryData = new[] {
new object[]{ new TestType<AchromatomalyProcessor<Rgba32>>(), ColorBlindness.Achromatomaly }, new object[]{ new TestType<AchromatomalyProcessor<Rgba32>>(), ColorBlindnessMode.Achromatomaly },
new object[]{ new TestType<AchromatopsiaProcessor<Rgba32>>(), ColorBlindness.Achromatopsia }, new object[]{ new TestType<AchromatopsiaProcessor<Rgba32>>(), ColorBlindnessMode.Achromatopsia },
new object[]{ new TestType<DeuteranomalyProcessor<Rgba32>>(), ColorBlindness.Deuteranomaly }, new object[]{ new TestType<DeuteranomalyProcessor<Rgba32>>(), ColorBlindnessMode.Deuteranomaly },
new object[]{ new TestType<DeuteranopiaProcessor<Rgba32>>(), ColorBlindness.Deuteranopia }, new object[]{ new TestType<DeuteranopiaProcessor<Rgba32>>(), ColorBlindnessMode.Deuteranopia },
new object[]{ new TestType<ProtanomalyProcessor<Rgba32>>(), ColorBlindness.Protanomaly }, new object[]{ new TestType<ProtanomalyProcessor<Rgba32>>(), ColorBlindnessMode.Protanomaly },
new object[]{ new TestType<ProtanopiaProcessor<Rgba32>>(), ColorBlindness.Protanopia }, new object[]{ new TestType<ProtanopiaProcessor<Rgba32>>(), ColorBlindnessMode.Protanopia },
new object[]{ new TestType<TritanomalyProcessor<Rgba32>>(), ColorBlindness.Tritanomaly }, new object[]{ new TestType<TritanomalyProcessor<Rgba32>>(), ColorBlindnessMode.Tritanomaly },
new object[]{ new TestType<TritanopiaProcessor<Rgba32>>(), ColorBlindness.Tritanopia } new object[]{ new TestType<TritanopiaProcessor<Rgba32>>(), ColorBlindnessMode.Tritanopia }
}; };
[Theory] [Theory]
[MemberData(nameof(TheoryData))] [MemberData(nameof(TheoryData))]
public void ColorBlindness_CorrectProcessor<T>(TestType<T> testType, ColorBlindness colorBlindness) public void ColorBlindness_CorrectProcessor<T>(TestType<T> testType, ColorBlindnessMode colorBlindness)
where T : IImageProcessor<Rgba32> where T : IImageProcessor<Rgba32>
{ {
this.operations.ColorBlindness(colorBlindness); this.operations.ColorBlindness(colorBlindness);
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters
} }
[Theory] [Theory]
[MemberData(nameof(TheoryData))] [MemberData(nameof(TheoryData))]
public void ColorBlindness_rect_CorrectProcessor<T>(TestType<T> testType, ColorBlindness colorBlindness) public void ColorBlindness_rect_CorrectProcessor<T>(TestType<T> testType, ColorBlindnessMode colorBlindness)
where T : IImageProcessor<Rgba32> where T : IImageProcessor<Rgba32>
{ {
this.operations.ColorBlindness(colorBlindness, this.rect); this.operations.ColorBlindness(colorBlindness, this.rect);

4
tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs

@ -16,14 +16,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters
[Fact] [Fact]
public void Filter_CorrectProcessor() public void Filter_CorrectProcessor()
{ {
this.operations.Filter(MatrixFilters.AchromatomalyFilter * MatrixFilters.CreateHueFilter(90F)); this.operations.Filter(KnownMatrixFilters.AchromatomalyFilter * KnownMatrixFilters.CreateHueFilter(90F));
FilterProcessor<Rgba32> p = this.Verify<FilterProcessor<Rgba32>>(); FilterProcessor<Rgba32> p = this.Verify<FilterProcessor<Rgba32>>();
} }
[Fact] [Fact]
public void Filter_rect_CorrectProcessor() public void Filter_rect_CorrectProcessor()
{ {
this.operations.Filter(MatrixFilters.AchromatomalyFilter * MatrixFilters.CreateHueFilter(90F), this.rect); this.operations.Filter(KnownMatrixFilters.AchromatomalyFilter * KnownMatrixFilters.CreateHueFilter(90F), this.rect);
FilterProcessor<Rgba32> p = this.Verify<FilterProcessor<Rgba32>>(this.rect); FilterProcessor<Rgba32> p = this.Verify<FilterProcessor<Rgba32>>(this.rect);
} }
} }

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

@ -25,29 +25,29 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
public static readonly TheoryData<string, IOrderedDither> OrderedDitherers = new TheoryData<string, IOrderedDither> public static readonly TheoryData<string, IOrderedDither> OrderedDitherers = new TheoryData<string, IOrderedDither>
{ {
{ "Bayer8x8", DitherMode.BayerDither8x8 }, { "Bayer8x8", KnownDitherMatrices.BayerDither8x8 },
{ "Bayer4x4", DitherMode.BayerDither4x4 }, { "Bayer4x4", KnownDitherMatrices.BayerDither4x4 },
{ "Ordered3x3", DitherMode.OrderedDither3x3 }, { "Ordered3x3", KnownDitherMatrices.OrderedDither3x3 },
{ "Bayer2x2", DitherMode.BayerDither2x2 } { "Bayer2x2", KnownDitherMatrices.BayerDither2x2 }
}; };
public static readonly TheoryData<string, IErrorDiffuser> ErrorDiffusers = new TheoryData<string, IErrorDiffuser> public static readonly TheoryData<string, IErrorDiffuser> ErrorDiffusers = new TheoryData<string, IErrorDiffuser>
{ {
{ "Atkinson", DiffuseMode.Atkinson }, { "Atkinson", KnownDiffusers.Atkinson },
{ "Burks", DiffuseMode.Burks }, { "Burks", KnownDiffusers.Burks },
{ "FloydSteinberg", DiffuseMode.FloydSteinberg }, { "FloydSteinberg", KnownDiffusers.FloydSteinberg },
{ "JarvisJudiceNinke", DiffuseMode.JarvisJudiceNinke }, { "JarvisJudiceNinke", KnownDiffusers.JarvisJudiceNinke },
{ "Sierra2", DiffuseMode.Sierra2 }, { "Sierra2", KnownDiffusers.Sierra2 },
{ "Sierra3", DiffuseMode.Sierra3 }, { "Sierra3", KnownDiffusers.Sierra3 },
{ "SierraLite", DiffuseMode.SierraLite }, { "SierraLite", KnownDiffusers.SierraLite },
{ "StevensonArce", DiffuseMode.StevensonArce }, { "StevensonArce", KnownDiffusers.StevensonArce },
{ "Stucki", DiffuseMode.Stucki }, { "Stucki", KnownDiffusers.Stucki },
}; };
private static IOrderedDither DefaultDitherer => DitherMode.BayerDither4x4; private static IOrderedDither DefaultDitherer => KnownDitherMatrices.BayerDither4x4;
private static IErrorDiffuser DefaultErrorDiffuser => DiffuseMode.Atkinson; private static IErrorDiffuser DefaultErrorDiffuser => KnownDiffusers.Atkinson;
[Theory] [Theory]
[WithFileCollection(nameof(CommonTestImages), nameof(OrderedDitherers), DefaultPixelType)] [WithFileCollection(nameof(CommonTestImages), nameof(OrderedDitherers), DefaultPixelType)]

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

@ -24,29 +24,29 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
public static readonly TheoryData<string, IOrderedDither> OrderedDitherers = new TheoryData<string, IOrderedDither> public static readonly TheoryData<string, IOrderedDither> OrderedDitherers = new TheoryData<string, IOrderedDither>
{ {
{ "Bayer8x8", DitherMode.BayerDither8x8 }, { "Bayer8x8", KnownDitherMatrices.BayerDither8x8 },
{ "Bayer4x4", DitherMode.BayerDither4x4 }, { "Bayer4x4", KnownDitherMatrices.BayerDither4x4 },
{ "Ordered3x3", DitherMode.OrderedDither3x3 }, { "Ordered3x3", KnownDitherMatrices.OrderedDither3x3 },
{ "Bayer2x2", DitherMode.BayerDither2x2 } { "Bayer2x2", KnownDitherMatrices.BayerDither2x2 }
}; };
public static readonly TheoryData<string, IErrorDiffuser> ErrorDiffusers = new TheoryData<string, IErrorDiffuser> public static readonly TheoryData<string, IErrorDiffuser> ErrorDiffusers = new TheoryData<string, IErrorDiffuser>
{ {
{ "Atkinson", DiffuseMode.Atkinson }, { "Atkinson", KnownDiffusers.Atkinson },
{ "Burks", DiffuseMode.Burks }, { "Burks", KnownDiffusers.Burks },
{ "FloydSteinberg", DiffuseMode.FloydSteinberg }, { "FloydSteinberg", KnownDiffusers.FloydSteinberg },
{ "JarvisJudiceNinke", DiffuseMode.JarvisJudiceNinke }, { "JarvisJudiceNinke", KnownDiffusers.JarvisJudiceNinke },
{ "Sierra2", DiffuseMode.Sierra2 }, { "Sierra2", KnownDiffusers.Sierra2 },
{ "Sierra3", DiffuseMode.Sierra3 }, { "Sierra3", KnownDiffusers.Sierra3 },
{ "SierraLite", DiffuseMode.SierraLite }, { "SierraLite", KnownDiffusers.SierraLite },
{ "StevensonArce", DiffuseMode.StevensonArce }, { "StevensonArce", KnownDiffusers.StevensonArce },
{ "Stucki", DiffuseMode.Stucki }, { "Stucki", KnownDiffusers.Stucki },
}; };
private static IOrderedDither DefaultDitherer => DitherMode.BayerDither4x4; private static IOrderedDither DefaultDitherer => KnownDitherMatrices.BayerDither4x4;
private static IErrorDiffuser DefaultErrorDiffuser => DiffuseMode.Atkinson; private static IErrorDiffuser DefaultErrorDiffuser => KnownDiffusers.Atkinson;
[Theory] [Theory]
[WithFileCollection(nameof(CommonTestImages), nameof(OrderedDitherers), DefaultPixelType)] [WithFileCollection(nameof(CommonTestImages), nameof(OrderedDitherers), DefaultPixelType)]

22
tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs

@ -13,22 +13,22 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
[GroupOutput("Filters")] [GroupOutput("Filters")]
public class ColorBlindnessTest public class ColorBlindnessTest
{ {
public static readonly TheoryData<ColorBlindness> ColorBlindnessFilters public static readonly TheoryData<ColorBlindnessMode> ColorBlindnessFilters
= new TheoryData<ColorBlindness> = new TheoryData<ColorBlindnessMode>
{ {
ColorBlindness.Achromatomaly, ColorBlindnessMode.Achromatomaly,
ColorBlindness.Achromatopsia, ColorBlindnessMode.Achromatopsia,
ColorBlindness.Deuteranomaly, ColorBlindnessMode.Deuteranomaly,
ColorBlindness.Deuteranopia, ColorBlindnessMode.Deuteranopia,
ColorBlindness.Protanomaly, ColorBlindnessMode.Protanomaly,
ColorBlindness.Protanopia, ColorBlindnessMode.Protanopia,
ColorBlindness.Tritanomaly, ColorBlindnessMode.Tritanomaly,
ColorBlindness.Tritanopia ColorBlindnessMode.Tritanopia
}; };
[Theory] [Theory]
[WithTestPatternImages(nameof(ColorBlindnessFilters), 48, 48, PixelTypes.Rgba32)] [WithTestPatternImages(nameof(ColorBlindnessFilters), 48, 48, PixelTypes.Rgba32)]
public void ApplyColorBlindnessFilter<TPixel>(TestImageProvider<TPixel> provider, ColorBlindness colorBlindness) public void ApplyColorBlindnessFilter<TPixel>(TestImageProvider<TPixel> provider, ColorBlindnessMode colorBlindness)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
provider.RunValidatingProcessorTest(x => x.ColorBlindness(colorBlindness), colorBlindness.ToString()); provider.RunValidatingProcessorTest(x => x.ColorBlindness(colorBlindness), colorBlindness.ToString());

6
tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs

@ -40,9 +40,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
private static Matrix4x4 CreateCombinedTestFilterMatrix() private static Matrix4x4 CreateCombinedTestFilterMatrix()
{ {
Matrix4x4 brightness = MatrixFilters.CreateBrightnessFilter(0.9F); Matrix4x4 brightness = KnownMatrixFilters.CreateBrightnessFilter(0.9F);
Matrix4x4 hue = MatrixFilters.CreateHueFilter(180F); Matrix4x4 hue = KnownMatrixFilters.CreateHueFilter(180F);
Matrix4x4 saturation = MatrixFilters.CreateSaturateFilter(1.5F); Matrix4x4 saturation = KnownMatrixFilters.CreateSaturateFilter(1.5F);
Matrix4x4 m = brightness * hue * saturation; Matrix4x4 m = brightness * hue * saturation;
return m; return m;
} }

24
tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs

@ -15,18 +15,18 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{ {
public static readonly string[] FlipFiles = { TestImages.Bmp.F }; public static readonly string[] FlipFiles = { TestImages.Bmp.F };
public static readonly TheoryData<RotateType, FlipType, ushort> OrientationValues public static readonly TheoryData<RotateMode, FlipMode, ushort> OrientationValues
= new TheoryData<RotateType, FlipType, ushort> = new TheoryData<RotateMode, FlipMode, ushort>
{ {
{ RotateType.None, FlipType.None, 0 }, { RotateMode.None, FlipMode.None, 0 },
{ RotateType.None, FlipType.None, 1 }, { RotateMode.None, FlipMode.None, 1 },
{ RotateType.None, FlipType.Horizontal, 2 }, { RotateMode.None, FlipMode.Horizontal, 2 },
{ RotateType.Rotate180, FlipType.None, 3 }, { RotateMode.Rotate180, FlipMode.None, 3 },
{ RotateType.Rotate180, FlipType.Horizontal, 4 }, { RotateMode.Rotate180, FlipMode.Horizontal, 4 },
{ RotateType.Rotate90, FlipType.Horizontal, 5 }, { RotateMode.Rotate90, FlipMode.Horizontal, 5 },
{ RotateType.Rotate270, FlipType.None, 6 }, { RotateMode.Rotate270, FlipMode.None, 6 },
{ RotateType.Rotate90, FlipType.Vertical, 7 }, { RotateMode.Rotate90, FlipMode.Vertical, 7 },
{ RotateType.Rotate90, FlipType.None, 8 }, { RotateMode.Rotate90, FlipMode.None, 8 },
}; };
public static readonly TheoryData<ExifDataType, byte[]> InvalidOrientationValues public static readonly TheoryData<ExifDataType, byte[]> InvalidOrientationValues
@ -41,7 +41,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
[Theory] [Theory]
[WithFileCollection(nameof(FlipFiles), nameof(OrientationValues), DefaultPixelType)] [WithFileCollection(nameof(FlipFiles), nameof(OrientationValues), DefaultPixelType)]
public void ImageShouldAutoRotate<TPixel>(TestImageProvider<TPixel> provider, RotateType rotateType, FlipType flipType, ushort orientation) public void ImageShouldAutoRotate<TPixel>(TestImageProvider<TPixel> provider, RotateMode rotateType, FlipMode flipType, ushort orientation)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())

12
tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs

@ -13,17 +13,17 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{ {
public static readonly string[] FlipFiles = { TestImages.Bmp.F }; public static readonly string[] FlipFiles = { TestImages.Bmp.F };
public static readonly TheoryData<FlipType> FlipValues public static readonly TheoryData<FlipMode> FlipValues
= new TheoryData<FlipType> = new TheoryData<FlipMode>
{ {
{ FlipType.None }, { FlipMode.None },
{ FlipType.Vertical }, { FlipMode.Vertical },
{ FlipType.Horizontal }, { FlipMode.Horizontal },
}; };
[Theory] [Theory]
[WithFileCollection(nameof(FlipFiles), nameof(FlipValues), DefaultPixelType)] [WithFileCollection(nameof(FlipFiles), nameof(FlipValues), DefaultPixelType)]
public void ImageShouldFlip<TPixel>(TestImageProvider<TPixel> provider, FlipType flipType) public void ImageShouldFlip<TPixel>(TestImageProvider<TPixel> provider, FlipMode flipType)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())

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

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
public void PrintWeightsData() public void PrintWeightsData()
{ {
var size = new Size(500, 500); var size = new Size(500, 500);
var proc = new ResizeProcessor<Rgba32>(ResampleMode.Bicubic, 200, 200, size); var proc = new ResizeProcessor<Rgba32>(KnownResamplers.Bicubic, 200, 200, size);
WeightsBuffer weights = proc.PrecomputeWeights(Configuration.Default.MemoryManager, proc.Width, size.Width); WeightsBuffer weights = proc.PrecomputeWeights(Configuration.Default.MemoryManager, proc.Width, size.Width);

38
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs

@ -20,20 +20,20 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
public static readonly TheoryData<string, IResampler> AllReSamplers = public static readonly TheoryData<string, IResampler> AllReSamplers =
new TheoryData<string, IResampler> new TheoryData<string, IResampler>
{ {
{ "Bicubic", ResampleMode.Bicubic }, { "Bicubic", KnownResamplers.Bicubic },
{ "Triangle", ResampleMode.Triangle}, { "Triangle", KnownResamplers.Triangle},
{ "NearestNeighbor", ResampleMode.NearestNeighbor }, { "NearestNeighbor", KnownResamplers.NearestNeighbor },
{ "Box", ResampleMode.Box }, { "Box", KnownResamplers.Box },
// { "Lanczos2", KnownResamplers.Lanczos2 }, TODO: Add expected file // { "Lanczos2", KnownResamplers.Lanczos2 }, TODO: Add expected file
{ "Lanczos3", ResampleMode.Lanczos3 }, { "Lanczos3", KnownResamplers.Lanczos3 },
{ "Lanczos5", ResampleMode.Lanczos5 }, { "Lanczos5", KnownResamplers.Lanczos5 },
{ "MitchellNetravali", ResampleMode.MitchellNetravali }, { "MitchellNetravali", KnownResamplers.MitchellNetravali },
{ "Lanczos8", ResampleMode.Lanczos8 }, { "Lanczos8", KnownResamplers.Lanczos8 },
{ "Hermite", ResampleMode.Hermite }, { "Hermite", KnownResamplers.Hermite },
{ "Spline", ResampleMode.Spline }, { "Spline", KnownResamplers.Spline },
{ "Robidoux", ResampleMode.Robidoux }, { "Robidoux", KnownResamplers.Robidoux },
{ "RobidouxSharp", ResampleMode.RobidouxSharp }, { "RobidouxSharp", KnownResamplers.RobidouxSharp },
{ "Welch", ResampleMode.Welch } { "Welch", KnownResamplers.Welch }
}; };
[Theory] [Theory]
@ -102,7 +102,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{ {
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())
{ {
image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2, ResampleMode.NearestNeighbor)); image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2, KnownResamplers.NearestNeighbor));
// Comparer fights decoder with gif-s. Could not use CompareToReferenceOutput here :( // Comparer fights decoder with gif-s. Could not use CompareToReferenceOutput here :(
image.DebugSave(provider, extension: Extensions.Gif); image.DebugSave(provider, extension: Extensions.Gif);
@ -119,7 +119,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
var sourceRectangle = new Rectangle(image.Width / 8, image.Height / 8, image.Width / 4, image.Height / 4); var sourceRectangle = new Rectangle(image.Width / 8, image.Height / 8, image.Width / 4, image.Height / 4);
var destRectangle = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2); var destRectangle = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2);
image.Mutate(x => x.Resize(image.Width, image.Height, ResampleMode.Bicubic, sourceRectangle, destRectangle, false)); image.Mutate(x => x.Resize(image.Width, image.Height, KnownResamplers.Bicubic, sourceRectangle, destRectangle, false));
image.DebugSave(provider); image.DebugSave(provider);
image.CompareToReferenceOutput(provider); image.CompareToReferenceOutput(provider);
@ -300,7 +300,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
[InlineData(2, 0)] [InlineData(2, 0)]
public static void BicubicWindowOscillatesCorrectly(float x, float expected) public static void BicubicWindowOscillatesCorrectly(float x, float expected)
{ {
var sampler = ResampleMode.Bicubic; var sampler = KnownResamplers.Bicubic;
float result = sampler.GetValue(x); float result = sampler.GetValue(x);
Assert.Equal(result, expected); Assert.Equal(result, expected);
@ -314,7 +314,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
[InlineData(2, 0)] [InlineData(2, 0)]
public static void TriangleWindowOscillatesCorrectly(float x, float expected) public static void TriangleWindowOscillatesCorrectly(float x, float expected)
{ {
var sampler = ResampleMode.Triangle; var sampler = KnownResamplers.Triangle;
float result = sampler.GetValue(x); float result = sampler.GetValue(x);
Assert.Equal(result, expected); Assert.Equal(result, expected);
@ -328,7 +328,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
[InlineData(2, 0)] [InlineData(2, 0)]
public static void Lanczos3WindowOscillatesCorrectly(float x, float expected) public static void Lanczos3WindowOscillatesCorrectly(float x, float expected)
{ {
var sampler = ResampleMode.Lanczos3; var sampler = KnownResamplers.Lanczos3;
float result = sampler.GetValue(x); float result = sampler.GetValue(x);
Assert.Equal(result, expected); Assert.Equal(result, expected);
@ -342,7 +342,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
[InlineData(4, 0)] [InlineData(4, 0)]
public static void Lanczos5WindowOscillatesCorrectly(float x, float expected) public static void Lanczos5WindowOscillatesCorrectly(float x, float expected)
{ {
var sampler = ResampleMode.Lanczos5; var sampler = KnownResamplers.Lanczos5;
float result = sampler.GetValue(x); float result = sampler.GetValue(x);
Assert.Equal(result, expected); Assert.Equal(result, expected);

16
tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs

@ -13,20 +13,20 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{ {
public static readonly string[] FlipFiles = { TestImages.Bmp.F }; public static readonly string[] FlipFiles = { TestImages.Bmp.F };
public static readonly TheoryData<RotateType, FlipType> RotateFlipValues public static readonly TheoryData<RotateMode, FlipMode> RotateFlipValues
= new TheoryData<RotateType, FlipType> = new TheoryData<RotateMode, FlipMode>
{ {
{ RotateType.None, FlipType.Vertical }, { RotateMode.None, FlipMode.Vertical },
{ RotateType.None, FlipType.Horizontal }, { RotateMode.None, FlipMode.Horizontal },
{ RotateType.Rotate90, FlipType.None }, { RotateMode.Rotate90, FlipMode.None },
{ RotateType.Rotate180, FlipType.None }, { RotateMode.Rotate180, FlipMode.None },
{ RotateType.Rotate270, FlipType.None }, { RotateMode.Rotate270, FlipMode.None },
}; };
[Theory] [Theory]
[WithTestPatternImages(nameof(RotateFlipValues), 100, 50, DefaultPixelType)] [WithTestPatternImages(nameof(RotateFlipValues), 100, 50, DefaultPixelType)]
[WithTestPatternImages(nameof(RotateFlipValues), 50, 100, DefaultPixelType)] [WithTestPatternImages(nameof(RotateFlipValues), 50, 100, DefaultPixelType)]
public void RotateFlip<TPixel>(TestImageProvider<TPixel> provider, RotateType rotateType, FlipType flipType) public void RotateFlip<TPixel>(TestImageProvider<TPixel> provider, RotateMode rotateType, FlipMode flipType)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())

14
tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs

@ -21,13 +21,13 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
50, -50, 170, -170 50, -50, 170, -170
}; };
public static readonly TheoryData<RotateType> RotateEnumValues public static readonly TheoryData<RotateMode> RotateEnumValues
= new TheoryData<RotateType> = new TheoryData<RotateMode>
{ {
RotateType.None, RotateMode.None,
RotateType.Rotate90, RotateMode.Rotate90,
RotateType.Rotate180, RotateMode.Rotate180,
RotateType.Rotate270 RotateMode.Rotate270
}; };
[Theory] [Theory]
@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
[Theory] [Theory]
[WithTestPatternImages(nameof(RotateEnumValues), 100, 50, DefaultPixelType)] [WithTestPatternImages(nameof(RotateEnumValues), 100, 50, DefaultPixelType)]
[WithTestPatternImages(nameof(RotateEnumValues), 50, 100, DefaultPixelType)] [WithTestPatternImages(nameof(RotateEnumValues), 50, 100, DefaultPixelType)]
public void Rotate_WithRotateTypeEnum<TPixel>(TestImageProvider<TPixel> provider, RotateType value) public void Rotate_WithRotateTypeEnum<TPixel>(TestImageProvider<TPixel> provider, RotateMode value)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())

32
tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs

@ -26,21 +26,21 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
public static readonly List<string> ResamplerNames public static readonly List<string> ResamplerNames
= new List<string> = new List<string>
{ {
nameof(ResampleMode.Bicubic), nameof(KnownResamplers.Bicubic),
nameof(ResampleMode.Box), nameof(KnownResamplers.Box),
nameof(ResampleMode.CatmullRom), nameof(KnownResamplers.CatmullRom),
nameof(ResampleMode.Hermite), nameof(KnownResamplers.Hermite),
nameof(ResampleMode.Lanczos2), nameof(KnownResamplers.Lanczos2),
nameof(ResampleMode.Lanczos3), nameof(KnownResamplers.Lanczos3),
nameof(ResampleMode.Lanczos5), nameof(KnownResamplers.Lanczos5),
nameof(ResampleMode.Lanczos8), nameof(KnownResamplers.Lanczos8),
nameof(ResampleMode.MitchellNetravali), nameof(KnownResamplers.MitchellNetravali),
nameof(ResampleMode.NearestNeighbor), nameof(KnownResamplers.NearestNeighbor),
nameof(ResampleMode.Robidoux), nameof(KnownResamplers.Robidoux),
nameof(ResampleMode.RobidouxSharp), nameof(KnownResamplers.RobidouxSharp),
nameof(ResampleMode.Spline), nameof(KnownResamplers.Spline),
nameof(ResampleMode.Triangle), nameof(KnownResamplers.Triangle),
nameof(ResampleMode.Welch), nameof(KnownResamplers.Welch),
}; };
[Theory] [Theory]
@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
private static IResampler GetResampler(string name) private static IResampler GetResampler(string name)
{ {
PropertyInfo property = typeof(ResampleMode).GetTypeInfo().GetProperty(name); PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);
if (property == null) if (property == null)
{ {

48
tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs

@ -38,30 +38,30 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
public static readonly TheoryData<string> ResamplerNames = public static readonly TheoryData<string> ResamplerNames =
new TheoryData<string> new TheoryData<string>
{ {
nameof(ResampleMode.Bicubic), nameof(KnownResamplers.Bicubic),
nameof(ResampleMode.Box), nameof(KnownResamplers.Box),
nameof(ResampleMode.CatmullRom), nameof(KnownResamplers.CatmullRom),
nameof(ResampleMode.Hermite), nameof(KnownResamplers.Hermite),
nameof(ResampleMode.Lanczos2), nameof(KnownResamplers.Lanczos2),
nameof(ResampleMode.Lanczos3), nameof(KnownResamplers.Lanczos3),
nameof(ResampleMode.Lanczos5), nameof(KnownResamplers.Lanczos5),
nameof(ResampleMode.Lanczos8), nameof(KnownResamplers.Lanczos8),
nameof(ResampleMode.MitchellNetravali), nameof(KnownResamplers.MitchellNetravali),
nameof(ResampleMode.NearestNeighbor), nameof(KnownResamplers.NearestNeighbor),
nameof(ResampleMode.Robidoux), nameof(KnownResamplers.Robidoux),
nameof(ResampleMode.RobidouxSharp), nameof(KnownResamplers.RobidouxSharp),
nameof(ResampleMode.Spline), nameof(KnownResamplers.Spline),
nameof(ResampleMode.Triangle), nameof(KnownResamplers.Triangle),
nameof(ResampleMode.Welch), nameof(KnownResamplers.Welch),
}; };
public static readonly TheoryData<string> Transform_DoesNotCreateEdgeArtifacts_ResamplerNames = public static readonly TheoryData<string> Transform_DoesNotCreateEdgeArtifacts_ResamplerNames =
new TheoryData<string> new TheoryData<string>
{ {
nameof(ResampleMode.NearestNeighbor), nameof(KnownResamplers.NearestNeighbor),
nameof(ResampleMode.Triangle), nameof(KnownResamplers.Triangle),
nameof(ResampleMode.Bicubic), nameof(KnownResamplers.Bicubic),
nameof(ResampleMode.Lanczos8), nameof(KnownResamplers.Lanczos8),
}; };
public AffineTransformTests(ITestOutputHelper output) public AffineTransformTests(ITestOutputHelper output)
@ -113,7 +113,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
this.PrintMatrix(m); this.PrintMatrix(m);
image.Mutate(i => i.Transform(m, ResampleMode.Bicubic)); image.Mutate(i => i.Transform(m, KnownResamplers.Bicubic));
string testOutputDetails = $"R({angleDeg})_S({sx},{sy})_T({tx},{ty})"; string testOutputDetails = $"R({angleDeg})_S({sx},{sy})_T({tx},{ty})";
image.DebugSave(provider, testOutputDetails); image.DebugSave(provider, testOutputDetails);
@ -130,7 +130,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
Matrix3x2 m = this.MakeManuallyCenteredMatrix(angleDeg, s, image); Matrix3x2 m = this.MakeManuallyCenteredMatrix(angleDeg, s, image);
image.Mutate(i => i.Transform(m, ResampleMode.Bicubic)); image.Mutate(i => i.Transform(m, KnownResamplers.Bicubic));
string testOutputDetails = $"R({angleDeg})_S({s})"; string testOutputDetails = $"R({angleDeg})_S({s})";
image.DebugSave(provider, testOutputDetails); image.DebugSave(provider, testOutputDetails);
@ -163,7 +163,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
var m = Matrix3x2.CreateScale(2.0F, 1.5F); var m = Matrix3x2.CreateScale(2.0F, 1.5F);
image.Mutate(i => i.Transform(m, ResampleMode.Spline, rectangle)); image.Mutate(i => i.Transform(m, KnownResamplers.Spline, rectangle));
image.DebugSave(provider); image.DebugSave(provider);
image.CompareToReferenceOutput(provider); image.CompareToReferenceOutput(provider);
@ -181,7 +181,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
var m = Matrix3x2.CreateScale(1.0F, 2.0F); var m = Matrix3x2.CreateScale(1.0F, 2.0F);
image.Mutate(i => i.Transform(m, ResampleMode.Spline, rectangle)); image.Mutate(i => i.Transform(m, KnownResamplers.Spline, rectangle));
image.DebugSave(provider); image.DebugSave(provider);
image.CompareToReferenceOutput(provider); image.CompareToReferenceOutput(provider);
@ -225,7 +225,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
private static IResampler GetResampler(string name) private static IResampler GetResampler(string name)
{ {
PropertyInfo property = typeof(ResampleMode).GetTypeInfo().GetProperty(name); PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);
if (property == null) if (property == null)
{ {

10
tests/ImageSharp.Tests/Processing/Transforms/FlipTests.cs

@ -16,15 +16,15 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
[Theory] [Theory]
[InlineData(FlipType.None)] [InlineData(FlipMode.None)]
[InlineData(FlipType.Horizontal)] [InlineData(FlipMode.Horizontal)]
[InlineData(FlipType.Vertical)] [InlineData(FlipMode.Vertical)]
public void Flip_degreesFloat_RotateProcessorWithAnglesSetAndExpandTrue(FlipType flip) public void Flip_degreesFloat_RotateProcessorWithAnglesSetAndExpandTrue(FlipMode flip)
{ {
this.operations.Flip(flip); this.operations.Flip(flip);
FlipProcessor<Rgba32> flipProcessor = this.Verify<FlipProcessor<Rgba32>>(); FlipProcessor<Rgba32> flipProcessor = this.Verify<FlipProcessor<Rgba32>>();
Assert.Equal(flip, flipProcessor.FlipType); Assert.Equal(flip, flipProcessor.FlipMode);
} }
} }
} }

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

@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
int width = 500; int width = 500;
int height = 565; int height = 565;
IResampler sampler = ResampleMode.NearestNeighbor; IResampler sampler = KnownResamplers.NearestNeighbor;
this.operations.Pad(width, height); this.operations.Pad(width, height);
ResizeProcessor<Rgba32> resizeProcessor = this.Verify<ResizeProcessor<Rgba32>>(); ResizeProcessor<Rgba32> resizeProcessor = this.Verify<ResizeProcessor<Rgba32>>();

6
tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs

@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
int width = 50; int width = 50;
int height = 100; int height = 100;
IResampler sampler = ResampleMode.Lanczos3; IResampler sampler = KnownResamplers.Lanczos3;
this.operations.Resize(width, height, sampler); this.operations.Resize(width, height, sampler);
ResizeProcessor<Rgba32> resizeProcessor = this.Verify<ResizeProcessor<Rgba32>>(); ResizeProcessor<Rgba32> resizeProcessor = this.Verify<ResizeProcessor<Rgba32>>();
@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
int width = 50; int width = 50;
int height = 100; int height = 100;
IResampler sampler = ResampleMode.Lanczos3; IResampler sampler = KnownResamplers.Lanczos3;
bool compand = true; bool compand = true;
// ReSharper disable once ConditionIsAlwaysTrueOrFalse // ReSharper disable once ConditionIsAlwaysTrueOrFalse
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{ {
int width = 50; int width = 50;
int height = 100; int height = 100;
IResampler sampler = ResampleMode.Lanczos3; IResampler sampler = KnownResamplers.Lanczos3;
bool compand = true; bool compand = true;
ResizeMode mode = ResizeMode.Stretch; ResizeMode mode = ResizeMode.Stretch;

28
tests/ImageSharp.Tests/Processing/Transforms/RotateFlipTests.cs

@ -11,26 +11,26 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
public class RotateFlipTests : BaseImageOperationsExtensionTest public class RotateFlipTests : BaseImageOperationsExtensionTest
{ {
[Theory] [Theory]
[InlineData(RotateType.None, FlipType.None, 0)] [InlineData(RotateMode.None, FlipMode.None, 0)]
[InlineData(RotateType.Rotate90, FlipType.None, 90)] [InlineData(RotateMode.Rotate90, FlipMode.None, 90)]
[InlineData(RotateType.Rotate180, FlipType.None, 180)] [InlineData(RotateMode.Rotate180, FlipMode.None, 180)]
[InlineData(RotateType.Rotate270, FlipType.None, 270)] [InlineData(RotateMode.Rotate270, FlipMode.None, 270)]
[InlineData(RotateType.None, FlipType.Horizontal, 0)] [InlineData(RotateMode.None, FlipMode.Horizontal, 0)]
[InlineData(RotateType.Rotate90, FlipType.Horizontal, 90)] [InlineData(RotateMode.Rotate90, FlipMode.Horizontal, 90)]
[InlineData(RotateType.Rotate180, FlipType.Horizontal, 180)] [InlineData(RotateMode.Rotate180, FlipMode.Horizontal, 180)]
[InlineData(RotateType.Rotate270, FlipType.Horizontal, 270)] [InlineData(RotateMode.Rotate270, FlipMode.Horizontal, 270)]
[InlineData(RotateType.None, FlipType.Vertical, 0)] [InlineData(RotateMode.None, FlipMode.Vertical, 0)]
[InlineData(RotateType.Rotate90, FlipType.Vertical, 90)] [InlineData(RotateMode.Rotate90, FlipMode.Vertical, 90)]
[InlineData(RotateType.Rotate180, FlipType.Vertical, 180)] [InlineData(RotateMode.Rotate180, FlipMode.Vertical, 180)]
[InlineData(RotateType.Rotate270, FlipType.Vertical, 270)] [InlineData(RotateMode.Rotate270, FlipMode.Vertical, 270)]
public void RotateDegreesFloatRotateProcessorWithAnglesSet(RotateType angle, FlipType flip, float expectedAngle) public void RotateDegreesFloatRotateProcessorWithAnglesSet(RotateMode angle, FlipMode flip, float expectedAngle)
{ {
this.operations.RotateFlip(angle, flip); this.operations.RotateFlip(angle, flip);
RotateProcessor<Rgba32> rotateProcessor = this.Verify<RotateProcessor<Rgba32>>(0); RotateProcessor<Rgba32> rotateProcessor = this.Verify<RotateProcessor<Rgba32>>(0);
FlipProcessor<Rgba32> flipProcessor = this.Verify<FlipProcessor<Rgba32>>(1); FlipProcessor<Rgba32> flipProcessor = this.Verify<FlipProcessor<Rgba32>>(1);
Assert.Equal(expectedAngle, rotateProcessor.Degrees); Assert.Equal(expectedAngle, rotateProcessor.Degrees);
Assert.Equal(flip, flipProcessor.FlipType); Assert.Equal(flip, flipProcessor.FlipMode);
} }
} }
} }

10
tests/ImageSharp.Tests/Processing/Transforms/RotateTests.cs

@ -25,11 +25,11 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
} }
[Theory] [Theory]
[InlineData(RotateType.None, 0)] [InlineData(RotateMode.None, 0)]
[InlineData(RotateType.Rotate90, 90)] [InlineData(RotateMode.Rotate90, 90)]
[InlineData(RotateType.Rotate180, 180)] [InlineData(RotateMode.Rotate180, 180)]
[InlineData(RotateType.Rotate270, 270)] [InlineData(RotateMode.Rotate270, 270)]
public void RotateRotateTypeRotateProcessorWithAnglesConvertedFromEnum(RotateType angle, float expectedAngle) public void RotateRotateTypeRotateProcessorWithAnglesConvertedFromEnum(RotateMode angle, float expectedAngle)
{ {
this.operations.Rotate(angle); // is this api needed ??? this.operations.Rotate(angle); // is this api needed ???
RotateProcessor<Rgba32> processor = this.Verify<RotateProcessor<Rgba32>>(); RotateProcessor<Rgba32> processor = this.Verify<RotateProcessor<Rgba32>>();

Loading…
Cancel
Save