2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Some common macros for rectangles and regions.
12 #include <proto/graphics.h>
14 #define MinX(rr) ((rr)->bounds.MinX)
15 #define MaxX(rr) ((rr)->bounds.MaxX)
16 #define MinY(rr) ((rr)->bounds.MinY)
17 #define MaxY(rr) ((rr)->bounds.MaxY)
19 /* CHECKME: Aren't the following candidates for moving into graphics/gfxmacros.h ? */
21 #define _DoRectsOverlap(Rect, Rect2) \
23 (Rect2)->MinY <= (Rect)->MaxY && \
24 (Rect2)->MaxY >= (Rect)->MinY && \
25 (Rect2)->MinX <= (Rect)->MaxX && \
26 (Rect2)->MaxX >= (Rect)->MinX \
29 #define overlap(a, b) _DoRectsOverlap(&(a), &(b))
31 #define _TranslateRect(rect, dx, dy) \
40 #define InitRegion(region) \
43 (region)->bounds.MinX = 0; \
44 (region)->bounds.MinY = 0; \
45 (region)->bounds.MaxX = 0; \
46 (region)->bounds.MaxY = 0; \
47 (region)->RegionRectangle = NULL; \
50 static inline struct Region
*_NewRectRegion(WORD MinX
, WORD MinY
, WORD MaxX
, WORD MaxY
, struct GfxBase
*GfxBase
)
52 struct Region
*region
= NewRegion();
56 struct Rectangle rect
= {MinX
, MinY
, MaxX
, MaxY
};
58 if (OrRectRegion(region
, &rect
))
61 DisposeRegion(region
);
68 #endif /* !INTREGIONS_H */