Opait PDF Library
|
Class represents a rectangular region in PDF world coordinates. The rectangle is kept normalized. More...
Public Member Functions | |
PdfRectangle () | |
Initializes a new instance of the PdfRectangle class. | |
PdfRectangle (double left, double top, double right, double bottom) | |
Initializes a new instance of the PdfRectangle class with specified coordinates. More... | |
PdfRectangle (XElement xml, int scale) | |
Initializes a new instance of the PdfRectangle class from a serialized XML element. More... | |
PdfRectangle (PdfRectangle other) | |
Initializes a new instance as a copy of the specified PdfRectangle. More... | |
PdfRectangle (IReadOnlyList< PdfRectangle > bounds) | |
Initializes a new instance of the PdfRectangle as the union of the specified list of rectangles. More... | |
void | CopyFrom (PdfRectangle rect) |
Copy coordinates, BUT NOT THE ANGLE, from another instance of PdfRectangle. More... | |
double[] | ToArray () |
Converts coordinates to an array of double precision numbers. More... | |
bool | Contains (PdfPoint point) |
Determines if the rectangle contains the specified point. More... | |
bool | Contains (PdfRectangle rc) |
Determines if the current rectangle contains the specified rectangle. More... | |
bool | ContainsOrIntersects (PdfRectangle rc) |
Determines if the current rectangle contains or intersects the specified rectangle. More... | |
void | Inflate (PdfSize size) |
Inflates the rectangle by specified size in each direction. More... | |
void | Deflate (PdfSize size) |
Deflates the rectangle by specified size in each direction. More... | |
bool | VerticalOverlaps (PdfRectangle rc) |
Checks whether this rectangle has a vertical overlap with another rectangle. More... | |
double | VerticalOverlap (PdfRectangle rc) |
Computes relative vertical overlap with another rectangle. More... | |
bool | HorizontalOverlaps (PdfRectangle rc) |
Checks whether this rectangle has a horizontal overlap with another rectangle. More... | |
double | HorizontalOverlap (PdfRectangle rc) |
Computes relative horizontal overlap with another rectangle. More... | |
void | Union (PdfRectangle rc) |
Merges the specified rectangle into the current one. More... | |
bool | Intersects (PdfRectangle rc) |
Checks whether this rectangle intersects with the specified rectangle. More... | |
void | Intersect (PdfRectangle rc) |
Make this object the intersection of itself with a specified rectangle. More... | |
void | SetEmpty () |
Set this object to an empty rectangle with zero sides. | |
void | Normalize () |
Normalizes the rectangle so that Right >= Left and Top >= Bottom. | |
PdfRectangle | Rotate (int angle, double pageWidth, double pageHeight) |
Rotate rectangle counterclockwise about the origin of the page where it is defined in 90 degree intervals. More... | |
override string | ToString () |
Converts this object to a human-readable string. More... | |
bool | Equals (PdfRectangle other) |
Compares this instance to the specified instance. More... | |
bool | Equals (PdfRectangle other, double tolerance) |
Compares this instance to the specified other instance for approximate equality within the given tolerance. More... | |
override bool | Equals (object obj) |
Compares this instance to the specified object. More... | |
override int | GetHashCode () |
Gets a custom hash code for this instance. More... | |
void | FromXml (XElement xml, int scale) |
Initializes a new instance from a serialized XML element. More... | |
XElement | ToXml (string root, int scale) |
Serializes the current instance as an XML element. More... | |
Static Public Member Functions | |
static int | CenterComparer (PdfRectangle a, PdfRectangle b, double tolerance=0.1) |
Compares centers of rectangles for top-down, left-right sorting. More... | |
Static Public Attributes | |
static readonly PdfRectangle | Empty = new PdfRectangle() |
Represents a PdfRect that has coordinates set to zero. | |
Properties | |
double | X [get] |
The X coordinate or the rectangle (bottom-left corner). | |
double | Y [get] |
The Y coordinate or the rectangle (bottom-left corner). | |
double | Width [get, set] |
Gets the width of the rectangle. | |
double | Height [get, set] |
Gets the height of the rectangle. | |
PdfPoint | TopLeft [get] |
Gets the top-left point of the rectangle. | |
PdfPoint | TopRight [get] |
Gets the top-right point of the rectangle. | |
PdfPoint | BottomLeft [get] |
Gets the bottom-left point of the rectangle. | |
PdfPoint | BottomRight [get] |
Gets the bottom-right point of the rectangle. | |
PdfPoint | Center [get] |
Gets the center point of the rectangle. | |
bool | IsEmpty [get] |
Gets a flag to indicate an empty rectangle within a tolerance. | |
bool | IsNormalized [get] |
Gets a flag to indicate whether the rectangle is normalized. | |
int | Angle [get, set] |
Gets or sets the rotation angle, counterclockwise, in degrees. Supported values are 0, 90 and 270. Used in text processing. | |
bool | IsVertical [get] |
Gets a flag to indicate whether the character is vertically rotated. | |
Class represents a rectangular region in PDF world coordinates. The rectangle is kept normalized.
Opait.Pdf.Api.PdfRectangle.PdfRectangle | ( | double | left, |
double | top, | ||
double | right, | ||
double | bottom | ||
) |
Initializes a new instance of the PdfRectangle class with specified coordinates.
left | The left coordinate of the rectangle. |
top | The top coordinate of the rectangle. |
right | The left coordinate of the rectangle. |
bottom | The bottom coordinate of the rectangle. |
Opait.Pdf.Api.PdfRectangle.PdfRectangle | ( | XElement | xml, |
int | scale | ||
) |
Initializes a new instance of the PdfRectangle class from a serialized XML element.
xml | The serialized XML element. |
scale | A scale factor for saving as integers. |
Opait.Pdf.Api.PdfRectangle.PdfRectangle | ( | PdfRectangle | other | ) |
Initializes a new instance as a copy of the specified PdfRectangle.
other | The source rectangle. |
Opait.Pdf.Api.PdfRectangle.PdfRectangle | ( | IReadOnlyList< PdfRectangle > | bounds | ) |
Initializes a new instance of the PdfRectangle as the union of the specified list of rectangles.
bounds | The list of existing rectangles. |
|
static |
Compares centers of rectangles for top-down, left-right sorting.
a | First rectangle to compare. |
b | Second rectangle to compare. |
tolerance | Comparison tolerance. |
bool Opait.Pdf.Api.PdfRectangle.Contains | ( | PdfPoint | point | ) |
Determines if the rectangle contains the specified point.
point | The point to check. |
bool Opait.Pdf.Api.PdfRectangle.Contains | ( | PdfRectangle | rc | ) |
Determines if the current rectangle contains the specified rectangle.
rc | The rectangle to check. |
bool Opait.Pdf.Api.PdfRectangle.ContainsOrIntersects | ( | PdfRectangle | rc | ) |
Determines if the current rectangle contains or intersects the specified rectangle.
rc | The rectangle to check. |
void Opait.Pdf.Api.PdfRectangle.CopyFrom | ( | PdfRectangle | rect | ) |
Copy coordinates, BUT NOT THE ANGLE, from another instance of PdfRectangle.
rect | The rectangle to copy from. |
void Opait.Pdf.Api.PdfRectangle.Deflate | ( | PdfSize | size | ) |
Deflates the rectangle by specified size in each direction.
size | The size of the deflate. |
override bool Opait.Pdf.Api.PdfRectangle.Equals | ( | object | obj | ) |
Compares this instance to the specified object.
obj | The object to compare with. |
bool Opait.Pdf.Api.PdfRectangle.Equals | ( | PdfRectangle | other | ) |
Compares this instance to the specified instance.
other | The specified instance to compare with. |
bool Opait.Pdf.Api.PdfRectangle.Equals | ( | PdfRectangle | other, |
double | tolerance | ||
) |
Compares this instance to the specified other instance for approximate equality within the given tolerance.
other | The specified instance to compare with. |
tolerance | The comparison tolerance value. |
void Opait.Pdf.Api.PdfRectangle.FromXml | ( | XElement | xml, |
int | scale | ||
) |
Initializes a new instance from a serialized XML element.
xml | The serialized XML element. |
scale | A scale factor used in saving as integers. |
override int Opait.Pdf.Api.PdfRectangle.GetHashCode | ( | ) |
Gets a custom hash code for this instance.
double Opait.Pdf.Api.PdfRectangle.HorizontalOverlap | ( | PdfRectangle | rc | ) |
Computes relative horizontal overlap with another rectangle.
rc | The rectangle to compare with. |
bool Opait.Pdf.Api.PdfRectangle.HorizontalOverlaps | ( | PdfRectangle | rc | ) |
Checks whether this rectangle has a horizontal overlap with another rectangle.
rc | The rectangle to check. |
void Opait.Pdf.Api.PdfRectangle.Inflate | ( | PdfSize | size | ) |
Inflates the rectangle by specified size in each direction.
size | The size of the inflate. |
void Opait.Pdf.Api.PdfRectangle.Intersect | ( | PdfRectangle | rc | ) |
Make this object the intersection of itself with a specified rectangle.
rc | The rectangle to intersect with. |
bool Opait.Pdf.Api.PdfRectangle.Intersects | ( | PdfRectangle | rc | ) |
Checks whether this rectangle intersects with the specified rectangle.
rc | The rectangle to check. |
PdfRectangle Opait.Pdf.Api.PdfRectangle.Rotate | ( | int | angle, |
double | pageWidth, | ||
double | pageHeight | ||
) |
Rotate rectangle counterclockwise about the origin of the page where it is defined in 90 degree intervals.
angle | Counterclockwise rotation angle in degrees. |
pageWidth | The width of the page where the rectangle is defined. |
pageHeight | The height of the page where the rectangle is defined. |
double[] Opait.Pdf.Api.PdfRectangle.ToArray | ( | ) |
Converts coordinates to an array of double precision numbers.
override string Opait.Pdf.Api.PdfRectangle.ToString | ( | ) |
Converts this object to a human-readable string.
XElement Opait.Pdf.Api.PdfRectangle.ToXml | ( | string | root, |
int | scale | ||
) |
Serializes the current instance as an XML element.
root | The optional name of the root element. |
scale | A scale factor used in saving as integers. |
void Opait.Pdf.Api.PdfRectangle.Union | ( | PdfRectangle | rc | ) |
Merges the specified rectangle into the current one.
rc | The rectangle to merge. |
double Opait.Pdf.Api.PdfRectangle.VerticalOverlap | ( | PdfRectangle | rc | ) |
Computes relative vertical overlap with another rectangle.
rc | The rectangle to compare with. |
bool Opait.Pdf.Api.PdfRectangle.VerticalOverlaps | ( | PdfRectangle | rc | ) |
Checks whether this rectangle has a vertical overlap with another rectangle.
rc | The rectangle to check. |