Browse Source

remove theashold

alpha theshold doesn't make sense for palette indexed colors.
af/merge-core
Scott Williams 9 years ago
parent
commit
ba81ec0e2e
  1. 5
      src/ImageSharp/Formats/Png/IPngEncoderOptions.cs
  2. 5
      src/ImageSharp/Formats/Png/PngEncoderOptions.cs
  3. 40
      tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs

5
src/ImageSharp/Formats/Png/IPngEncoderOptions.cs

@ -40,11 +40,6 @@ namespace ImageSharp.Formats
/// </summary>
IQuantizer Quantizer { get; }
/// <summary>
/// Gets the transparency threshold.
/// </summary>
byte Threshold { get; }
/// <summary>
/// Gets a value indicating whether this instance should write
/// gamma information to the stream.

5
src/ImageSharp/Formats/Png/PngEncoderOptions.cs

@ -57,11 +57,6 @@ namespace ImageSharp.Formats
/// </summary>
public IQuantizer Quantizer { get; set; }
/// <summary>
/// Gets or sets the transparency threshold.
/// </summary>
public byte Threshold { get; set; } = 0;
/// <summary>
/// Gets or sets a value indicating whether this instance should write
/// gamma information to the stream. The default value is false.

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

@ -58,6 +58,46 @@ namespace ImageSharp.Tests.Formats.Png
}
}
[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Color)]
public void CanSaveIndexedPngTwice<TColor>(TestImageProvider<TColor> provider)
where TColor : struct, IPixel<TColor>
{
// does saving a file then repoening mean both files are identical???
using (Image<TColor> source = provider.GetImage())
using (MemoryStream ms = new MemoryStream())
{
// image.Save(provider.Utility.GetTestOutputFileName("bmp"));
source.MetaData.Quality = 256;
source.Save(ms, new PngEncoder());
ms.Position = 0;
using (Image img1 = Image.Load(ms, new PngDecoder()))
{
using (MemoryStream ms2 = new MemoryStream())
{
img1.Save(ms2, new PngEncoder());
ms2.Position = 0;
using (Image img2 = Image.Load(ms2, new PngDecoder()))
{
using (PixelAccessor<Color> pixels1 = img1.Lock())
using (PixelAccessor<Color> pixels2 = img2.Lock())
{
for (int y = 0; y < img1.Height; y++)
{
for (int x = 0; x < img1.Width; x++)
{
Assert.Equal(pixels1[x, y], pixels2[x, y]);
}
}
}
// img2.Save(provider.Utility.GetTestOutputFileName("bmp", "_loaded"), new BmpEncoder());
ImageComparer.CheckSimilarity(source, img2);
}
}
}
}
}
[Theory]
[WithTestPatternImages(300, 300, PixelTypes.All)]
public void Resize<TColor>(TestImageProvider<TColor> provider)

Loading…
Cancel
Save