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
*, AndRectRegionND
,
24 AROS_LHA(struct Region
*, Reg
, A0
),
25 AROS_LHA(struct Rectangle
*, Rect
, A1
),
28 struct GfxBase
*, GfxBase
, 186, Graphics
)
31 Remove everything inside 'region' that is outside 'rectangle'
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();
61 if (IS_RECT_EVIL(Rect
))
66 if (!Reg
->RegionRectangle
)
68 /* The region is already empty, return empty copy */
74 if (Rect
->MinX
<= MinX(Reg
) &&
75 Rect
->MinY
<= MinY(Reg
) &&
76 Rect
->MaxX
>= MaxX(Reg
) &&
77 Rect
->MaxY
>= MaxY(Reg
))
79 /* The rectangle completely covers the region. Make a plain copy. */
80 if (_CopyRegionRectangles(Reg
, Res
, GfxBase
))
85 struct RegionRectangle rr
;
91 if (_DoOperationBandBand(_AndBandBand
,
92 MinX(Reg
), 0, MinY(Reg
), 0,
93 Reg
->RegionRectangle
, &rr
, &Res
->RegionRectangle
, &Res
->bounds
, GfxBase
))
95 _TranslateRegionRectangles(Res
->RegionRectangle
, -MinX(Res
), -MinY(Res
));
107 } /* AndRectRegion */