diff --git a/src/ImageSharp/Processing/Transforms/TransformExtensions.cs b/src/ImageSharp/Processing/Transforms/TransformExtensions.cs
index 585288d8a8..2607c102bd 100644
--- a/src/ImageSharp/Processing/Transforms/TransformExtensions.cs
+++ b/src/ImageSharp/Processing/Transforms/TransformExtensions.cs
@@ -86,26 +86,25 @@ namespace SixLabors.ImageSharp.Processing.Transforms
/// The image to transform.
/// The transformation matrix.
/// The
- internal static IImageProcessingContext Transform(this IImageProcessingContext source, Matrix4x4 matrix)
+ public static IImageProcessingContext Transform(this IImageProcessingContext source, Matrix4x4 matrix)
where TPixel : struct, IPixel
=> Transform(source, matrix, KnownResamplers.Bicubic);
///
/// Applies a projective transform to the image by the given matrix using the specified sampling algorithm.
- /// TODO: Doesn't work yet! Implement tests + Finish implementation + Document Matrix4x4 behavior
///
/// The pixel format.
/// The image to transform.
/// The transformation matrix.
/// The to perform the resampling.
/// The
- internal static IImageProcessingContext Transform(this IImageProcessingContext source, Matrix4x4 matrix, IResampler sampler)
+ public static IImageProcessingContext Transform(this IImageProcessingContext source, Matrix4x4 matrix, IResampler sampler)
where TPixel : struct, IPixel
=> source.ApplyProcessor(new ProjectiveTransformProcessor(matrix, sampler, source.GetCurrentSize()));
///
/// Applies a projective transform to the image by the given matrix using the specified sampling algorithm.
- /// TODO: Doesn't work yet! Implement tests + Finish implementation + Document Matrix4x4 behavior
+ /// TODO: Should we be offsetting the matrix here?
///
/// The pixel format.
/// The image to transform.
diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs
index 743b04a0ef..9db6931e35 100644
--- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs
@@ -61,6 +61,27 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
}
}
+ [Theory]
+ [WithSolidFilledImages(100, 100, 0, 0, 255, PixelTypes.Rgba32)]
+ public void RawTransformMatchesDocumentedExample(TestImageProvider provider)
+ where TPixel : struct, IPixel
+ {
+ // This test matches the output described in the example at
+ // https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/transforms/non-affine
+ using (Image image = provider.GetImage())
+ {
+ Matrix4x4 m = Matrix4x4.Identity;
+ m.M13 = 0.01F;
+
+ image.Mutate(i => { i.Transform(m); });
+
+ image.DebugSave(provider);
+
+ // TODO: Enable and add more tests.
+ // image.CompareToReferenceOutput(ValidatorComparer, provider, resamplerName);
+ }
+ }
+
private static IResampler GetResampler(string name)
{
PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);