//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Tests.Processing.Convolution
{
using ImageSharp.PixelFormats;
using SixLabors.Primitives;
using Xunit;
public class BoxBlurTest : FileTestBase
{
public static readonly TheoryData BoxBlurValues
= new TheoryData
{
3,
5
};
[Theory]
[WithFileCollection(nameof(DefaultFiles), nameof(BoxBlurValues), DefaultPixelType)]
public void ImageShouldApplyBoxBlurFilter(TestImageProvider provider, int value)
where TPixel : struct, IPixel
{
using (Image image = provider.GetImage())
{
image.BoxBlur(value)
.DebugSave(provider, value, Extensions.Bmp);
}
}
[Theory]
[WithFileCollection(nameof(DefaultFiles), nameof(BoxBlurValues), DefaultPixelType)]
public void ImageShouldApplyBoxBlurFilterInBox(TestImageProvider provider, int value)
where TPixel : struct, IPixel
{
using (Image source = provider.GetImage())
using (var image = new Image(source))
{
var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
image.BoxBlur(value, bounds)
.DebugSave(provider, value, Extensions.Bmp);
ImageComparer.EnsureProcessorChangesAreConstrained(source, image, bounds);
}
}
}
}