Browse Source

Lomograph

af/merge-core
James Jackson-South 9 years ago
parent
commit
33a46c13e1
  1. 4
      tests/ImageSharp.Tests/Processing/ColorMatrix/ColorBlindnessTest.cs
  2. 4
      tests/ImageSharp.Tests/Processing/ColorMatrix/HueTest.cs
  3. 48
      tests/ImageSharp.Tests/Processing/ColorMatrix/LomographTest.cs
  4. 48
      tests/ImageSharp.Tests/Processors/Filters/LomographTest.cs

4
tests/ImageSharp.Tests/Processing/ColorMatrix/ColorBlindnessTest.cs

@ -33,7 +33,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix
using (Image<TPixel> image = provider.GetImage())
{
image.ColorBlindness(colorBlindness)
.DebugSave(provider, null, Extensions.Bmp);
.DebugSave(provider, colorBlindness.ToString(), Extensions.Bmp);
}
}
@ -48,7 +48,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix
var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
image.ColorBlindness(colorBlindness, bounds)
.DebugSave(provider, null, Extensions.Bmp);
.DebugSave(provider, colorBlindness.ToString(), Extensions.Bmp);
// Draw identical shapes over the bounded and compare to ensure changes are constrained.
image.Fill(NamedColors<TPixel>.HotPink, bounds);

4
tests/ImageSharp.Tests/Processing/ColorMatrix/HueTest.cs

@ -26,7 +26,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix
using (Image<TPixel> image = provider.GetImage())
{
image.Hue(value)
.DebugSave(provider, null, Extensions.Bmp);
.DebugSave(provider, value, Extensions.Bmp);
}
}
@ -41,7 +41,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix
var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
image.Hue(value, bounds)
.DebugSave(provider, null, Extensions.Bmp);
.DebugSave(provider, value, Extensions.Bmp);
// Draw identical shapes over the bounded and compare to ensure changes are constrained.
image.Fill(NamedColors<TPixel>.HotPink, bounds);

48
tests/ImageSharp.Tests/Processing/ColorMatrix/LomographTest.cs

@ -0,0 +1,48 @@
// <copyright file="LomographTest.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Tests
{
using System.IO;
using ImageSharp.PixelFormats;
using Xunit;
public class LomographTest : FileTestBase
{
[Theory]
[WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)]
public void ImageShouldApplyLomographFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
{
image.Lomograph()
.DebugSave(provider, null, Extensions.Bmp);
}
}
[Theory]
[WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)]
public void ImageShouldApplyLomographFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())
using (var image = new Image<TPixel>(source))
{
var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
image.Lomograph(bounds)
.DebugSave(provider, null, Extensions.Bmp);
// Draw identical shapes over the bounded and compare to ensure changes are constrained.
image.Fill(NamedColors<TPixel>.HotPink, bounds);
source.Fill(NamedColors<TPixel>.HotPink, bounds);
ImageComparer.CheckSimilarity(image, source);
}
}
}
}

48
tests/ImageSharp.Tests/Processors/Filters/LomographTest.cs

@ -1,48 +0,0 @@
// <copyright file="LomographTest.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Tests
{
using System.IO;
using ImageSharp.PixelFormats;
using Xunit;
public class LomographTest : FileTestBase
{
[Fact]
public void ImageShouldApplyLomographFilter()
{
string path = this.CreateOutputDirectory("Lomograph");
foreach (TestFile file in Files)
{
using (Image<Rgba32> image = file.CreateImage())
using (FileStream output = File.OpenWrite($"{path}/{file.FileName}"))
{
image.Lomograph().Save(output);
}
}
}
[Fact]
public void ImageShouldApplyLomographFilterInBox()
{
string path = this.CreateOutputDirectory("Lomograph");
foreach (TestFile file in Files)
{
string filename = file.GetFileName("InBox");
using (Image<Rgba32> image = file.CreateImage())
using (FileStream output = File.OpenWrite($"{path}/{filename}"))
{
image.Lomograph(new Rectangle(image.Width / 4, image.Width / 4, image.Width / 2, image.Height / 2))
.Save(output);
}
}
}
}
}
Loading…
Cancel
Save