- Handle multiple nodes having output volume control.
[AROS.git] / rom / graphics / scrollregion.c
blob427125cb45296f6290a15a1bf3166b79a876601e
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function ScrollRegion()
6 Lang: english
7 */
9 #include "graphics_intern.h"
10 #include <graphics/regions.h>
11 #include "intregions.h"
12 #include "gfxfuncsupport.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH4(BOOL, ScrollRegion,
21 /* SYNOPSIS */
22 AROS_LHA(struct Region *, region, A0),
23 AROS_LHA(struct Rectangle *, rect, A1),
24 AROS_LHA(WORD, dx, D0),
25 AROS_LHA(WORD, dy, D1),
27 /* LOCATION */
28 struct GfxBase *, GfxBase, 185, Graphics)
30 /* FUNCTION
31 Scroll the rectangles in the region by the amount of pixels specified, within the
32 specified rectangle.
34 INPUTS
35 region - pointer to a region structure
36 rect - pointer to the rectangle within which the scrolling has to happen.
37 If NULL, the region's bounds are used instead.
38 dx, dy - the amount of pixels by which to scroll the region. Negative values mean
39 respectively left and up, positive values mean right and down.
40 RESULT
41 TRUE if the operation succeeded, FALSE otherwise.
43 NOTES
44 This function doesn't exist in AmigaOS
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 NewRegion()
53 INTERNALS
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 BOOL res = FALSE;
63 if (!rect)
65 TranslateRect(Bounds(region), dx, dy);
67 res = TRUE;
69 else
71 struct Region *cutRegion;
73 cutRegion = AndRectRegionND(region, rect);
74 if (cutRegion)
76 struct Region *newRegion;
78 TranslateRect(Bounds(cutRegion), dx, dy);
80 AndRectRegion(cutRegion, rect);
82 newRegion = ClearRectRegionND(region, rect);
83 if (newRegion)
85 if (OrRegionRegion(cutRegion, newRegion))
87 _SwapRegions(region, newRegion);
89 res = TRUE;
92 DisposeRegion(newRegion);
95 DisposeRegion(cutRegion);
99 return res;
101 AROS_LIBFUNC_EXIT