1 #ifndef __lib_gdi_region_h
2 #define __lib_gdi_region_h
4 #include <lib/base/object.h>
5 #include <lib/gdi/erect.h>
12 std::vector<eRect>::const_iterator r,
13 std::vector<eRect>::const_iterator &rBandEnd,
14 std::vector<eRect>::const_iterator rEnd,
19 while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1))
23 inline void AppendRegions(
24 std::vector<eRect>::const_iterator r,
25 std::vector<eRect>::const_iterator rEnd)
27 rects.insert(rects.end(), r, rEnd);
30 int do_coalesce(int prevStart, unsigned int curStart);
31 inline void coalesce(int &prevBand, unsigned int curBand)
33 if (curBand - prevBand == rects.size() - curBand) {
34 prevBand = do_coalesce(prevBand, curBand);
39 void appendNonO(std::vector<eRect>::const_iterator r,
40 std::vector<eRect>::const_iterator rEnd, int y1, int y2);
43 std::vector<eRect>::const_iterator r1,
44 std::vector<eRect>::const_iterator r1End,
45 std::vector<eRect>::const_iterator r2,
46 std::vector<eRect>::const_iterator r2End,
50 std::vector<eRect>::const_iterator r1,
51 std::vector<eRect>::const_iterator r1End,
52 std::vector<eRect>::const_iterator r2,
53 std::vector<eRect>::const_iterator r2End,
57 std::vector<eRect>::const_iterator r1,
58 std::vector<eRect>::const_iterator r1End,
59 std::vector<eRect>::const_iterator r2,
60 std::vector<eRect>::const_iterator r2End,
63 void regionOp(const gRegion ®1, const gRegion ®2, int opcode, int &overlap);
65 std::vector<eRect> rects;
70 // note: bit 0 and bit 1 have special meanings
76 gRegion(const eRect &rect);
80 gRegion operator&(const gRegion &r2) const;
81 gRegion operator-(const gRegion &r2) const;
82 gRegion operator|(const gRegion &r2) const;
83 gRegion &operator&=(const gRegion &r2);
84 gRegion &operator-=(const gRegion &r2);
85 gRegion &operator|=(const gRegion &r2);
87 void intersect(const gRegion &r1, const gRegion &r2);
88 void subtract(const gRegion &r1, const gRegion &r2);
89 void merge(const gRegion &r1, const gRegion &r2);
91 void moveBy(ePoint offset);
93 bool empty() const { return extends.empty(); }
94 bool valid() const { return extends.valid(); }
96 static gRegion invalidRegion() { return gRegion(eRect::invalidRect()); }
98 void scale(int x_n, int x_d, int y_n, int y_d);