#include <cel_geom.h>
Public Member Functions | |
ssize_t | right () const |
ssize_t | bottom () const |
Point | leftTop () const |
Point | leftBottom () const |
Point | rightTop () const |
Point | rightBottom () const |
Rect (ssize_t inLeft=0, ssize_t inTop=0, ssize_t inWidth=0, ssize_t inHeight=0) | |
Rect (const Rect &inRect) | |
Rect & | operator= (const Rect &inRect) |
bool | operator== (const Rect &inRect) const |
bool | operator!= (const Rect &inRect) const |
void | zeroReset () |
bool | isValid () const |
bool | isInside (const Rect &inRect) const |
Rect | unionRect (const Rect &inRect) |
bool | intersectWith (const Rect &inRect) const |
Rect | intersectionRect (const Rect &inRect) const |
void | offset (ssize_t inHorzOffset, ssize_t inVertOffset) |
void | offset (const Point &inOffset) |
void | inflate (ssize_t size) |
void | deflate (ssize_t size) |
Static Public Member Functions | |
static void | unionRects (Rect &outRect, const Rect &inRect1, const Rect &inRect2) |
static void | unionRects (Rect &outRect, const Rect *inRects, size_t inCount) |
static bool | intersection (Rect &outRect, const Rect &inRect1, const Rect &inRect2) |
Public Attributes | |
ssize_t | left |
X-coordinate of the upper-left corner. More... | |
ssize_t | top |
Y-coordinate of the upper-left corner. More... | |
ssize_t | width |
Width of the rectangle. More... | |
ssize_t | height |
Height of the rectangle. More... | |
A Rect struct stores the upper-left corner, width, and height of a rectangle.
|
inline |
This constructor initializes a Rect instance whose x-coordinate, y-coordinate, width, and height are all zero.
inLeft | X-coordinate of the upper-left corner of the rectangle. |
inTop | Y-coordinate of the upper-left corner of the rectangle. |
inWidth | Width of the rectangle. |
inHeight | Height of the rectangle. |
Referenced by intersection(), and unionRects().
|
inline |
This constructor copies the specified Rect instance.
inRect | A rectangle instance. |
|
inline |
This function returns the Y-coordinate of the bottom line.
Referenced by intersection(), isInside(), leftBottom(), rightBottom(), and unionRects().
|
inline |
This function inflates this rectangle by the specified size.
For example, if the original rectangle is Left=0, Top=0, Width=8, Height=8 and then do defration by 2, the result is Left=2, Top=2, Width=4, Height=4.
Please note that this function does not check the validity of the resulting rectangle (negative width/height).
size | Size to deflate. |
|
inline |
This function inflates this rectangle by the specified size.
For example, if the original rectangle is Left=0, Top=0, Width=8, Height=8 and then do infration by 2, the result is Left=-2, Top=-2, Width=12, Height=12.
size | Size to inflate. |
Referenced by deflate().
|
inlinestatic |
This function calculates the intersection of the two rectangles specified by inRect1 and inRect2.
outRect | The result rectangle. |
inRect1 | |
inRect2 | The rectangles to calculate the intersection. |
true
if there're a valid intersection between the rectangles, otherwise false
. Referenced by intersectionRect(), and intersectWith().
This function returns intersection of the instance and another.
rect | The rectangle to get intersection with. |
|
inline |
|
inline |
This function checks wether the specified rectangle is in the rectangle or not. In the judgement, the 4 border lines of the inner rectangle can be overwrapped onto the lines of the outer rectangle.
inRect | The rectangle to check the containment. |
true
if the rectangle is in this rectangle, otherwise false
.
|
inline |
This function checks whether this rectangle stands for some valid area or not.
true
if the rectangle is valid, otherwise false
. Referenced by intersection(), and unionRects().
|
inline |
This function returns the left-bottom position.
|
inline |
This function returns the left-top position.
|
inline |
This function moves this rectangle the specified offsets.
inHorzOffset | Horizontal offset to move the rectangle. |
inVertOffset | Vertical offset to move the rectangle. |
Referenced by offset().
|
inline |
This function moves this rectangle the specified offsets.
inOffset | Offset to move the rectangle. |
|
inline |
This function compares this instance with another.
true
if this instance is not identical to inRect, otherwise false
. This function copies the specified Rect instance.
inRect | A rectangle instance. |
|
inline |
This function compares this instance with another.
true
if this instance is identical to inRect, otherwise false
.
|
inline |
This function returns the X-coordinate of the right line.
Referenced by intersection(), isInside(), rightBottom(), rightTop(), and unionRects().
|
inline |
This function returns the right-bottom position.
|
inline |
This function returns the right-top position.
This function returns union of the instance and another.
rect | The rectangle to union with. |
|
inlinestatic |
This function calculates the smallest rectangle that can contain both of the two rectangles specified by inRect1 and inRect2.
outRect | The result rectangle. |
inRect1 | |
inRect2 | The rectangles to be contained. |
Referenced by unionRect().
|
inline |
This function initializes the Rect instance to (0,0,0,0).
ssize_t Celartem::Rect::height |
Height of the rectangle.
Referenced by bottom(), Celartem::DjVu::TextZone::create(), inflate(), intersection(), isValid(), operator!=(), operator=(), operator==(), Rect(), unionRects(), and zeroReset().
ssize_t Celartem::Rect::left |
X-coordinate of the upper-left corner.
Referenced by Celartem::DjVu::TextZone::create(), inflate(), intersection(), isInside(), leftBottom(), leftTop(), offset(), operator!=(), operator=(), operator==(), Rect(), right(), unionRects(), and zeroReset().
ssize_t Celartem::Rect::top |
Y-coordinate of the upper-left corner.
Referenced by bottom(), Celartem::DjVu::TextZone::create(), inflate(), intersection(), isInside(), leftTop(), offset(), operator!=(), operator=(), operator==(), Rect(), rightTop(), unionRects(), and zeroReset().
ssize_t Celartem::Rect::width |
Width of the rectangle.
Referenced by Celartem::DjVu::TextZone::create(), inflate(), intersection(), isValid(), operator!=(), operator=(), operator==(), Rect(), right(), unionRects(), and zeroReset().