30 #include "../core/size.h"
42 static Rectangle FromLTRB(
int left,
int top,
int right,
int bottom);
49 this->height = height;
53 this->x = location.
X();
54 this->y = location.
Y();
55 this->width = size.
Width();
56 this->height = size.
Height();
68 void SetX(
const int &value){x=value;}
69 void SetY(
const int &value){y=value;}
78 bool IsEmpty(){
return (height==0 && width==0 && x==0 && y==0);}
81 return (cSource.x == x && cSource.y == y && cSource.width == width && cSource.height == height);
88 return this->x<=x && x<this->x+this->width && this->y<=y && y<this->y+this->height;
92 return Contains(pt.
X(),pt.
Y());
96 return (this->x <= rect.x) &&
97 ((rect.x + rect.width) <= (this->x + this->width)) &&
98 (this->y <= rect.y) &&
99 ((rect.y + rect.height) <= (this->y + this->height));
103 void Inflate(
const int &width,
const int &height)
107 this->width += 2*width;
108 this->height += 2*height;
119 Rectangle result = Rectangle::Intersect(rect, *
this);
121 this->x = result.
X();
122 this->y = result.
Y();
123 this->width = result.
Width();
124 this->height = result.
Height();
129 return (rect.x < this->x + this->width) &&
130 (this->x < (rect.x + rect.width)) &&
131 (rect.y < this->y + this->height) &&
132 (this->y < rect.y + rect.height);
137 Offset(pos.
X(), pos.
Y());
147 return "{X=" + QString::number(x) +
",Y=" + QString::number(y) +
148 ",Width=" + QString::number(width) +
149 ",Height=" +QString::number(height) +
"}";
158 #endif // RECTANGLE_H
Definition: rectangle.h:35