// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Tests.Processing.Overlays { using ImageSharp.PixelFormats; using Xunit; public class VignetteTest : FileTestBase { [Theory] [WithFileCollection(nameof(DefaultFiles), DefaultPixelType)] public void ImageShouldApplyVignetteFilter(TestImageProvider provider) where TPixel : struct, IPixel { using (Image image = provider.GetImage()) { image.Vignette() .DebugSave(provider, null, Extensions.Bmp); } } [Theory] [WithFileCollection(nameof(DefaultFiles), DefaultPixelType)] public void ImageShouldApplyVignetteFilterColor(TestImageProvider provider) where TPixel : struct, IPixel { using (Image image = provider.GetImage()) { image.Vignette(NamedColors.Orange) .DebugSave(provider, null, Extensions.Bmp); } } [Theory] [WithFileCollection(nameof(DefaultFiles), DefaultPixelType)] public void ImageShouldApplyVignetteFilterRadius(TestImageProvider provider) where TPixel : struct, IPixel { using (Image image = provider.GetImage()) { image.Vignette(image.Width / 4F, image.Height / 4F) .DebugSave(provider, null, Extensions.Bmp); } } [Theory] [WithFileCollection(nameof(DefaultFiles), DefaultPixelType)] public void ImageShouldApplyVignetteFilterInBox(TestImageProvider provider) 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.Vignette(bounds) .DebugSave(provider, null, Extensions.Bmp); ImageComparer.EnsureProcessorChangesAreConstrained(source, image, bounds); } } } }