Browse Source

Rename base interface, fix Stucki filter

pull/106/head
James Jackson-South 9 years ago
parent
commit
0003b9a79d
  1. 2
      src/ImageSharp/Dithering/Atkinson.cs
  2. 2
      src/ImageSharp/Dithering/Burks.cs
  3. 8
      src/ImageSharp/Dithering/ErrorDiffuser.cs
  4. 2
      src/ImageSharp/Dithering/FloydSteinberg.cs
  5. 4
      src/ImageSharp/Dithering/IErrorDiffuser.cs
  6. 2
      src/ImageSharp/Dithering/JarvisJudiceNinke.cs
  7. 2
      src/ImageSharp/Dithering/Sierra2.cs
  8. 2
      src/ImageSharp/Dithering/Sierra3.cs
  9. 2
      src/ImageSharp/Dithering/SierraLite.cs
  10. 4
      src/ImageSharp/Dithering/Stucki.cs
  11. 2
      src/ImageSharp/Quantizers/IQuantizer.cs
  12. 2
      src/ImageSharp/Quantizers/Octree/Quantizer.cs

2
src/ImageSharp/Dithering/Atkinson.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the Atkinson image dithering algorithm. /// Applies error diffusion based dithering using the Atkinson image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class Atkinson : ErrorDiffusion public sealed class Atkinson : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix

2
src/ImageSharp/Dithering/Burks.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the Burks image dithering algorithm. /// Applies error diffusion based dithering using the Burks image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class Burks : ErrorDiffusion public sealed class Burks : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix

8
src/ImageSharp/Dithering/ErrorDiffusion.cs → src/ImageSharp/Dithering/ErrorDiffuser.cs

@ -1,4 +1,4 @@
// <copyright file="ErrorDiffusion.cs" company="James Jackson-South"> // <copyright file="ErrorDiffuser.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors. // Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
// </copyright> // </copyright>
@ -12,7 +12,7 @@ namespace ImageSharp.Dithering
/// <summary> /// <summary>
/// The base class for performing effor diffusion based dithering. /// The base class for performing effor diffusion based dithering.
/// </summary> /// </summary>
public abstract class ErrorDiffusion : IErrorDiffusion public abstract class ErrorDiffuser : IErrorDiffuser
{ {
/// <summary> /// <summary>
/// The vector to perform division. /// The vector to perform division.
@ -35,11 +35,11 @@ namespace ImageSharp.Dithering
private readonly int startingOffset; private readonly int startingOffset;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ErrorDiffusion"/> class. /// Initializes a new instance of the <see cref="ErrorDiffuser"/> class.
/// </summary> /// </summary>
/// <param name="matrix">The dithering matrix.</param> /// <param name="matrix">The dithering matrix.</param>
/// <param name="divisor">The divisor.</param> /// <param name="divisor">The divisor.</param>
protected ErrorDiffusion(byte[,] matrix, byte divisor) protected ErrorDiffuser(byte[,] matrix, byte divisor)
{ {
Guard.NotNull(matrix, nameof(matrix)); Guard.NotNull(matrix, nameof(matrix));
Guard.MustBeGreaterThan(divisor, 0, nameof(divisor)); Guard.MustBeGreaterThan(divisor, 0, nameof(divisor));

2
src/ImageSharp/Dithering/FloydSteinberg.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the Floyd–Steinberg image dithering algorithm. /// Applies error diffusion based dithering using the Floyd–Steinberg image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class FloydSteinberg : ErrorDiffusion public sealed class FloydSteinberg : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix

4
src/ImageSharp/Dithering/IErrorDiffusion.cs → src/ImageSharp/Dithering/IErrorDiffuser.cs

@ -1,4 +1,4 @@
// <copyright file="IErrorDiffusion.cs" company="James Jackson-South"> // <copyright file="IErrorDiffuser.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors. // Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
// </copyright> // </copyright>
@ -10,7 +10,7 @@ namespace ImageSharp.Dithering
/// <summary> /// <summary>
/// Encapsulates properties and methods required to perfom diffused error dithering on an image. /// Encapsulates properties and methods required to perfom diffused error dithering on an image.
/// </summary> /// </summary>
public interface IErrorDiffusion public interface IErrorDiffuser
{ {
/// <summary> /// <summary>
/// Gets the dithering matrix /// Gets the dithering matrix

2
src/ImageSharp/Dithering/JarvisJudiceNinke.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the JarvisJudiceNinke image dithering algorithm. /// Applies error diffusion based dithering using the JarvisJudiceNinke image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class JarvisJudiceNinke : ErrorDiffusion public sealed class JarvisJudiceNinke : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix

2
src/ImageSharp/Dithering/Sierra2.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the Sierra2 image dithering algorithm. /// Applies error diffusion based dithering using the Sierra2 image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class Sierra2 : ErrorDiffusion public sealed class Sierra2 : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix

2
src/ImageSharp/Dithering/Sierra3.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the Sierra3 image dithering algorithm. /// Applies error diffusion based dithering using the Sierra3 image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class Sierra3 : ErrorDiffusion public sealed class Sierra3 : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix

2
src/ImageSharp/Dithering/SierraLite.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the SierraLite image dithering algorithm. /// Applies error diffusion based dithering using the SierraLite image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class SierraLite : ErrorDiffusion public sealed class SierraLite : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix

4
src/ImageSharp/Dithering/Stucki.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Dithering
/// Applies error diffusion based dithering using the Stucki image dithering algorithm. /// Applies error diffusion based dithering using the Stucki image dithering algorithm.
/// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/> /// <see href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT"/>
/// </summary> /// </summary>
public class Stucki : ErrorDiffusion public sealed class Stucki : ErrorDiffuser
{ {
/// <summary> /// <summary>
/// The diffusion matrix /// The diffusion matrix
@ -25,7 +25,7 @@ namespace ImageSharp.Dithering
/// Initializes a new instance of the <see cref="Stucki"/> class. /// Initializes a new instance of the <see cref="Stucki"/> class.
/// </summary> /// </summary>
public Stucki() public Stucki()
: base(StuckiMatrix, 4) : base(StuckiMatrix, 42)
{ {
} }
} }

2
src/ImageSharp/Quantizers/IQuantizer.cs

@ -42,7 +42,7 @@ namespace ImageSharp.Quantizers
/// <summary> /// <summary>
/// Gets or sets the dithering algorithm to apply to the output image. /// Gets or sets the dithering algorithm to apply to the output image.
/// </summary> /// </summary>
IErrorDiffusion DitherType { get; set; } IErrorDiffuser DitherType { get; set; }
} }
/// <summary> /// <summary>

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

@ -48,7 +48,7 @@ namespace ImageSharp.Quantizers
public bool Dither { get; set; } = true; public bool Dither { get; set; } = true;
/// <inheritdoc /> /// <inheritdoc />
public IErrorDiffusion DitherType { get; set; } = new SierraLite(); public IErrorDiffuser DitherType { get; set; } = new SierraLite();
/// <inheritdoc/> /// <inheritdoc/>
public virtual QuantizedImage<TColor> Quantize(ImageBase<TColor> image, int maxColors) public virtual QuantizedImage<TColor> Quantize(ImageBase<TColor> image, int maxColors)

Loading…
Cancel
Save