29 #include "../core/size.h"
41 static Rectangle FromLTRB(qint32 left, qint32 top, qint32 right, qint32 bottom);
48 this->height = height;
52 this->
x = location.
X();
53 this->
y = location.
Y();
54 this->width = size.
Width();
55 this->height = size.
Height();
67 void SetX(
const qint32 &value){
x=value;}
68 void SetY(
const qint32 &value){
y=value;}
70 void SetWidth(
const qint32 &value){width=value;}
77 bool IsEmpty(){
return (height==0 && width==0 &&
x==0 &&
y==0);}
80 return (cSource.x ==
x && cSource.y ==
y && cSource.width == width && cSource.height == height);
87 return this->x<=x && x<this->x+this->width && this->y<=y && y<this->y+this->height;
91 return Contains(pt.
X(),pt.
Y());
95 return (this->
x <= rect.x) &&
96 ((rect.x + rect.width) <= (this->
x + this->width)) &&
97 (this->
y <= rect.y) &&
98 ((rect.y + rect.height) <= (this->
y + this->height));
102 void Inflate(
const qint32 &width,
const qint32 &height)
106 this->width += 2*width;
107 this->height += 2*height;
118 Rectangle result = Rectangle::Intersect(rect, *
this);
120 this->
x = result.
X();
121 this->
y = result.
Y();
122 this->width = result.
Width();
123 this->height = result.
Height();
128 return (rect.x < this->x + this->width) &&
129 (this->
x < (rect.x + rect.width)) &&
130 (rect.y < this->
y + this->height) &&
131 (this->
y < rect.y + rect.height);
136 Offset(pos.
X(), pos.
Y());
146 return "{X=" + QString::number(
x) +
",Y=" + QString::number(
y) +
147 ",Width=" + QString::number(width) +
148 ",Height=" +QString::number(height) +
"}";
157 #endif // RECTANGLE_H