Some fixes.
[cake.git] / rom / graphics / newrectregion.c
blob29e4b1e3074e86b0e4d8901ffbbd9cf0f4f4bedb
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: (AROS only) Graphics function NewRectRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include <clib/macros.h>
11 #include "intregions.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH4(struct Region *, NewRectRegion,
20 /* SYNOPSIS */
21 AROS_LHA(WORD, MinX, D0),
22 AROS_LHA(WORD, MinY, D1),
23 AROS_LHA(WORD, MaxX, D2),
24 AROS_LHA(WORD, MaxY, D3),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 194, Graphics)
29 /* FUNCTION
30 Creates a new rectangular Region
32 INPUTS
33 MinX, MinY, MaxX, MaxY - The extent of the Rect
35 RESULT
36 Pointer to the newly created Region. NULL on failure.
38 NOTES
39 This function does not exist in AmigaOS.
40 It does basically the same as:
42 struct Rectangle rect;
43 struct Region *region;
45 rect.MinX = MinX;
46 rect.MinY = MinY;
47 rect.MaxX = MaxX;
48 rect.MaxY = MaxY;
50 region = NewRegion();
51 OrRectRegion(region, &rect);
53 EXAMPLE
55 BUGS
57 SEE ALSO
58 NewRegion(), OrRectRegion()
60 INTERNALS
62 HISTORY
63 15-12-2000 stegerg implemented
65 *****************************************************************************/
67 AROS_LIBFUNC_INIT
69 struct Region *region;
70 struct RegionRectangle *rr;
72 if ((region = NewRegion()))
74 struct RegionRectangle *last = NULL;
76 if ((rr = _NewRegionRectangle(&last, GfxBase)))
78 region->bounds.MinX = MinX;
79 region->bounds.MinY = MinY;
80 region->bounds.MaxX = MaxX;
81 region->bounds.MaxY = MaxY;
83 rr->bounds.MinX = 0;
84 rr->bounds.MinY = 0;
85 rr->bounds.MaxX = MaxX - MinX;
86 rr->bounds.MaxY = MaxY - MinY;
88 region->RegionRectangle = rr;
90 else
92 DisposeRegion(region);
93 region = NULL;
97 return region;
99 AROS_LIBFUNC_EXIT
101 } /* NewRectRegion */