2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Graphics function AndRectRegion()
9 #include <graphics/regions.h>
10 #include <proto/exec.h>
11 #include <clib/macros.h>
13 #include "graphics_intern.h"
14 #include "intregions.h"
16 /*****************************************************************************
19 #include <proto/graphics.h>
21 AROS_LH2(struct Region
*, ClearRectRegionND
,
24 AROS_LHA(struct Region
*, Reg
, A0
),
25 AROS_LHA(struct Rectangle
*, Rect
, A1
),
28 struct GfxBase
*, GfxBase
, 192, Graphics
)
31 Clear the given Rectangle from the given Region
34 region - pointer to Region structure
35 rectangle - pointer to Rectangle structure
38 The resulting region or NULL in case there's no enough free memory
45 AndRegionRegion(), OrRectRegion(), XorRectRegion(), ClearRectRegion()
51 27-11-96 digulla automatically created from
52 graphics_lib.fd and clib/graphics_protos.h
53 16-01-97 mreckt initial version
55 *****************************************************************************/
59 struct Region
*Res
= NewRegion();
64 if (!Reg
->RegionRectangle
||
66 !overlap(*Rect
, Reg
->bounds
))
68 /* Nothing to clear. Make a plain copy. */
69 if (!_CopyRegionRectangles(Reg
, Res
, GfxBase
))
76 else if (Rect
->MinX
> MinX(Reg
) || Rect
->MinY
> MinY(Reg
) ||
77 Rect
->MaxX
< MaxX(Reg
) || Rect
->MaxY
< MaxY(Reg
))
79 /* Partial overlapping detected. Do the complete algorithm. */
80 struct RegionRectangle rr
;
97 &Res
->RegionRectangle
,
103 _TranslateRegionRectangles(Res
->RegionRectangle
, -MinX(Res
), -MinY(Res
));
111 /* If neither of two cases above were true, we've removed everything (Rect completely covers Reg). Return empty Res. */
116 } /* AndRectRegion */