5 void Rect::setX(int x) {
11 void Rect::setY(int y)
18 void Rect::setPos(int x, int y) {
26 void Rect::setWidth(unsigned int w) {
31 void Rect::setHeight(unsigned int h) {
36 void Rect::setSize(unsigned int w, unsigned int h) {
42 void Rect::setRect(int x, int y, unsigned int w, unsigned int h) {
43 *this = Rect(x, y, w, h);
47 void Rect::setCoords(int l, int t, int r, int b) {
55 Rect Rect::operator|(const Rect &a) const {
58 b._x1 = std::min(_x1, a._x1);
59 b._y1 = std::min(_y1, a._y1);
60 b._x2 = std::max(_x2, a._x2);
61 b._y2 = std::max(_y2, a._y2);
67 Rect Rect::operator&(const Rect &a) const {
70 b._x1 = std::max(_x1, a._x1);
71 b._y1 = std::max(_y1, a._y1);
72 b._x2 = std::min(_x2, a._x2);
73 b._y2 = std::min(_y2, a._y2);
79 bool Rect::intersects(const Rect &a) const {
80 return std::max(_x1, a._x1) <= std::min(_x2, a._x2) &&
81 std::max(_y1, a._y1) <= std::min(_y2, a._y2);
85 bool Rect::contains(int x, int y) const {
86 return x >= _x1 && x <= _x2 &&
91 bool Rect::contains(const Rect& a) const {
92 return a._x1 >= _x1 && a._x2 <= _x2 &&
93 a._y1 >= _y1 && a._y2 <= _y2;