Browse Source

Merge pull request #361 from SixLabors/js/fix-diffused-animations

Js/fix diffused animations
af/merge-core
James Jackson-South 9 years ago
committed by GitHub
parent
commit
450211f56a
  1. 1
      src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs
  2. 1
      src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs
  3. 2
      src/ImageSharp/Quantizers/QuantizerBase{TPixel}.cs
  4. 1
      src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs

1
src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs

@ -61,6 +61,7 @@ namespace SixLabors.ImageSharp.Quantizers
this.colors = (byte)maxColors.Clamp(1, 255); this.colors = (byte)maxColors.Clamp(1, 255);
this.octree = new Octree(this.GetBitsNeededForColorDepth(this.colors)); this.octree = new Octree(this.GetBitsNeededForColorDepth(this.colors));
this.palette = null; this.palette = null;
this.colorMap.Clear();
return base.Quantize(image, this.colors); return base.Quantize(image, this.colors);
} }

1
src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs

@ -58,6 +58,7 @@ namespace SixLabors.ImageSharp.Quantizers
public override QuantizedImage<TPixel> Quantize(ImageFrame<TPixel> image, int maxColors) public override QuantizedImage<TPixel> Quantize(ImageFrame<TPixel> image, int maxColors)
{ {
Array.Resize(ref this.colors, maxColors.Clamp(1, 255)); Array.Resize(ref this.colors, maxColors.Clamp(1, 255));
this.colorMap.Clear();
return base.Quantize(image, maxColors); return base.Quantize(image, maxColors);
} }

2
src/ImageSharp/Quantizers/QuantizerBase{TPixel}.cs

@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Quantizers.Base
public bool Dither { get; set; } = true; public bool Dither { get; set; } = true;
/// <inheritdoc /> /// <inheritdoc />
public IErrorDiffuser DitherType { get; set; } = new SierraLiteDiffuser(); public IErrorDiffuser DitherType { get; set; } = new FloydSteinbergDiffuser();
/// <inheritdoc/> /// <inheritdoc/>
public virtual QuantizedImage<TPixel> Quantize(ImageFrame<TPixel> image, int maxColors) public virtual QuantizedImage<TPixel> Quantize(ImageFrame<TPixel> image, int maxColors)

1
src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs

@ -139,6 +139,7 @@ namespace SixLabors.ImageSharp.Quantizers
this.colors = maxColors.Clamp(1, 255); this.colors = maxColors.Clamp(1, 255);
this.palette = null; this.palette = null;
this.colorMap.Clear();
try try
{ {

Loading…
Cancel
Save