#include <Rect.h>
Public Member Functions | |
Rect () | |
Rect (SDF::Obj rect) | |
Rect (double x1, double y1, double x2, double y2) | |
Rect (const Rect &rect) | |
Rect & | operator= (const Rect &rect) |
void | Attach (SDF::Obj obj) |
bool | Update (SDF::Obj obj=NULL) |
void | Get (double &out_x1, double &out_y1, double &out_x2, double &out_y2) const |
void | Set (double x1, double y1, double x2, double y2) |
double | Width () const |
double | Height () const |
bool | Contains (double x, double y) const |
bool | IntersectRect (const Rect &rect1, const Rect &rect2) |
void | Normalize () |
void | Inflate (double amount) |
void | Inflate (double x, double y) |
double | GetX1 () const |
double | GetY1 () const |
double | GetX2 () const |
double | GetY2 () const |
void | SetX1 (double x1) |
void | SetY1 (double y1) |
void | SetX2 (double x2) |
void | SetY2 (double y2) |
Rect is a utility class used to manipulate PDF rectangle objects (refer to section 3.8.3 of the PDF Reference Manual).
Rect can be associated with a SDF/Cos rectangle array using Rect(Obj*) constructor or later using Rect::Attach(Obj*) or Rect::Update(Obj*) methods.
Rect keeps a local cache for rectangle points so it is necessary to call Rect::Update() method if the changes to the Rect should be saved in the attached Cos/SDF array.
pdftron::PDF::Rect::Rect | ( | ) |
Rect default constructor.
pdftron::PDF::Rect::Rect | ( | SDF::Obj | rect | ) |
Create a Rect and initialize it using given Cos/SDF rectangle Array object. The rect is attached to this object.
pdftron::PDF::Rect::Rect | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Create a Rect and initialize it using specified parameters.
x1 | The left-most position of the rect. |
y1 | The bottom-most position of the rect. |
x2 | The right-most position of the rect. |
y2 | The top-most position of the rect. |
pdftron::PDF::Rect::Rect | ( | const Rect & | rect | ) |
void pdftron::PDF::Rect::Attach | ( | SDF::Obj | obj | ) |
Attach the Cos/SDF object to the Rect.
obj | - underlying Cos/SDF object. Must be an SDF::Array with four SDF::Number elements. |
bool pdftron::PDF::Rect::Contains | ( | double | x, |
double | y | ||
) | const |
Determines if the specified point is contained within the rectangular region defined by this Rectangle
x | horizontal x value of the point to check |
y | vertical y value of the point to check |
void pdftron::PDF::Rect::Get | ( | double & | out_x1, |
double & | out_y1, | ||
double & | out_x2, | ||
double & | out_y2 | ||
) | const |
Get the coordinates of the rectangle
double pdftron::PDF::Rect::GetX1 | ( | ) | const |
double pdftron::PDF::Rect::GetX2 | ( | ) | const |
double pdftron::PDF::Rect::GetY1 | ( | ) | const |
double pdftron::PDF::Rect::GetY2 | ( | ) | const |
double pdftron::PDF::Rect::Height | ( | ) | const |
void pdftron::PDF::Rect::Inflate | ( | double | amount | ) |
Expands the rectangle by the specified size, in all directions.
amount | Specifies the amount to increase the rectangle in all directions. |
void pdftron::PDF::Rect::Inflate | ( | double | x, |
double | y | ||
) |
Expands the rectangle by the specified size, in all directions.
x | Specifies the amount to increase the rectangle's Left (x1) and Right (x2) properties. |
y | Specifies the amount to increase the rectangle's Top (y1) and Bottom (y2) properties. |
Makes a Rect equal to the intersection of two existing rectangles.
rect1 | - A Rect object that contains a source rectangle. |
rect2 | - A Rect object that contains a source rectangle. |
void pdftron::PDF::Rect::Normalize | ( | ) |
Arrange the points in the rectangle so that the first point is the lower-left corner and the second point is the upper-right corner of the rectangle.
void pdftron::PDF::Rect::Set | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Set the coordinates of the rectangle
x1 | The left-most position of the rect. |
y1 | The bottom-most position of the rect. |
x2 | The right-most position of the rect. |
y2 | The top-most position of the rect. The rect is not attached to any Cos/SDF object. |
void pdftron::PDF::Rect::SetX1 | ( | double | x1 | ) |
Set the horizontal value of lower-left point.
x1 | The left-most position of the rect. |
void pdftron::PDF::Rect::SetX2 | ( | double | x2 | ) |
Set the horizontal value of upper-right point.
x2 | The right-most position of the rect. |
void pdftron::PDF::Rect::SetY1 | ( | double | y1 | ) |
Set the vertical value of lower-left point.
y1 | The bottom-most position of the rect. |
void pdftron::PDF::Rect::SetY2 | ( | double | y2 | ) |
Set the vertical value of upper-right point.
y2 | The top-most position of the rect. |
bool pdftron::PDF::Rect::Update | ( | SDF::Obj | obj = NULL | ) |
Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle.
obj | - an optional parameter indicating a SDF array that should be updated and attached to this Rect. If parameter rect is NULL or is omitted, update is performed on previously attached Cos/SDF rectangle. |
double pdftron::PDF::Rect::Width | ( | ) | const |