From 22d212de09cb653281fb0a3c82346311289ede44 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 21 Jan 2018 03:55:11 +0100 Subject: [PATCH] renamed NonAffineTransformProcessor to ProjectiveTransformProcessor --- ...cs => CenteredProjectiveTransformProcessor.cs} | 6 +++--- ...ocessor.cs => ProjectiveTransformProcessor.cs} | 15 ++++++++------- src/ImageSharp/Processing/Transforms/Transform.cs | 8 +++++--- 3 files changed, 16 insertions(+), 13 deletions(-) rename src/ImageSharp/Processing/Processors/Transforms/{CenteredNonAffineTransformProcessor.cs => CenteredProjectiveTransformProcessor.cs} (87%) rename src/ImageSharp/Processing/Processors/Transforms/{NonAffineTransformProcessor.cs => ProjectiveTransformProcessor.cs} (93%) diff --git a/src/ImageSharp/Processing/Processors/Transforms/CenteredNonAffineTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/CenteredProjectiveTransformProcessor.cs similarity index 87% rename from src/ImageSharp/Processing/Processors/Transforms/CenteredNonAffineTransformProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/CenteredProjectiveTransformProcessor.cs index bb1505c80..dc2dd28ab 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/CenteredNonAffineTransformProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CenteredProjectiveTransformProcessor.cs @@ -11,15 +11,15 @@ namespace SixLabors.ImageSharp.Processing.Processors /// A base class that provides methods to allow the automatic centering of non-affine transforms /// /// The pixel format. - internal abstract class CenteredNonAffineTransformProcessor : NonAffineTransformProcessor + internal abstract class CenteredProjectiveTransformProcessor : ProjectiveTransformProcessor where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The transform matrix /// The sampler to perform the transform operation. - protected CenteredNonAffineTransformProcessor(Matrix4x4 matrix, IResampler sampler) + protected CenteredProjectiveTransformProcessor(Matrix4x4 matrix, IResampler sampler) : base(matrix, sampler) { } diff --git a/src/ImageSharp/Processing/Processors/Transforms/NonAffineTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Processors/Transforms/NonAffineTransformProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs index caaf812b0..579a0ac9a 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/NonAffineTransformProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs @@ -16,39 +16,40 @@ namespace SixLabors.ImageSharp.Processing.Processors { /// /// Provides the base methods to perform non-affine transforms on an image. + /// TODO: Doesn't work yet! Implement tests + Finish implementation + Document Matrix4x4 behavior /// /// The pixel format. - internal class NonAffineTransformProcessor : InterpolatedTransformProcessorBase + internal class ProjectiveTransformProcessor : InterpolatedTransformProcessorBase where TPixel : struct, IPixel { private Rectangle targetRectangle; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The transform matrix - public NonAffineTransformProcessor(Matrix4x4 matrix) + public ProjectiveTransformProcessor(Matrix4x4 matrix) : this(matrix, KnownResamplers.Bicubic) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The transform matrix /// The sampler to perform the transform operation. - public NonAffineTransformProcessor(Matrix4x4 matrix, IResampler sampler) + public ProjectiveTransformProcessor(Matrix4x4 matrix, IResampler sampler) : this(matrix, sampler, Rectangle.Empty) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The transform matrix /// The sampler to perform the transform operation. /// The rectangle to constrain the transformed image to. - public NonAffineTransformProcessor(Matrix4x4 matrix, IResampler sampler, Rectangle rectangle) + public ProjectiveTransformProcessor(Matrix4x4 matrix, IResampler sampler, Rectangle rectangle) : base(sampler) { // Tansforms are inverted else the output is the opposite of the expected. diff --git a/src/ImageSharp/Processing/Transforms/Transform.cs b/src/ImageSharp/Processing/Transforms/Transform.cs index 496e57def..21cd7863a 100644 --- a/src/ImageSharp/Processing/Transforms/Transform.cs +++ b/src/ImageSharp/Processing/Transforms/Transform.cs @@ -89,7 +89,8 @@ namespace SixLabors.ImageSharp => Transform(source, matrix, KnownResamplers.NearestNeighbor); /// - /// Transforms an image by the given matrix using the specified sampling algorithm. + /// 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. @@ -101,7 +102,8 @@ namespace SixLabors.ImageSharp => Transform(source, matrix, sampler, Rectangle.Empty); /// - /// Transforms an image by the given matrix using the specified sampling algorithm. + /// 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. @@ -111,6 +113,6 @@ namespace SixLabors.ImageSharp /// The internal static IImageProcessingContext Transform(this IImageProcessingContext source, Matrix4x4 matrix, IResampler sampler, Rectangle rectangle) where TPixel : struct, IPixel - => source.ApplyProcessor(new NonAffineTransformProcessor(matrix, sampler, rectangle)); + => source.ApplyProcessor(new ProjectiveTransformProcessor(matrix, sampler, rectangle)); } } \ No newline at end of file