Region& Region::Include(const Rect &rect) { Region temp; BeginOperation(); // Make sure that there are no overlaps temp.AddRect(rect); for (int i = 0; i < fNumRects; i++) temp.Exclude(RectAt(i)); AddRegionRects(temp); EndOperation(); return *this; }
Region& Region::Intersect(const Region &intersectRegion) { BeginOperation(); Region newRegion; for (int i = 0; i < fNumRects; i++) { for (int j = 0; j < intersectRegion.fNumRects; j++) { if (RectAt(i).Intersects(intersectRegion.RectAt(j))) { Rect temp(RectAt(i)); temp.Intersect(intersectRegion.RectAt(j)); newRegion.AddRect(temp); } } } SetTo(newRegion); EndOperation(); return *this; }