From c7c05c9b1d52d22aa7d7e9f0adb86f0e1a15b013 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 13 Feb 2017 17:00:48 +1100 Subject: [PATCH] Rename base interface, fix Stucki filter --- src/ImageSharp/Dithering/Atkinson.cs | 2 +- src/ImageSharp/Dithering/Burks.cs | 2 +- .../Dithering/{ErrorDiffusion.cs => ErrorDiffuser.cs} | 8 ++++---- src/ImageSharp/Dithering/FloydSteinberg.cs | 2 +- .../Dithering/{IErrorDiffusion.cs => IErrorDiffuser.cs} | 4 ++-- src/ImageSharp/Dithering/JarvisJudiceNinke.cs | 2 +- src/ImageSharp/Dithering/Sierra2.cs | 2 +- src/ImageSharp/Dithering/Sierra3.cs | 2 +- src/ImageSharp/Dithering/SierraLite.cs | 2 +- src/ImageSharp/Dithering/Stucki.cs | 4 ++-- src/ImageSharp/Quantizers/IQuantizer.cs | 2 +- src/ImageSharp/Quantizers/Octree/Quantizer.cs | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) rename src/ImageSharp/Dithering/{ErrorDiffusion.cs => ErrorDiffuser.cs} (94%) rename src/ImageSharp/Dithering/{IErrorDiffusion.cs => IErrorDiffuser.cs} (91%) diff --git a/src/ImageSharp/Dithering/Atkinson.cs b/src/ImageSharp/Dithering/Atkinson.cs index 6d1580171c..934df7e4a8 100644 --- a/src/ImageSharp/Dithering/Atkinson.cs +++ b/src/ImageSharp/Dithering/Atkinson.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the Atkinson image dithering algorithm. /// /// - public class Atkinson : ErrorDiffusion + public sealed class Atkinson : ErrorDiffuser { /// /// The diffusion matrix diff --git a/src/ImageSharp/Dithering/Burks.cs b/src/ImageSharp/Dithering/Burks.cs index 3e2d19e57e..311316685b 100644 --- a/src/ImageSharp/Dithering/Burks.cs +++ b/src/ImageSharp/Dithering/Burks.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the Burks image dithering algorithm. /// /// - public class Burks : ErrorDiffusion + public sealed class Burks : ErrorDiffuser { /// /// The diffusion matrix diff --git a/src/ImageSharp/Dithering/ErrorDiffusion.cs b/src/ImageSharp/Dithering/ErrorDiffuser.cs similarity index 94% rename from src/ImageSharp/Dithering/ErrorDiffusion.cs rename to src/ImageSharp/Dithering/ErrorDiffuser.cs index 481e8b4a69..1de6cd8149 100644 --- a/src/ImageSharp/Dithering/ErrorDiffusion.cs +++ b/src/ImageSharp/Dithering/ErrorDiffuser.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -12,7 +12,7 @@ namespace ImageSharp.Dithering /// /// The base class for performing effor diffusion based dithering. /// - public abstract class ErrorDiffusion : IErrorDiffusion + public abstract class ErrorDiffuser : IErrorDiffuser { /// /// The vector to perform division. @@ -35,11 +35,11 @@ namespace ImageSharp.Dithering private readonly int startingOffset; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The dithering matrix. /// The divisor. - protected ErrorDiffusion(byte[,] matrix, byte divisor) + protected ErrorDiffuser(byte[,] matrix, byte divisor) { Guard.NotNull(matrix, nameof(matrix)); Guard.MustBeGreaterThan(divisor, 0, nameof(divisor)); diff --git a/src/ImageSharp/Dithering/FloydSteinberg.cs b/src/ImageSharp/Dithering/FloydSteinberg.cs index a87421b959..a392c9dc9c 100644 --- a/src/ImageSharp/Dithering/FloydSteinberg.cs +++ b/src/ImageSharp/Dithering/FloydSteinberg.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the Floyd–Steinberg image dithering algorithm. /// /// - public class FloydSteinberg : ErrorDiffusion + public sealed class FloydSteinberg : ErrorDiffuser { /// /// The diffusion matrix diff --git a/src/ImageSharp/Dithering/IErrorDiffusion.cs b/src/ImageSharp/Dithering/IErrorDiffuser.cs similarity index 91% rename from src/ImageSharp/Dithering/IErrorDiffusion.cs rename to src/ImageSharp/Dithering/IErrorDiffuser.cs index cd38cd1cd3..22cbad1e6e 100644 --- a/src/ImageSharp/Dithering/IErrorDiffusion.cs +++ b/src/ImageSharp/Dithering/IErrorDiffuser.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,7 +10,7 @@ namespace ImageSharp.Dithering /// /// Encapsulates properties and methods required to perfom diffused error dithering on an image. /// - public interface IErrorDiffusion + public interface IErrorDiffuser { /// /// Gets the dithering matrix diff --git a/src/ImageSharp/Dithering/JarvisJudiceNinke.cs b/src/ImageSharp/Dithering/JarvisJudiceNinke.cs index a495f60014..b5876d7773 100644 --- a/src/ImageSharp/Dithering/JarvisJudiceNinke.cs +++ b/src/ImageSharp/Dithering/JarvisJudiceNinke.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the JarvisJudiceNinke image dithering algorithm. /// /// - public class JarvisJudiceNinke : ErrorDiffusion + public sealed class JarvisJudiceNinke : ErrorDiffuser { /// /// The diffusion matrix diff --git a/src/ImageSharp/Dithering/Sierra2.cs b/src/ImageSharp/Dithering/Sierra2.cs index a2a6db36d6..d7cc84254e 100644 --- a/src/ImageSharp/Dithering/Sierra2.cs +++ b/src/ImageSharp/Dithering/Sierra2.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the Sierra2 image dithering algorithm. /// /// - public class Sierra2 : ErrorDiffusion + public sealed class Sierra2 : ErrorDiffuser { /// /// The diffusion matrix diff --git a/src/ImageSharp/Dithering/Sierra3.cs b/src/ImageSharp/Dithering/Sierra3.cs index 8ab9279f38..c3d1fe7565 100644 --- a/src/ImageSharp/Dithering/Sierra3.cs +++ b/src/ImageSharp/Dithering/Sierra3.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the Sierra3 image dithering algorithm. /// /// - public class Sierra3 : ErrorDiffusion + public sealed class Sierra3 : ErrorDiffuser { /// /// The diffusion matrix diff --git a/src/ImageSharp/Dithering/SierraLite.cs b/src/ImageSharp/Dithering/SierraLite.cs index 217b6ac5f8..7d855b84e3 100644 --- a/src/ImageSharp/Dithering/SierraLite.cs +++ b/src/ImageSharp/Dithering/SierraLite.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the SierraLite image dithering algorithm. /// /// - public class SierraLite : ErrorDiffusion + public sealed class SierraLite : ErrorDiffuser { /// /// The diffusion matrix diff --git a/src/ImageSharp/Dithering/Stucki.cs b/src/ImageSharp/Dithering/Stucki.cs index 0b9b40f735..3cc01aa798 100644 --- a/src/ImageSharp/Dithering/Stucki.cs +++ b/src/ImageSharp/Dithering/Stucki.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Dithering /// Applies error diffusion based dithering using the Stucki image dithering algorithm. /// /// - public class Stucki : ErrorDiffusion + public sealed class Stucki : ErrorDiffuser { /// /// The diffusion matrix @@ -25,7 +25,7 @@ namespace ImageSharp.Dithering /// Initializes a new instance of the class. /// public Stucki() - : base(StuckiMatrix, 4) + : base(StuckiMatrix, 42) { } } diff --git a/src/ImageSharp/Quantizers/IQuantizer.cs b/src/ImageSharp/Quantizers/IQuantizer.cs index a027ca94cc..ef2f0bb98e 100644 --- a/src/ImageSharp/Quantizers/IQuantizer.cs +++ b/src/ImageSharp/Quantizers/IQuantizer.cs @@ -42,7 +42,7 @@ namespace ImageSharp.Quantizers /// /// Gets or sets the dithering algorithm to apply to the output image. /// - IErrorDiffusion DitherType { get; set; } + IErrorDiffuser DitherType { get; set; } } /// diff --git a/src/ImageSharp/Quantizers/Octree/Quantizer.cs b/src/ImageSharp/Quantizers/Octree/Quantizer.cs index 65a9d1ede6..4d16c5df36 100644 --- a/src/ImageSharp/Quantizers/Octree/Quantizer.cs +++ b/src/ImageSharp/Quantizers/Octree/Quantizer.cs @@ -48,7 +48,7 @@ namespace ImageSharp.Quantizers public bool Dither { get; set; } = true; /// - public IErrorDiffusion DitherType { get; set; } = new SierraLite(); + public IErrorDiffuser DitherType { get; set; } = new SierraLite(); /// public virtual QuantizedImage Quantize(ImageBase image, int maxColors)