Mixed tabs/spaces to spaces.
[AROS.git] / rom / graphics / andregionregionnd.c
blob7b625b28449235e4d919d5fc193b8e4ef47561f5
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AndRegionRegion()
6 Lang: english
7 */
9 #include "graphics_intern.h"
10 #include <graphics/regions.h>
11 #include "intregions.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH2(struct Region *, AndRegionRegionND,
20 /* SYNOPSIS */
21 AROS_LHA(struct Region *, R1, A0),
22 AROS_LHA(struct Region *, R2, A1),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 187, Graphics)
27 /* FUNCTION
28 AND of one region with another region
30 INPUTS
31 region1 - pointer to a region structure
32 region2 - pointer to a region structure
34 RESULT
35 The resulting region or NULL in case there's no enough free memory
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 XorRegionRegion(), OrRegionRegion()
46 INTERNALS
48 HISTORY
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct Region *R3 = NewRegion();
58 R3 &&
59 R1->RegionRectangle &&
60 R2->RegionRectangle &&
61 overlap(R1->bounds, R2->bounds)
66 _DoOperationBandBand
68 _AndBandBand,
69 MinX(R1),
70 MinX(R2),
71 MinY(R1),
72 MinY(R2),
73 R1->RegionRectangle,
74 R2->RegionRectangle,
75 &R3->RegionRectangle,
76 &R3->bounds,
77 GfxBase
81 _TranslateRegionRectangles(R3->RegionRectangle, -MinX(R3), -MinY(R3));
83 else
85 DisposeRegion(R3);
86 R3 = NULL;
90 return R3;
92 AROS_LIBFUNC_EXIT