@@ -17,24 +17,9 @@ public class AffineTransformBuilder
1717 /// Initializes a new instance of the <see cref="AffineTransformBuilder"/> class.
1818 /// </summary>
1919 public AffineTransformBuilder ( )
20- : this ( TransformSpace . Pixel )
2120 {
2221 }
2322
24- /// <summary>
25- /// Initializes a new instance of the <see cref="AffineTransformBuilder"/> class.
26- /// </summary>
27- /// <param name="transformSpace">
28- /// The <see cref="TransformSpace"/> to use when applying the affine transform.
29- /// </param>
30- public AffineTransformBuilder ( TransformSpace transformSpace )
31- => this . TransformSpace = transformSpace ;
32-
33- /// <summary>
34- /// Gets the <see cref="TransformSpace"/> to use when applying the affine transform.
35- /// </summary>
36- public TransformSpace TransformSpace { get ; }
37-
3823 /// <summary>
3924 /// Prepends a rotation matrix using the given rotation angle in degrees
4025 /// and the image center point as rotation center.
@@ -52,7 +37,7 @@ public AffineTransformBuilder PrependRotationDegrees(float degrees)
5237 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
5338 public AffineTransformBuilder PrependRotationRadians ( float radians )
5439 => this . Prepend (
55- size => TransformUtils . CreateRotationTransformMatrixRadians ( radians , size , this . TransformSpace ) ) ;
40+ size => TransformUtilities . CreateRotationTransformMatrixRadians ( radians , size ) ) ;
5641
5742 /// <summary>
5843 /// Prepends a rotation matrix using the given rotation in degrees at the given origin.
@@ -88,7 +73,7 @@ public AffineTransformBuilder AppendRotationDegrees(float degrees)
8873 /// <param name="radians">The amount of rotation, in radians.</param>
8974 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
9075 public AffineTransformBuilder AppendRotationRadians ( float radians )
91- => this . Append ( size => TransformUtils . CreateRotationTransformMatrixRadians ( radians , size , this . TransformSpace ) ) ;
76+ => this . Append ( size => TransformUtilities . CreateRotationTransformMatrixRadians ( radians , size ) ) ;
9277
9378 /// <summary>
9479 /// Appends a rotation matrix using the given rotation in degrees at the given origin.
@@ -172,7 +157,7 @@ public AffineTransformBuilder PrependSkewDegrees(float degreesX, float degreesY)
172157 /// <param name="radiansY">The Y angle, in radians.</param>
173158 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
174159 public AffineTransformBuilder PrependSkewRadians ( float radiansX , float radiansY )
175- => this . Prepend ( size => TransformUtils . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size , this . TransformSpace ) ) ;
160+ => this . Prepend ( size => TransformUtilities . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size ) ) ;
176161
177162 /// <summary>
178163 /// Prepends a skew matrix using the given angles in degrees at the given origin.
@@ -210,7 +195,7 @@ public AffineTransformBuilder AppendSkewDegrees(float degreesX, float degreesY)
210195 /// <param name="radiansY">The Y angle, in radians.</param>
211196 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
212197 public AffineTransformBuilder AppendSkewRadians ( float radiansX , float radiansY )
213- => this . Append ( size => TransformUtils . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size , this . TransformSpace ) ) ;
198+ => this . Append ( size => TransformUtilities . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size ) ) ;
214199
215200 /// <summary>
216201 /// Appends a skew matrix using the given angles in degrees at the given origin.
@@ -344,15 +329,29 @@ public Matrix3x2 BuildMatrix(Rectangle sourceRectangle)
344329 /// for linear transforms.
345330 /// </exception>
346331 /// <returns>The <see cref="Size"/>.</returns>
347- public Size GetTransformedSize ( Rectangle sourceRectangle )
332+ public SizeF GetTransformedSize ( Rectangle sourceRectangle )
348333 {
349334 Matrix3x2 matrix = this . BuildMatrix ( sourceRectangle ) ;
350- return TransformUtils . GetTransformedSize ( matrix , sourceRectangle . Size , this . TransformSpace ) ;
335+ return GetTransformedSize ( sourceRectangle , matrix ) ;
351336 }
352337
338+ /// <summary>
339+ /// Returns the size of a rectangle large enough to contain the transformed source rectangle.
340+ /// </summary>
341+ /// <param name="sourceRectangle">The rectangle in the source image.</param>
342+ /// <param name="matrix">The transformation matrix.</param>
343+ /// <exception cref="DegenerateTransformException">
344+ /// The resultant matrix is degenerate containing one or more values equivalent
345+ /// to <see cref="float.NaN"/> or a zero determinant and therefore cannot be used
346+ /// for linear transforms.
347+ /// </exception>
348+ /// <returns>The <see cref="Size"/>.</returns>
349+ internal static SizeF GetTransformedSize ( Rectangle sourceRectangle , Matrix3x2 matrix )
350+ => TransformUtilities . GetRawTransformedSize ( matrix , sourceRectangle . Size ) ;
351+
353352 private static void CheckDegenerate ( Matrix3x2 matrix )
354353 {
355- if ( TransformUtils . IsDegenerate ( matrix ) )
354+ if ( TransformUtilities . IsDegenerate ( matrix ) )
356355 {
357356 throw new DegenerateTransformException ( "Matrix is degenerate. Check input values." ) ;
358357 }
0 commit comments