mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-04-05 20:55:01 +08:00
Make QuadPointsQuadrilateral a readonly struct
This commit is contained in:
parent
8babdfdda5
commit
435da86a25
@ -115,13 +115,13 @@
|
||||
|
||||
if (values.Count == 8)
|
||||
{
|
||||
quadPointRectangles.Add(new QuadPointsQuadrilateral(new[]
|
||||
{
|
||||
quadPointRectangles.Add(new QuadPointsQuadrilateral(
|
||||
[
|
||||
matrix.Transform(new PdfPoint(values[0], values[1])),
|
||||
matrix.Transform(new PdfPoint(values[2], values[3])),
|
||||
matrix.Transform(new PdfPoint(values[4], values[5])),
|
||||
matrix.Transform(new PdfPoint(values[6], values[7]))
|
||||
}));
|
||||
]));
|
||||
|
||||
values.Clear();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
/// A QuadPoints quadrilateral is four points defining the region for an annotation to use.
|
||||
/// An annotation may cover multiple quadrilaterals.
|
||||
/// </summary>
|
||||
public class QuadPointsQuadrilateral
|
||||
public readonly struct QuadPointsQuadrilateral
|
||||
{
|
||||
/// <summary>
|
||||
/// The 4 points defining this quadrilateral.
|
||||
@ -21,16 +21,16 @@
|
||||
/// <summary>
|
||||
/// Create a new <see cref="QuadPointsQuadrilateral"/>.
|
||||
/// </summary>
|
||||
public QuadPointsQuadrilateral(IReadOnlyList<PdfPoint> points)
|
||||
public QuadPointsQuadrilateral(PdfPoint[] points)
|
||||
{
|
||||
if (points is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(points));
|
||||
}
|
||||
|
||||
if (points.Count != 4)
|
||||
if (points.Length != 4)
|
||||
{
|
||||
throw new ArgumentException($"Quadpoints quadrilateral should only contain 4 points, instead got {points.Count} points.");
|
||||
throw new ArgumentException($"Quadpoints quadrilateral should only contain 4 points, instead got {points.Length} points.");
|
||||
}
|
||||
|
||||
Points = points;
|
||||
|
Loading…
Reference in New Issue
Block a user