Browse Source

Rename helper

af/merge-core
James Jackson-South 8 years ago
parent
commit
b98c337448
  1. 16
      src/ImageSharp/Processing/Transforms/ProjectiveTransformHelper.cs
  2. 10
      tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs

16
src/ImageSharp/Processing/Transforms/TaperTransform.cs → src/ImageSharp/Processing/Transforms/ProjectiveTransformHelper.cs

@ -54,20 +54,20 @@ namespace SixLabors.ImageSharp.Processing.Transforms
}
/// <summary>
/// Provides methods for the creation of generalized tapering projective transforms.
/// <see href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/transforms/non-affine"/>
/// Provides helper methods for working with generalized projective transforms.
/// </summary>
public static class TaperTransform
public static class ProjectiveTransformHelper
{
/// <summary>
/// Creates a matrix that performs a tapering projective transform.
/// <see href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/transforms/non-affine"/>
/// </summary>
/// <param name="size">The resultant size of the tapered output</param>
/// <param name="taperSide">The taper side option</param>
/// <param name="taperCorner">The taper corner option</param>
/// <param name="taperFraction">The amount to taper</param>
/// <param name="size">The rectangular size of the image being transformed.</param>
/// <param name="taperSide">An enumeration that indicates the side of the rectangle that tapers.</param>
/// <param name="taperCorner">An enumeration that indicates on which corners to taper the rectangle.</param>
/// <param name="taperFraction">The amount to taper.</param>
/// <returns>The <see cref="Matrix4x4"/></returns>
public static Matrix4x4 Create(Size size, TaperSide taperSide, TaperCorner taperCorner, float taperFraction)
public static Matrix4x4 CreateTaperMatrix(Size size, TaperSide taperSide, TaperCorner taperCorner, float taperFraction)
{
Matrix4x4 matrix = Matrix4x4.Identity;

10
tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs

@ -10,14 +10,11 @@ using SixLabors.ImageSharp.Processing.Transforms;
using SixLabors.ImageSharp.Processing.Transforms.Resamplers;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using Xunit;
using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{
public class ProjectiveTransformTests
{
// private readonly ITestOutputHelper Output;
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.005f, 3);
public static readonly TheoryData<string> ResamplerNames = new TheoryData<string>
@ -47,12 +44,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
IResampler sampler = GetResampler(resamplerName);
using (Image<TPixel> image = provider.GetImage())
{
Matrix4x4 m = TaperTransform.Create(image.Size(), TaperSide.Right, TaperCorner.Both, .5F);
Matrix4x4 m = ProjectiveTransformHelper.CreateTaperMatrix(image.Size(), TaperSide.Right, TaperCorner.Both, .5F);
image.Mutate(i =>
{
i.Transform(m, sampler);
});
image.Mutate(i => { i.Transform(m, sampler); });
image.DebugSave(provider, resamplerName);

Loading…
Cancel
Save