PoDoFo 1.2.0
Loading...
Searching...
No Matches
PoDoFo::Rect Class Referencefinal

An normalized rectangle defined by position (left-bottom) and size. More...

#include <Rect.h>

Public Member Functions

 Rect ()
 Create an empty rectangle with bottom=left=with=height=0.
 Rect (double x, double y, double width, double height)
 Create a rectangle with a given position and size.
 Rect (const Rect &rhs)=default
 Copy constructor.
void ToArray (PdfArray &arr) const
 Converts the rectangle into an array.
PdfArray ToArray () const
std::string ToString () const
 Returns a string representation of the Rect.
bool Contains (double x, double y) const
void Intersect (const Rect &rect)
 Intersect with another rect.
bool IsValid () const
Corners ToCorners () const
Vector2 GetLeftBottom () const
 Get the oriented left-bottom point.
Vector2 GetRightTop () const
 Get the oriented left-bottom point.
double GetLeft () const
 Get the left coordinate of the rectangle.
double GetBottom () const
 Get the bottom coordinate of the rectangle.
double GetRight () const
 Get the right coordinate of the rectangle.
double GetTop () const
 Get the top coordinate of the rectangle.
bool operator== (const Rect &rect) const
bool operator!= (const Rect &rect) const
Rect operator* (const Matrix &m) const
Rect & operator= (const Rect &rhs)=default
 operator Corners () const

Static Public Member Functions

static Rect FromCorners (double x1, double y1, double x2, double y2)
 Create a Rect from a couple of arbitrary points.
static Rect FromCorners (const Vector2 &corner1, const Vector2 &corner2)
static Rect FromCorners (const Corners &corners)
static Rect FromArray (const PdfArray &arr)
 Create a Rect from a the 4 values in the array.

Public Attributes

double X
double Y
double Width
double Height

Detailed Description

An normalized rectangle defined by position (left-bottom) and size.

Member Function Documentation

◆ FromArray()

Rect Rect::FromArray ( const PdfArray & arr)
static

Create a Rect from a the 4 values in the array.

Parameters
arrthe array to load the values from

◆ FromCorners()

Rect Rect::FromCorners ( double x1,
double y1,
double x2,
double y2 )
static

Create a Rect from a couple of arbitrary points.

Returns
the created Rect

◆ Intersect()

void Rect::Intersect ( const Rect & rect)

Intersect with another rect.

Parameters
rectthe rect to intersect with

◆ ToArray()

void Rect::ToArray ( PdfArray & arr) const

Converts the rectangle into an array.

Parameters
arrthe array to store the Rect

◆ ToString()

string Rect::ToString ( ) const

Returns a string representation of the Rect.

Returns
std::string representation as [ left bottom right top ]

The documentation for this class was generated from the following files:
  • src/podofo/auxiliary/Rect.h
  • src/podofo/auxiliary/Rect.cpp