
typedef struct {
	short int x1, y1, x2, y2;
} Rect;

typedef struct {
	int count;
	int rectspace;
	Rect bound;
        Rect *rects;
} Area;

Area *AreaCreate(void);
void AreaDestroy(Area *a);
Area *AreaCopy(Area *src);

Area *AreaUnionRect(Area *a, int x1, int y1, int x2, int y2);
#define AreaOrRect(a, x1, y1, x2, y2) AreaUnionRect(a, x1, y1, x2, y2)
Area *AreaIntersectRect(Area *a, int x1, int y1, int x2, int y2);
#define AreaAndRect(a, x1, y1, x2, y2) AreaIntersectRect(a, x1, y1, x2, y2)
Area *AreaSubRect(Area *a, int x1, int y1, int x2, int y2);

Area *AreaUnionArea(Area *a, Area *b);
#define AreaOrArea(a, x1, y1, x2, y2) AreaUnionArea(a, b)
Area *AreaIntersectArea(Area *a, Area *b);
#define AreaAndArea(a, x1, y1, x2, y2) AreaIntersectArea(a, b)
Area *AreaSubArea(Area *a, Area *b);

