mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.8 KiB
53 lines
1.8 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
|
|
|
|
using SixLabors.Primitives;
|
|
using Xunit;
|
|
|
|
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
|
|
{
|
|
using SixLabors.ImageSharp.Processing;
|
|
using SixLabors.ImageSharp.Processing.Convolution;
|
|
|
|
public class GaussianSharpenTest : FileTestBase
|
|
{
|
|
public static readonly TheoryData<int> GaussianSharpenValues
|
|
= new TheoryData<int>
|
|
{
|
|
3,
|
|
5
|
|
};
|
|
|
|
[Theory]
|
|
[WithFileCollection(nameof(DefaultFiles), nameof(GaussianSharpenValues), DefaultPixelType)]
|
|
public void ImageShouldApplyGaussianSharpenFilter<TPixel>(TestImageProvider<TPixel> provider, int value)
|
|
where TPixel : struct, IPixel<TPixel>
|
|
{
|
|
using (Image<TPixel> image = provider.GetImage())
|
|
{
|
|
image.Mutate(x => x.GaussianSharpen(value));
|
|
image.DebugSave(provider, value);
|
|
}
|
|
}
|
|
|
|
[Theory]
|
|
[WithFileCollection(nameof(DefaultFiles), nameof(GaussianSharpenValues), DefaultPixelType)]
|
|
public void ImageShouldApplyGaussianSharpenFilterInBox<TPixel>(TestImageProvider<TPixel> provider, int value)
|
|
where TPixel : struct, IPixel<TPixel>
|
|
{
|
|
using (Image<TPixel> source = provider.GetImage())
|
|
using (var image = source.Clone())
|
|
{
|
|
var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
|
|
|
|
image.Mutate(x => x.GaussianSharpen(value, bounds));
|
|
image.DebugSave(provider, value);
|
|
|
|
ImageComparer.Tolerant().VerifySimilarityIgnoreRegion(source, image, bounds);
|
|
}
|
|
}
|
|
}
|
|
}
|