// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Tests { using ImageSharp.PixelFormats; using Xunit; public class OilPaintTest : FileTestBase { public static readonly TheoryData OilPaintValues = new TheoryData { { 15, 10 }, { 6, 5 } }; [Theory] [WithFileCollection(nameof(DefaultFiles), nameof(OilPaintValues), StandardPixelType)] public void ImageShouldApplyOilPaintFilter(TestImageProvider provider, int levels, int brushSize) where TPixel : struct, IPixel { using (Image image = provider.GetImage()) { image.OilPaint(levels, brushSize) .DebugSave(provider, string.Join("-", levels, brushSize), Extensions.Bmp); } } [Theory] [WithFileCollection(nameof(DefaultFiles), nameof(OilPaintValues), StandardPixelType)] public void ImageShouldApplyOilPaintFilterInBox(TestImageProvider provider, int levels, int brushSize) 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.OilPaint(levels, brushSize, bounds) .DebugSave(provider, string.Join("-", levels, brushSize), Extensions.Bmp); // Draw identical shapes over the bounded and compare to ensure changes are constrained. image.Fill(NamedColors.HotPink, bounds); source.Fill(NamedColors.HotPink, bounds); // TODO: Why does the png box fail without the additional parameter. ImageComparer.CheckSimilarity(source, image, 0.001F); } } } }