Public Member Functions | |
int | x () const |
int | y () const |
int | w () const |
int | h () const |
int | r () const |
int | b () const |
void | x (int v) |
void | y (int v) |
void | w (int v) |
void | h (int v) |
void | set_x (int v) |
void | set_y (int v) |
void | set_r (int v) |
void | set_b (int v) |
void | set (int x, int y, int w, int h) |
void | set (const Rectangle &r, int w, int h, int flags=0) |
void | move_x (int d) |
void | move_y (int d) |
void | move_r (int d) |
void | move_b (int d) |
void | inset (int d) |
void | move (int dx, int dy) |
bool | empty () const |
bool | not_empty () const |
int | center_x () const |
int | center_y () const |
int | baseline_y () const |
Rectangle () | |
Rectangle (int x, int y, int w, int h) | |
Rectangle (int w, int h) | |
Rectangle (const Rectangle &r) | |
Rectangle (const Rectangle &r, int w, int h, int flags=0) | |
bool | contains (int x, int y) const |
void | merge (const Rectangle &r) |
void | intersect (const Rectangle &r) |
Negative w() or h() is supposed to mean an empty and thus invisible rectangle, but some code will treat the rectangle as reflected about x or y. Set the size to zero to make sure you have an empty one.
|
The default constructor does not put anything into the fields! You can either call set() or just modify the x_, y_, w_, and h_ variables directly. |
|
|
Constructor that sets x() and y() to zero, and sets w() and h(). |
|
Copy constructor. |
|
Constructor that calls set(). |
|
Return y()+h(), the bottom edge of the rectangle. |
|
Where to put baseline to center current font nicely |
|
Integer center position. Rounded to the left if w() is odd. |
|
Integer center position. Rounded to lower y if h() is odd. |
|
True if rectangle contains the pixel who's upper-left corner is at x,y |
|
|
|
Distance between top and bottom edges |
|
Move all edges in by d. See also Symbol::inset() |
|
Replace the value with the intersection of this rectangle and R. If the rectangles do not intersect, the result may have negative width and/or height, this means empty() will return true, but some code may still draw this rectangle. |
|
Replace the value with the union of this rectangle and R (ie the rectangle that surrounds both of these rectangles). If one rectangle is empty(), the other is returned unchanged (ie it does not union in the degenerate point of that rectangle). |
|
Move entire rectangle by given distance in x and y. |
|
|
|
|
|
Same as !empty(), true if w() and h() are both greater than zero. |
|
Return x()+w(), the right edge of the rectangle. |
|
Sets x, y, w, h so that's it's centered or aligned (if flags!=0) inside the source r |
|
|
|
|
|
|
|
Distance between left and right edges |
|
Move the rectangle so the left edge is at v. |
|
Left edge |
|
Move the rectangle so the top edge is at v. |
|
Top edge |