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.
42 lines
1.2 KiB
42 lines
1.2 KiB
// <copyright file="SkewTest.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageSharp.Tests
|
|
{
|
|
using System.IO;
|
|
|
|
using Xunit;
|
|
|
|
public class SkewTest : FileTestBase
|
|
{
|
|
public static readonly TheoryData<float, float> SkewValues
|
|
= new TheoryData<float, float>
|
|
{
|
|
{ 20, 10 },
|
|
{ -20, -10 }
|
|
};
|
|
|
|
[Theory]
|
|
[MemberData("SkewValues")]
|
|
public void ImageShouldApplySkewSampler(float x, float y)
|
|
{
|
|
string path = CreateOutputDirectory("Skew");
|
|
|
|
// Matches live example
|
|
// http://www.w3schools.com/css/tryit.asp?filename=trycss3_transform_skew
|
|
foreach (TestFile file in Files)
|
|
{
|
|
string filename = file.GetFileName(x + "-" + y);
|
|
Image image = file.CreateImage();
|
|
|
|
using (FileStream output = File.OpenWrite($"{path}/{filename}"))
|
|
{
|
|
image.Skew(x, y)
|
|
.Save(output);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|