HDK
|
Base Integer Rectangle class. More...
#include <IMG_AddMetaData.h>
Public Member Functions | |
UT_Rect () | |
void | clear () |
Clear rect to empty. More... | |
bool | isEmpty () const |
Return true if rectangle is empty. More... | |
bool | isValid () const |
Return true if rectangle is valid (true if empty) More... | |
void | standardize () |
bool | isInside (int px, int py) const |
Returns true if the given point is within the rectangle. More... | |
bool | contains (const T &r) const |
Returns true if T is entirely contained by this rectangle. More... | |
void | getRelative (int &px, int &py) const |
Get relative coordinates from absolute. More... | |
void | getAbsolute (int &px, int &py) const |
Get absolute coordinates from relative. More... | |
bool | intersect (const T &r) |
Intersect this rectangle with the given one. Returns if result is valid. More... | |
void | enlarge (const T &r) |
Enlarge this rectangle to include the given rectangle (ie. a union) More... | |
void | translate (int x, int y) |
Translate by given offset. More... | |
void | inset (int dx, int dy) |
Inset the rect by a dx and dy margins. More... | |
void | inset (int dx1, int dy1, int dx2, int dy2) |
Replace by the inclusive rect (x1()+dx1, y1()+dy1, x2()-dx2, y2()-dy2) More... | |
void | scale (fpreal factor) |
Scale by given factor. More... | |
void | clamp (int &px, int &py) const |
Clamp the coordinates to be inclusive of this rect (ie. make it inside) More... | |
SYS_FORCE_INLINE SYS_HashType | hash () const |
int64 | getMemoryUsage (bool inclusive) const |
void | dump (UT_WorkBuffer &wbuf, const char *msg="") const |
void | dump (const char *msg="") const |
UT_Rect (int v1, int v2, int v3, int v4) | |
Construct with native rect type values. More... | |
UT_Rect (int v[4]) | |
Construct with native rect type values. More... | |
UT_Rect (const UT_DimRect &r) | |
Conversion constructor. More... | |
UT_Rect (const UT_InclusiveRect &r) | |
Conversion constructor. More... | |
UT_Rect (const UT_ExclusiveRect &r) | |
Conversion constructor. More... | |
UT_Rect & | operator= (const UT_DimRect &r) |
Assignment operator. Can convert from any rect type. More... | |
UT_Rect & | operator= (const UT_InclusiveRect &r) |
Assignment operator. Can convert from any rect type. More... | |
UT_Rect & | operator= (const UT_ExclusiveRect &r) |
Assignment operator. Can convert from any rect type. More... | |
void | set (int v1, int v2, int v3, int v4) |
Set the native rect type values. More... | |
void | set (int v[4]) |
Set the native rect type values. More... | |
bool | isInsideX (int px) const |
Returns true if the rectangle contains the given coord. More... | |
bool | isInsideY (int py) const |
Returns true if the rectangle contains the given coord. More... | |
void | flipX (int awidth) |
Flip rectangle within the given width/height. More... | |
void | flipY (int aheight) |
Flip rectangle within the given width/height. More... | |
bool | overlapX (const T &r) const |
Returns true if the given side would overlap the other rectangle if projected onto it. More... | |
bool | overlapY (const T &r) const |
Returns true if the given side would overlap the other rectangle if projected onto it. More... | |
void | enlarge (int x, int y) |
Enlarge this rectangle to include the given point. More... | |
void | enlarge (float x, float y) |
Enlarge this rectangle to include the given point. More... | |
int | x () const |
Get lower-left corner. More... | |
int | y () const |
Get lower-left corner. More... | |
int | x1 () const |
Get lower-left corner. More... | |
int | y1 () const |
Get lower-left corner. More... | |
void | setX (int x_) |
Set the lower-left corner position, always maintaining the size. More... | |
void | setY (int y_) |
Set the lower-left corner position, always maintaining the size. More... | |
void | setX1 (int x_) |
Set lower-left corner, without changing the upper-right corner. More... | |
void | setY1 (int y_) |
Set lower-left corner, without changing the upper-right corner. More... | |
int | w () const |
Get width/height dimensions. More... | |
int | h () const |
Get width/height dimensions. More... | |
int | width () const |
Get width/height dimensions. More... | |
int | height () const |
Get width/height dimensions. More... | |
void | setWidth (int awidth) |
Set the width/height, always maintaining the lower-left position. More... | |
void | setHeight (int aheight) |
Set the width/height, always maintaining the lower-left position. More... | |
int | x2 () const |
Get upper-right corner (inclusive) More... | |
int | y2 () const |
Get upper-right corner (inclusive) More... | |
void | setX2 (int x_) |
Set upper-right corner (inclusive), without changing lower-left. More... | |
void | setY2 (int y_) |
Set upper-right corner (inclusive), without changing lower-left. More... | |
int | x2e () const |
Get upper-right corner (exclusive) More... | |
int | y2e () const |
Get upper-right corner (exclusive) More... | |
void | setX2e (int x_) |
Set upper-right corner (exclusive), without changing lower-left. More... | |
void | setY2e (int y_) |
Set upper-right corner (exclusive), without changing lower-left. More... | |
int | centerX () const |
Get center. More... | |
int | centerY () const |
Get center. More... | |
void | getDim (int &x_, int &y_, int &w_, int &h_) const |
Get rectangle values. More... | |
void | getIncl (int &x1_, int &y1_, int &x2_, int &y2_) const |
Get rectangle values. More... | |
void | getExcl (int &x1_, int &y1_, int &x2_, int &y2_) const |
Get rectangle values. More... | |
void | setDim (int x_, int y_, int w_, int h_) |
Set rectangle values. More... | |
void | setDim (int v[4]) |
Set rectangle values. More... | |
void | setIncl (int x1_, int y1_, int x2_, int y2_) |
Set rectangle values. More... | |
void | setIncl (int v[4]) |
Set rectangle values. More... | |
void | setExcl (int x1_, int y1_, int x2_, int y2_) |
Set rectangle values. More... | |
void | setExcl (int v[4]) |
Set rectangle values. More... | |
int & | operator() (int i) |
Native data access. More... | |
int | operator() (int i) const |
Native data access. More... | |
const int * | data () const |
Native data access. More... | |
int * | data () |
Native data access. More... | |
Static Public Member Functions | |
static UT_Rect | zero () |
Convenience method for creating an empty rect. More... | |
Base Integer Rectangle class.
UT_Rect is an integer rectangle class. You do NOT instantiate this but instead choose from one of the 3 different types of underlying rectangle implementations, each with the same interface:
The "lower-left"/"upper-right" terms here assume (0,0) is in the lower-left corner of your coordinate system. If your (0,0) is in the top-left corner instead, substitute these terms with "top-left"/"bottom-right".
To convert internal data representations from one type to another, use the copy constructor and assignment operators. Otherwise, use the methods found in UT_Rect.
Definition at line 23 of file IMG_AddMetaData.h.
Construct with native rect type values.
The actual construction signatures are:
Construct with native rect type values.
The actual construction signatures are:
|
inline |
|
inline |
|
inline |
Returns true if T is entirely contained by this rectangle.
void UT_Rect< T >::dump | ( | UT_WorkBuffer & | wbuf, |
const char * | msg = "" |
||
) | const |
Enlarge this rectangle to include the given rectangle (ie. a union)
Enlarge this rectangle to include the given point.
Enlarge this rectangle to include the given point.
|
inline |
Inset the rect by a dx and dy margins.
Intersect this rectangle with the given one. Returns if result is valid.
|
inline |
|
inline |
|
inline |
Returns true if the given side would overlap the other rectangle if projected onto it.
Returns true if the given side would overlap the other rectangle if projected onto it.
Set the native rect type values.
Interpretation will differ depending on type T. The actual signatures are:
Set the native rect type values.
Interpretation will differ depending on type T. The actual signatures are:
Convenience method for creating an empty rect.