// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms { using SixLabors.ImageSharp.Processing; public class SkewTest : FileTestBase { public static readonly TheoryData SkewValues = new TheoryData { { 20, 10 }, { -20, -10 } }; [Theory] [WithFileCollection(nameof(DefaultFiles), nameof(SkewValues), DefaultPixelType)] public void ImageShouldSkew(TestImageProvider provider, float x, float y) where TPixel : struct, IPixel { using (Image image = provider.GetImage()) { image.Mutate(i => i.Skew(x, y)); image.DebugSave(provider, string.Join("_", x, y)); } } [Theory] [WithFileCollection(nameof(DefaultFiles), nameof(SkewValues), DefaultPixelType)] public void ImageShouldSkewWithSampler(TestImageProvider provider, float x, float y) where TPixel : struct, IPixel { using (Image image = provider.GetImage()) { image.Mutate(i => i.Skew(x, y, KnownResamplers.Triangle)); image.DebugSave(provider, string.Join("_", x, y, "triangle")); } } } }