00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _COMPREGION_H
00027 #define _COMPREGION_H
00028
00029 #include <X11/Xutil.h>
00030 #include <X11/Xregion.h>
00031
00032 #include <core/rect.h>
00033 #include <core/point.h>
00034
00035 class PrivateRegion;
00036
00042 class CompRegion {
00043 public:
00044 typedef std::vector<CompRegion> List;
00045 typedef std::vector<CompRegion *> PtrList;
00046 typedef std::vector<CompRegion> Vector;
00047 typedef std::vector<CompRegion *> PtrVector;
00048
00049 public:
00050 CompRegion ();
00051 CompRegion (const CompRegion &);
00052 CompRegion (int x, int y, int w, int h);
00053 CompRegion (const CompRect &);
00054 CompRegion (const CompPoint::vector &);
00055 ~CompRegion ();
00056
00060 CompRect boundingRect () const;
00061
00062 bool isEmpty () const;
00063
00067 int numRects () const;
00068
00072 CompRect::vector rects () const;
00073
00077 const Region handle () const;
00078
00083 bool contains (const CompPoint &) const;
00088 bool contains (const CompRect &) const;
00093 bool contains (int x, int y, int width, int height) const;
00094
00099 CompRegion intersected (const CompRegion &) const;
00104 CompRegion intersected (const CompRect &) const;
00108 bool intersects (const CompRegion &) const;
00112 bool intersects (const CompRect &) const;
00117 CompRegion subtracted (const CompRegion &) const;
00122 CompRegion subtracted (const CompRect &) const;
00126 void translate (int dx, int dy);
00131 void translate (const CompPoint &);
00136 CompRegion translated (int, int) const;
00141 CompRegion translated (const CompPoint &) const;
00142 void shrink (int, int);
00143 void shrink (const CompPoint &);
00144 CompRegion shrinked (int, int) const;
00145 CompRegion shrinked (const CompPoint &) const;
00150 CompRegion united (const CompRegion &) const;
00155 CompRegion united (const CompRect &) const;
00161 CompRegion xored (const CompRegion &) const;
00162
00163 bool operator== (const CompRegion &) const;
00164 bool operator!= (const CompRegion &) const;
00165 const CompRegion operator& (const CompRegion &) const;
00166 const CompRegion operator& (const CompRect &) const;
00167 CompRegion & operator&= (const CompRegion &);
00168 CompRegion & operator&= (const CompRect &);
00169 const CompRegion operator+ (const CompRegion &) const;
00170 const CompRegion operator+ (const CompRect &) const;
00171 CompRegion & operator+= (const CompRegion &);
00172 CompRegion & operator+= (const CompRect &);
00173 const CompRegion operator- (const CompRegion &) const;
00174 const CompRegion operator- (const CompRect &) const;
00175 CompRegion & operator-= (const CompRegion &);
00176 CompRegion & operator-= (const CompRect &);
00177 CompRegion & operator= (const CompRegion &);
00178
00179 const CompRegion operator^ (const CompRegion &) const;
00180 CompRegion & operator^= (const CompRegion &);
00181 const CompRegion operator| (const CompRegion &) const;
00182 CompRegion & operator|= (const CompRegion &);
00183
00184 private:
00185 PrivateRegion *priv;
00186 };
00187
00188 extern const CompRegion infiniteRegion;
00189 extern const CompRegion emptyRegion;
00190
00191 #endif