New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / graphics / setregion.c
blobcddcdf9f4b5d5f20438039ea832d3391598ea5ca
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: (AROS only) Graphics function SetRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include "intregions.h"
12 /*****************************************************************************
14 NAME */
15 #include <clib/graphics_protos.h>
17 AROS_LH2(BOOL, SetRegion,
19 /* SYNOPSIS */
20 AROS_LHA(struct Region *, src , A0),
21 AROS_LHA(struct Region *, dest, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 195, Graphics)
26 /* FUNCTION
27 Sets the destination region to the source region.
28 Allocates necessary RegionRectangles if necessary
29 and deallocates any excessive RegionRectangles in
30 the destination Region. The source Region remains
31 untouched.
32 If the system runs out of memory during allocation
33 of RegionRectangles the destination Region will
36 INPUTS
38 RESULT
39 TRUE if everything went alright, FALSE otherwise
40 (out of memory).
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 NewRegion() DisposeRegion() DisposeRegionRectangle()
50 CopyRegion()
52 INTERNALS
54 HISTORY
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
59 AROS_LIBBASE_EXT_DECL(struct GfxBase *,GfxBase)
61 struct RegionRectangle * rrs, *rrd, *rrd_prev, *addr;
63 dest->bounds = src->bounds;
65 for
67 rrs = src->RegionRectangle, rrd = dest->RegionRectangle, rrd_prev = NULL;
68 rrs && rrd;
69 rrd_prev = rrd, rrs = rrs->Next, rrd = rrd->Next
72 rrd->bounds = rrs->bounds;
75 _DisposeRegionRectangleList(rrd, GfxBase);
77 if (rrd_prev)
78 addr = rrd_prev;
79 else
81 dest->RegionRectangle = NULL;
82 addr = dest->RegionRectangle;
85 if (!_LinkRegionRectangleList(rrs, &addr, GfxBase))
86 return FALSE;
88 if (!rrd_prev)
89 dest->RegionRectangle = addr ? &Chunk(addr)->FirstChunk->Rects[0].RR : NULL;
91 return TRUE;
93 AROS_LIBFUNC_EXIT
95 } /* SetRegion */