Browse Source

Fix build issues

pull/2748/head
James Jackson-South 2 years ago
parent
commit
514d0393d6
  1. 2
      src/ImageSharp/Common/Helpers/GaussianEliminationSolver.cs
  2. 4
      src/ImageSharp/Common/Helpers/QuadDistortionHelper.cs
  3. 9
      src/ImageSharp/Processing/ProjectiveTransformBuilder.cs

2
src/ImageSharp/Common/Helpers/GaussianEliminationSolver.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Common.Helpers;
/// <summary>
/// Represents a solver for systems of linear equations using the Gaussian Elimination method.
/// This class applies Gaussian Elimination to transform the matrix into row echelon form and then performs back substitution to find the solution vector.
/// This implementation is based on: https://www.algorithm-archive.org/contents/gaussian_elimination/gaussian_elimination.html
/// This implementation is based on: <see href="https://www.algorithm-archive.org/contents/gaussian_elimination/gaussian_elimination.html"/>
/// </summary>
internal static class GaussianEliminationSolver
{

4
src/ImageSharp/Common/Helpers/QuadDistortionHelper.cs

@ -21,7 +21,7 @@ internal static class QuadDistortionHelper
/// <returns>The computed projection matrix for the quad distortion.</returns>
/// <remarks>
/// This method is based on the algorithm described in the following article:
/// https://blog.mbedded.ninja/mathematics/geometry/projective-transformations/
/// <see href="https://blog.mbedded.ninja/mathematics/geometry/projective-transformations/"/>
/// </remarks>
public static Matrix4x4 ComputeQuadDistortMatrix(Rectangle rectangle, PointF topLeft, PointF topRight, PointF bottomRight, PointF bottomLeft)
{
@ -65,7 +65,7 @@ internal static class QuadDistortionHelper
Matrix4x4 projectionMatrix = new(
b[0], b[3], 0, b[6],
b[1], b[4], 0, b[7],
0, 0, 1, 0,
0, 0, 1, 0,
b[2], b[5], 0, 1);
#pragma warning restore SA1117

9
src/ImageSharp/Processing/ProjectiveTransformBuilder.cs

@ -289,9 +289,7 @@ public class ProjectiveTransformBuilder
/// <param name="bottomLeft">The bottom-left corner point of the distorted quad.</param>
/// <returns>The <see cref="ProjectiveTransformBuilder"/>.</returns>
public ProjectiveTransformBuilder PrependQuadDistortion(PointF topLeft, PointF topRight, PointF bottomRight, PointF bottomLeft)
=> this.Prepend(
size => QuadDistortionHelper.ComputeQuadDistortMatrix(new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft),
size => QuadDistortionHelper.ComputeQuadDistortMatrix(new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft));
=> this.Prepend(size => QuadDistortionHelper.ComputeQuadDistortMatrix(new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft));
/// <summary>
/// Appends a quad distortion matrix using the specified corner points.
@ -302,10 +300,7 @@ public class ProjectiveTransformBuilder
/// <param name="bottomLeft">The bottom-left corner point of the distorted quad.</param>
/// <returns>The <see cref="ProjectiveTransformBuilder"/>.</returns>
public ProjectiveTransformBuilder AppendQuadDistortion(PointF topLeft, PointF topRight, PointF bottomRight, PointF bottomLeft)
=> this.Append(
size => QuadDistortionHelper.ComputeQuadDistortMatrix(new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft),
size => QuadDistortionHelper.ComputeQuadDistortMatrix(new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft)
);
=> this.Append(size => QuadDistortionHelper.ComputeQuadDistortMatrix(new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft));
/// <summary>
/// Prepends a raw matrix.

Loading…
Cancel
Save