namespace UglyToad.PdfPig.Annotations { using System; using System.Collections.Generic; using Core; /// /// A QuadPoints quadrilateral is four points defining the region for an annotation to use. /// An annotation may cover multiple quadrilaterals. /// public readonly struct QuadPointsQuadrilateral { /// /// The 4 points defining this quadrilateral. /// The PDF specification defines these as being in anti-clockwise order starting from the lower-left corner, however /// Adobe's implementation doesn't obey the specification and points seem to go in the order: top-left, top-right, /// bottom-left, bottom-right. See: https://stackoverflow.com/questions/9855814/pdf-spec-vs-acrobat-creation-quadpoints. /// public IReadOnlyList Points { get; } /// /// Create a new . /// public QuadPointsQuadrilateral(PdfPoint[] points) { if (points is null) { throw new ArgumentNullException(nameof(points)); } if (points.Length != 4) { throw new ArgumentException($"Quadpoints quadrilateral should only contain 4 points, instead got {points.Length} points."); } Points = points; } /// public override string ToString() { return $"[ {Points[0]}, {Points[1]}, {Points[2]}, {Points[3]} ]"; } } }