mirror of https://github.com/SixLabors/ImageSharp
6 changed files with 142 additions and 166 deletions
@ -0,0 +1,70 @@ |
|||
// <copyright file="GlowTest.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Tests.Processing.Overlays |
|||
{ |
|||
using ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
|
|||
public class GlowTest : FileTestBase |
|||
{ |
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyGlowFilter<TPixel>(TestImageProvider<TPixel> provider) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Glow() |
|||
.DebugSave(provider, null, Extensions.Bmp); |
|||
} |
|||
} |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyGlowFilterColor<TPixel>(TestImageProvider<TPixel> provider) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Glow(NamedColors<TPixel>.Orange) |
|||
.DebugSave(provider, null, Extensions.Bmp); |
|||
} |
|||
} |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyGlowFilterRadius<TPixel>(TestImageProvider<TPixel> provider) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Glow(image.Width / 4F) |
|||
.DebugSave(provider, null, Extensions.Bmp); |
|||
} |
|||
} |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyGlowFilterInBox<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.Glow(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); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
// <copyright file="VignetteTest.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Tests.Processing.Overlays |
|||
{ |
|||
using ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
|
|||
public class VignetteTest : FileTestBase |
|||
{ |
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyVignetteFilter<TPixel>(TestImageProvider<TPixel> provider) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Vignette() |
|||
.DebugSave(provider, null, Extensions.Bmp); |
|||
} |
|||
} |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyVignetteFilterColor<TPixel>(TestImageProvider<TPixel> provider) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Vignette(NamedColors<TPixel>.Orange) |
|||
.DebugSave(provider, null, Extensions.Bmp); |
|||
} |
|||
} |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyVignetteFilterRadius<TPixel>(TestImageProvider<TPixel> provider) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Vignette(image.Width / 4F, image.Height / 4F) |
|||
.DebugSave(provider, null, Extensions.Bmp); |
|||
} |
|||
} |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldApplyVignetteFilterInBox<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.Vignette(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); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,80 +0,0 @@ |
|||
// <copyright file="GlowTest.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 GlowTest : FileTestBase |
|||
{ |
|||
[Fact] |
|||
public void ImageShouldApplyGlowFilter() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Glow"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{file.FileName}")) |
|||
{ |
|||
image.Glow().Save(output); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Fact] |
|||
public void ImageShouldApplyGlowFilterColor() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Glow"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName("Color"); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Glow(Rgba32.HotPink).Save(output); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Fact] |
|||
public void ImageShouldApplyGlowFilterRadius() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Glow"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName("Radius"); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Glow(image.Width / 4F).Save(output); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Fact] |
|||
public void ImageShouldApplyGlowFilterInBox() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Glow"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName("InBox"); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Glow(new Rectangle(image.Width / 8, image.Height / 8, image.Width / 2, image.Height / 2)) |
|||
.Save(output); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,80 +0,0 @@ |
|||
// <copyright file="VignetteTest.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 VignetteTest : FileTestBase |
|||
{ |
|||
[Fact] |
|||
public void ImageShouldApplyVignetteFilter() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Vignette"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{file.FileName}")) |
|||
{ |
|||
image.Vignette().Save(output); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Fact] |
|||
public void ImageShouldApplyVignetteFilterColor() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Vignette"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName("Color"); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Vignette(Rgba32.HotPink).Save(output); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Fact] |
|||
public void ImageShouldApplyVignetteFilterRadius() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Vignette"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName("Radius"); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Vignette(image.Width / 4F, image.Height / 4F).Save(output); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Fact] |
|||
public void ImageShouldApplyVignetteFilterInBox() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Vignette"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName("InBox"); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Vignette(new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2)) |
|||
.Save(output); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue