]>
Dogcows Code - chaz/openbox/blob - otk/rect.cc
12 void Rect::setY(int y
)
19 void Rect::setPos(const Point
&location
)
21 _x2
+= location
.x() - _x1
;
23 _y2
+= location
.y() - _y1
;
28 void Rect::setPos(int x
, int y
)
37 void Rect::setWidth(int w
)
43 void Rect::setHeight(int h
)
49 void Rect::setSize(int w
, int h
)
56 void Rect::setSize(const Point
&size
)
58 _x2
= size
.x() + _x1
- 1;
59 _y2
= size
.y() + _y1
- 1;
63 void Rect::setRect(int x
, int y
, int w
, int h
)
65 *this = Rect(x
, y
, w
, h
);
69 void Rect::setRect(const Point
&location
, const Point
&size
)
71 *this = Rect(location
, size
);
75 void Rect::setCoords(int l
, int t
, int r
, int b
)
84 void Rect::setCoords(const Point
&tl
, const Point
&br
)
93 Rect
Rect::operator|(const Rect
&a
) const
97 b
._x1
= std::min(_x1
, a
._x1
);
98 b
._y1
= std::min(_y1
, a
._y1
);
99 b
._x2
= std::max(_x2
, a
._x2
);
100 b
._y2
= std::max(_y2
, a
._y2
);
106 Rect
Rect::operator&(const Rect
&a
) const
110 b
._x1
= std::max(_x1
, a
._x1
);
111 b
._y1
= std::max(_y1
, a
._y1
);
112 b
._x2
= std::min(_x2
, a
._x2
);
113 b
._y2
= std::min(_y2
, a
._y2
);
119 bool Rect::intersects(const Rect
&a
) const
121 return std::max(_x1
, a
._x1
) <= std::min(_x2
, a
._x2
) &&
122 std::max(_y1
, a
._y1
) <= std::min(_y2
, a
._y2
);
126 bool Rect::contains(int x
, int y
) const
128 return x
>= _x1
&& x
<= _x2
&&
129 y
>= _y1
&& y
<= _y2
;
133 bool Rect::contains(const Rect
& a
) const
135 return a
._x1
>= _x1
&& a
._x2
<= _x2
&&
136 a
._y1
>= _y1
&& a
._y2
<= _y2
;
This page took 0.037024 seconds and 4 git commands to generate.