r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / rom / graphics / clearrectregionnd.c
blob25b71541eff3fe439d6cf0d4b24055af44d81d6c
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AndRectRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include <proto/exec.h>
11 #include <clib/macros.h>
12 #include "intregions.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH2(struct Region *, ClearRectRegionND,
21 /* SYNOPSIS */
22 AROS_LHA(struct Region *, Reg, A0),
23 AROS_LHA(struct Rectangle *, Rect, A1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 124, Graphics)
28 /* FUNCTION
29 Clear the given Rectangle from the given Region
31 INPUTS
32 region - pointer to Region structure
33 rectangle - pointer to Rectangle structure
35 RESULT
36 The resulting region or NULL in case there's no enough free memory
38 NOTES
40 BUGS
42 SEE ALSO
43 AndRegionRegion() OrRectRegion() XorRectRegion() ClearRectRegion()
44 NewRegion()
46 INTERNALS
48 HISTORY
49 27-11-96 digulla automatically created from
50 graphics_lib.fd and clib/graphics_protos.h
51 16-01-97 mreckt initial version
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct Region *Res;
61 !Reg->RegionRectangle ||
62 !overlap(*Rect, Reg->bounds)
65 return CopyRegion(Reg);
68 Res = NewRegion();
72 Res &&
74 Rect->MinX > MinX(Reg) ||
75 Rect->MinY > MinY(Reg) ||
76 Rect->MaxX < MaxX(Reg) ||
77 Rect->MaxY < MaxY(Reg)
81 struct RegionRectangle rr;
83 rr.bounds = *Rect;
84 rr.Next = NULL;
85 rr.Prev = NULL;
89 _DoOperationBandBand
91 _ClearBandBand,
93 MinX(Reg),
95 MinY(Reg),
96 &rr,
97 Reg->RegionRectangle,
98 &Res->RegionRectangle,
99 &Res->bounds,
100 GfxBase
104 _TranslateRegionRectangles(Res->RegionRectangle, -MinX(Res), -MinY(Res));
106 else
108 DisposeRegion(Res);
109 Res = NULL;
113 return Res;
115 AROS_LIBFUNC_EXIT
116 } /* AndRectRegion */