r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / rom / graphics / andregionregion.c
blobb1a6d97fcdb041c801840cf3a64b0a7a6bfc5396
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AndRegionRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include "intregions.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/graphics.h>
17 AROS_LH2(BOOL, AndRegionRegion,
19 /* SYNOPSIS */
20 AROS_LHA(struct Region *, R1, A0),
21 AROS_LHA(struct Region *, R2, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 104, Graphics)
26 /* FUNCTION
27 AND of one region with another region, leaving result in
28 second region.
30 INPUTS
31 region1 - pointer to a region structure
32 region2 - pointer to a region structure
34 RESULT
35 TRUE if the operation was successful, else FALSE
36 (out of memory)
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 XorRegionRegion(), OrRegionRegion()
47 INTERNALS
49 HISTORY
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 if (!R1->RegionRectangle || !R2->RegionRectangle || !overlap(R1->bounds, R2->bounds))
57 ClearRegion(R2);
58 return TRUE;
60 else
62 struct Region R3;
64 InitRegion(&R3);
68 _DoOperationBandBand
70 _AndBandBand,
71 MinX(R1),
72 MinX(R2),
73 MinY(R1),
74 MinY(R2),
75 R1->RegionRectangle,
76 R2->RegionRectangle,
77 &R3.RegionRectangle,
78 &R3.bounds,
79 GfxBase
83 ClearRegion(R2);
85 *R2 = R3;
87 _TranslateRegionRectangles(R3.RegionRectangle, -MinX(&R3), -MinY(&R3));
89 return TRUE;
93 return FALSE;
95 AROS_LIBFUNC_EXIT