Rapicorn - Experimental UI Toolkit - Source Code
13.07.0
|
00001 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html -*-mode:c++;-*- 00002 #ifndef __RAPICORN_REGION_HH__ 00003 #define __RAPICORN_REGION_HH__ 00004 00005 #include <ui/primitives.hh> 00006 00007 namespace Rapicorn { 00008 00018 class Region { 00019 union { 00020 struct CRegion { int64 idummy[4]; void *pdummy; }; 00021 CRegion cstruct_mem; // ensure C structure size and alignment 00022 char chars[sizeof (CRegion)]; // char may_alias any type 00023 } region_; // RAPICORN_MAY_ALIAS; ICE: GCC#30894 00024 inline void* region_mem (); 00025 inline const void* region_mem () const; 00026 public: /* rectangles are represented at 64bit integer precision */ 00027 typedef enum { OUTSIDE = 0, INSIDE = 1, PARTIAL } ContainedType; 00028 explicit Region (); 00029 /*Con*/ Region (const Region ®ion); 00030 /*Con*/ Region (const Rect &rectangle); 00031 /*Con*/ Region (const Point &pt1, 00032 const Point &pt2); 00033 Region& operator= (const Region ®ion); 00034 void clear (); 00035 bool empty () const; 00036 bool equal (const Region &other) const; 00037 int cmp (const Region &other) const; 00038 void swap (Region &other); 00039 Rect extents () const; 00040 bool contains (const Point &point) const; 00041 bool contains (double x, double y) const { return contains (Point (x, y)); } 00042 ContainedType contains (const Rect &rect) const; 00043 ContainedType contains (const Region &other) const; 00044 void list_rects (vector<Rect> &rects) const; 00045 uint count_rects () const; 00046 void add (const Rect &rect); 00047 void add (const Region &other); 00048 void subtract (const Region &subtrahend); 00049 void intersect (const Region &other); 00050 void exor (const Region &other); 00051 void translate (double dx, double dy); 00052 void affine (const Affine &affine); 00053 double epsilon () const; 00054 String string (); 00055 /*dtor*/ ~Region (); 00056 }; 00057 00058 bool operator== (const Region &r1, const Region &r2); 00059 bool operator!= (const Region &r1, const Region &r2); 00060 bool operator< (const Region &r1, const Region &r2); 00061 00062 } // Rapicorn 00063 00064 #endif /* __RAPICORN_REGION_HH__ */