#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 |
| bool | intersectWith (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. | |
| ssize_t | top |
| Y-coordinate of the upper-left corner. | |
| ssize_t | width |
| Width of the rectangle. | |
| ssize_t | height |
| Height of the rectangle. | |
Definition at line 101 of file cel_geom.h.
| Celartem::Rect::Rect | ( | ssize_t | inLeft = 0, |
|
| ssize_t | inTop = 0, |
|||
| ssize_t | inWidth = 0, |
|||
| ssize_t | inHeight = 0 | |||
| ) | [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. |
Definition at line 162 of file cel_geom.h.
| Celartem::Rect::Rect | ( | const Rect & | inRect | ) | [inline] |
This constructor copies the specified Rect instance.
| inRect | A rectangle instance. |
Definition at line 174 of file cel_geom.h.
| ssize_t Celartem::Rect::right | ( | ) | const [inline] |
This function returns the X-coordinate of the right line.
Definition at line 113 of file cel_geom.h.
Referenced by intersection(), isInside(), rightBottom(), rightTop(), and unionRects().
| ssize_t Celartem::Rect::bottom | ( | ) | const [inline] |
This function returns the Y-coordinate of the bottom line.
Definition at line 120 of file cel_geom.h.
Referenced by intersection(), isInside(), leftBottom(), rightBottom(), and unionRects().
| Point Celartem::Rect::leftTop | ( | ) | const [inline] |
This function returns the left-top position.
Definition at line 127 of file cel_geom.h.
| Point Celartem::Rect::leftBottom | ( | ) | const [inline] |
This function returns the left-bottom position.
Definition at line 134 of file cel_geom.h.
| Point Celartem::Rect::rightTop | ( | ) | const [inline] |
This function returns the right-top position.
Definition at line 141 of file cel_geom.h.
| Point Celartem::Rect::rightBottom | ( | ) | const [inline] |
This function returns the right-bottom position.
Definition at line 148 of file cel_geom.h.
This function copies the specified Rect instance.
| inRect | A rectangle instance. |
Definition at line 189 of file cel_geom.h.
| bool Celartem::Rect::operator== | ( | const Rect & | inRect | ) | const [inline] |
This function compares this instance with another.
true if this instance is identical to inRect, otherwise false. Definition at line 204 of file cel_geom.h.
| bool Celartem::Rect::operator!= | ( | const Rect & | inRect | ) | const [inline] |
This function compares this instance with another.
true if this instance is not identical to inRect, otherwise false. Definition at line 217 of file cel_geom.h.
| void Celartem::Rect::zeroReset | ( | ) | [inline] |
This function initializes the Rect instance to (0,0,0,0).
Definition at line 226 of file cel_geom.h.
| bool Celartem::Rect::isValid | ( | ) | const [inline] |
This function checks whether this rectangle stands for some valid area or not.
true if the rectangle is valid, otherwise false. Definition at line 238 of file cel_geom.h.
Referenced by intersection().
| bool Celartem::Rect::isInside | ( | const Rect & | inRect | ) | const [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. Definition at line 254 of file cel_geom.h.
| static void Celartem::Rect::unionRects | ( | Rect & | outRect, | |
| const Rect & | inRect1, | |||
| const Rect & | inRect2 | |||
| ) | [inline, static] |
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. |
Definition at line 272 of file cel_geom.h.
| static void Celartem::Rect::unionRects | ( | Rect & | outRect, | |
| const Rect * | inRects, | |||
| size_t | inCount | |||
| ) | [inline, static] |
This function calculates the smallest rectangle that can contain all the rectangles specified.
| outRect | The result rectangle. | |
| inRects | An array of Rect instances. | |
| inCount | The count of Rect instances in the array. |
Definition at line 295 of file cel_geom.h.
| static bool Celartem::Rect::intersection | ( | Rect & | outRect, | |
| const Rect & | inRect1, | |||
| const Rect & | inRect2 | |||
| ) | [inline, static] |
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. Definition at line 328 of file cel_geom.h.
Referenced by intersectWith().
| bool Celartem::Rect::intersectWith | ( | const Rect & | inRect | ) | const [inline] |
This function determines whether this Rect intersects with the specified Rect instance or not.
| inRect | The rectangle to calculate the intersection. |
true if there're a valid intersection between the rectangles, otherwise false. Definition at line 355 of file cel_geom.h.
| void Celartem::Rect::offset | ( | ssize_t | inHorzOffset, | |
| ssize_t | inVertOffset | |||
| ) | [inline] |
This function moves this rectangle the specified offsets.
| inHorzOffset | Horizontal offset to move the rectangle. | |
| inVertOffset | Vertical offset to move the rectangle. |
Definition at line 369 of file cel_geom.h.
Referenced by offset().
| void Celartem::Rect::offset | ( | const Point & | inOffset | ) | [inline] |
This function moves this rectangle the specified offsets.
| inOffset | Offset to move the rectangle. |
Definition at line 381 of file cel_geom.h.
| void Celartem::Rect::inflate | ( | ssize_t | size | ) | [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. |
Definition at line 394 of file cel_geom.h.
Referenced by deflate().
| void Celartem::Rect::deflate | ( | ssize_t | size | ) | [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. |
Definition at line 412 of file cel_geom.h.
| ssize_t Celartem::Rect::left |
X-coordinate of the upper-left corner.
Definition at line 103 of file cel_geom.h.
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.
Definition at line 104 of file cel_geom.h.
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.
Definition at line 105 of file cel_geom.h.
Referenced by Celartem::DjVu::TextZone::create(), inflate(), intersection(), isValid(), operator!=(), operator=(), operator==(), Rect(), right(), unionRects(), and zeroReset().
| ssize_t Celartem::Rect::height |
Height of the rectangle.
Definition at line 106 of file cel_geom.h.
Referenced by bottom(), Celartem::DjVu::TextZone::create(), inflate(), intersection(), isValid(), operator!=(), operator=(), operator==(), Rect(), unionRects(), and zeroReset().