]> Shamusworld >> Repos - architektonas/blob - src/rect.h
Preliminary support for Polylines.
[architektonas] / src / rect.h
1 #ifndef __RECT_H__
2 #define __RECT_H__
3
4 //
5 // We're doing this because the Qt implementation is non-Cartesian compliant.
6 // Also, it auto-normalizes rects constructed using the constructors. :-)
7 //
8
9 #include "vector.h"
10
11 struct Rect
12 {
13         double l, r, t, b;
14
15         Rect();
16         Rect(double tt, double ll, double bb, double rr);
17         Rect(Point tl, Point br);
18         Rect(Point);
19         Rect & operator*=(double scale);
20         Rect & operator|=(Rect x);
21         Rect & operator+=(Point p);
22         double & operator[](int);
23         void Normalize(void);
24         void Translate(Point p);
25         void Expand(double amt);
26         double Width(void);
27         double Height(void);
28         bool Contains(Point p);
29         bool Contains(Rect r);
30         Point TopLeft(void);
31         Point TopRight(void);
32         Point BottomLeft(void);
33         Point BottomRight(void);
34 };
35
36 #endif  // __RECT_H__