pdfmm 0.9.20
Public Member Functions | Static Public Member Functions | List of all members
mm::PdfRect Class Referencefinal

#include <PdfRect.h>

Public Member Functions

 PdfRect ()
 
 PdfRect (double left, double bottom, double width, double height)
 
 PdfRect (const PdfArray &inArray)
 
 PdfRect (const PdfRect &rhs)
 
void ToArray (PdfArray &arr) const
 
std::string ToString () const
 
void FromArray (const PdfArray &arr)
 
void Intersect (const PdfRect &rect)
 
double GetRight () const
 
double GetTop () const
 
double GetBottom () const
 
void SetBottom (double bottom)
 
double GetLeft () const
 
void SetLeft (double left)
 
double GetWidth () const
 
void SetWidth (double width)
 
double GetHeight () const
 
void SetHeight (double height)
 

Static Public Member Functions

static PdfRect FromCorners (double x1, double y1, double x2, double y2)
 

Detailed Description

A rectangle as defined by the PDF reference

Constructor & Destructor Documentation

◆ PdfRect() [1/4]

PdfRect::PdfRect ( )

Create an empty rectangle with bottom=left=with=height=0

◆ PdfRect() [2/4]

PdfRect::PdfRect ( double  left,
double  bottom,
double  width,
double  height 
)

Create a rectangle with a given size and position All values are in PDF units NOTE: since PDF is bottom-left origined, we pass the bottom instead of the top

◆ PdfRect() [3/4]

PdfRect::PdfRect ( const PdfArray inArray)

Create a rectangle from an array All values are in PDF units

◆ PdfRect() [4/4]

PdfRect::PdfRect ( const PdfRect rhs)

Copy constructor

Member Function Documentation

◆ FromArray()

void PdfRect::FromArray ( const PdfArray arr)

Assigns the values of this PdfRect from the 4 values in the array

Parameters
inArraythe array to load the values from

◆ FromCorners()

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

Create a PdfRect from a couple of arbitrary points

Returns
the created PdfRect

◆ GetBottom()

double mm::PdfRect::GetBottom ( ) const
inline

Get the bottom coordinate of the rectangle

Returns
bottom

◆ GetHeight()

double mm::PdfRect::GetHeight ( ) const
inline

Get the height of the rectangle

Returns
height in PDF units

◆ GetLeft()

double mm::PdfRect::GetLeft ( ) const
inline

Get the left coordinate of the rectangle

Returns
left in PDF units

◆ GetRight()

double PdfRect::GetRight ( ) const

Get the right coordinate of the rectangle

Returns
bottom

◆ GetTop()

double PdfRect::GetTop ( ) const

Get the top coordinate of the rectangle

Returns
bottom

◆ GetWidth()

double mm::PdfRect::GetWidth ( ) const
inline

Get the width of the rectangle

Returns
width in PDF units

◆ Intersect()

void PdfRect::Intersect ( const PdfRect rect)

Intersect with another rect

Parameters
rectthe rect to intersect with

◆ SetBottom()

void mm::PdfRect::SetBottom ( double  bottom)
inline

Set the bottom coordinate of the rectangle

Parameters
bottom

◆ SetHeight()

void mm::PdfRect::SetHeight ( double  height)
inline

Set the height of the rectangle

Parameters
lHeightin PDF units

◆ SetLeft()

void mm::PdfRect::SetLeft ( double  left)
inline

Set the left coordinate of the rectangle

Parameters
leftin PDF units

◆ SetWidth()

void mm::PdfRect::SetWidth ( double  width)
inline

Set the width of the rectangle

Parameters
lWidthin PDF units

◆ ToArray()

void PdfRect::ToArray ( PdfArray arr) const

Converts the rectangle into an array based on PDF units

Parameters
varthe array to store the Rect

◆ ToString()

string PdfRect::ToString ( ) const

Returns a string representation of the PdfRect

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