|
|
|
@ -17,14 +17,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms |
|
|
|
public static readonly TheoryData<float, float, float, float, float> TransformValues |
|
|
|
= new TheoryData<float, float, float, float, float> |
|
|
|
{ |
|
|
|
{ 45, 1, 1, 20, 10 }, |
|
|
|
{ 45, 1, 1, -20, -10 }, |
|
|
|
{ 45, 1.5f, 1.5f, 0, 0 }, |
|
|
|
{ 50, 1, 1, 20, 10 }, |
|
|
|
{ 50, 1, 1, -20, -10 }, |
|
|
|
{ 50, 1.5f, 1.5f, 0, 0 }, |
|
|
|
{ 0, 2f, 1f, 0, 0 }, |
|
|
|
{ 0, 1f, 2f, 0, 0 }, |
|
|
|
}; |
|
|
|
|
|
|
|
public static readonly TheoryData<string> ResamplerNames = |
|
|
|
public static readonly TheoryData<string> ResamplerNames = |
|
|
|
new TheoryData<string> |
|
|
|
{ |
|
|
|
nameof(KnownResamplers.Bicubic), |
|
|
|
@ -64,7 +64,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms |
|
|
|
using (Image<TPixel> image = provider.GetImage()) |
|
|
|
{ |
|
|
|
// TODO: Modify this matrix if we change our origin-concept
|
|
|
|
var rotate = Matrix3x2.CreateRotation((float)Math.PI/4f); |
|
|
|
var rotate = Matrix3x2.CreateRotation((float)Math.PI / 4f); |
|
|
|
|
|
|
|
image.Mutate(c => c.Transform(rotate, resampler)); |
|
|
|
image.DebugSave(provider, resamplerName); |
|
|
|
@ -88,9 +88,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms |
|
|
|
var translate = Matrix3x2.CreateTranslation(tx, ty); |
|
|
|
var scale = Matrix3x2.CreateScale(sx, sy); |
|
|
|
Matrix3x2 m = rotate * scale * translate; |
|
|
|
|
|
|
|
|
|
|
|
this.Output.WriteLine(m.ToString()); |
|
|
|
|
|
|
|
|
|
|
|
image.Mutate(i => i.Transform(m)); |
|
|
|
image.DebugSave(provider, $"R({angleDeg})_S({sx},{sy})_T({tx},{ty})"); |
|
|
|
} |
|
|
|
@ -104,10 +104,12 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms |
|
|
|
IResampler sampler = GetResampler(resamplerName); |
|
|
|
using (Image<TPixel> image = provider.GetImage()) |
|
|
|
{ |
|
|
|
Matrix3x2 rotate = Matrix3x2Extensions.CreateRotationDegrees(45); |
|
|
|
Matrix3x2 rotate = Matrix3x2Extensions.CreateRotationDegrees(50); |
|
|
|
Matrix3x2 scale = Matrix3x2Extensions.CreateScale(new SizeF(.5F, .5F)); |
|
|
|
var translate = Matrix3x2.CreateTranslation(75, 0); |
|
|
|
|
|
|
|
|
|
|
|
image.Mutate(i => i.Transform(rotate * scale, sampler)); |
|
|
|
image.Mutate(i => i.Transform(rotate * scale * translate, sampler)); |
|
|
|
image.DebugSave(provider, resamplerName); |
|
|
|
} |
|
|
|
} |
|
|
|
|