PDFsharp-net6

PdfRectangle

Namespace: PdfSharp.Pdf

Represents a PDF rectangle value, that is internally an array with 4 real values.

public sealed class PdfRectangle : PdfItem, System.ICloneable

Inheritance ObjectPdfItemPdfRectangle
Implements ICloneable

Fields

Empty

Represents an empty PdfRectangle.

public static PdfRectangle Empty;

Properties

IsEmpty

Tests whether all coordinates are zero.

public bool IsEmpty { get; }

Property Value

Boolean

X1

Gets or sets the x-coordinate of the first corner of this PdfRectangle.

public double X1 { get; }

Property Value

Double

Y1

Gets or sets the y-coordinate of the first corner of this PdfRectangle.

public double Y1 { get; }

Property Value

Double

X2

Gets or sets the x-coordinate of the second corner of this PdfRectangle.

public double X2 { get; }

Property Value

Double

Y2

Gets or sets the y-coordinate of the second corner of this PdfRectangle.

public double Y2 { get; }

Property Value

Double

Width

Gets X2 - X1.

public double Width { get; }

Property Value

Double

Height

Gets Y2 - Y1.

public double Height { get; }

Property Value

Double

Location

Gets or sets the coordinates of the first point of this PdfRectangle.

public XPoint Location { get; }

Property Value

XPoint

Size

Gets or sets the size of this PdfRectangle.

public XSize Size { get; }

Property Value

XSize

Constructors

PdfRectangle()

Initializes a new instance of the PdfRectangle class.

public PdfRectangle()

PdfRectangle(XPoint, XPoint)

Initializes a new instance of the PdfRectangle class with two points specifying two diagonally opposite corners.

public PdfRectangle(XPoint pt1, XPoint pt2)

Parameters

pt1 XPoint

pt2 XPoint

PdfRectangle(XPoint, XSize)

Initializes a new instance of the PdfRectangle class with the specified location and size.

public PdfRectangle(XPoint pt, XSize size)

Parameters

pt XPoint

size XSize

PdfRectangle(XRect)

Initializes a new instance of the PdfRectangle class with the specified XRect.

public PdfRectangle(XRect rect)

Parameters

rect XRect

Methods

Clone()

Clones this instance.

public PdfRectangle Clone()

Returns

PdfRectangle

Copy()

Implements cloning this instance.

protected object Copy()

Returns

Object

Equals(Object)

Tests whether the specified object is a PdfRectangle and has equal coordinates.

public bool Equals(object obj)

Parameters

obj Object

Returns

Boolean

GetHashCode()

Serves as a hash function for a particular type.

public int GetHashCode()

Returns

Int32

Contains(XPoint)

Determines if the specified point is contained within this PdfRectangle.

public bool Contains(XPoint pt)

Parameters

pt XPoint

Returns

Boolean

Contains(Double, Double)

Determines if the specified point is contained within this PdfRectangle.

public bool Contains(double x, double y)

Parameters

x Double

y Double

Returns

Boolean

Contains(XRect)

Determines if the rectangular region represented by rect is entirely contained within this PdfRectangle.

public bool Contains(XRect rect)

Parameters

rect XRect

Returns

Boolean

Contains(PdfRectangle)

Determines if the rectangular region represented by rect is entirely contained within this PdfRectangle.

public bool Contains(PdfRectangle rect)

Parameters

rect PdfRectangle

Returns

Boolean

ToXRect()

Returns the rectangle as an XRect object.

public XRect ToXRect()

Returns

XRect

ToString()

Returns the rectangle as a string in the form «[x1 y1 x2 y2]».

public string ToString()

Returns

String

WriteObject(PdfWriter)

Writes the rectangle.

internal void WriteObject(PdfWriter writer)

Parameters

writer PdfWriter