Unification of "SEE ALSO" for boopsi.library
[cake.git] / rom / graphics / areamove.c
blobc5168bdf556d18b2c1f4ac5dddab49fff2f91142
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AreaMove()
6 Lang: english
7 */
8 #include <exec/types.h>
9 #include <graphics/rastport.h>
10 #include "graphics_intern.h"
11 #include "gfxfuncsupport.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH3(ULONG, AreaMove,
20 /* SYNOPSIS */
21 AROS_LHA(struct RastPort *, rp, A1),
22 AROS_LHA(WORD , x , D0),
23 AROS_LHA(WORD , y , D1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 42, Graphics)
28 /* FUNCTION
29 Define a new starting point in the vector list for the following
30 polygon defined by calls to AreaDraw(). The last polygon is closed
31 if it wasn't closed by the user and the new starting points are
32 added to the vector collection matrix.
34 INPUTS
35 rp - pointer to a valid RastPort structure with a pointer to
36 the previously initialized AreaInfo structure.
37 x - x-coordinate of the starting-point in the raster
38 y - y-coordinate of the starting-point in the raster
40 RESULT
41 error - 0 for success
42 -1 if the vector collection matrix is full
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 InitArea() AreaDraw() AreaEllipse() AreaCircle() graphics/rastport.h
53 INTERNALS
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct AreaInfo * areainfo = rp->AreaInfo;
63 /* Is there still enough storage area in the areainfo-buffer?
64 * We just need room for one entry.
67 if (areainfo->Count + 1 <= areainfo->MaxCount)
69 FIX_GFXCOORD(x);
70 FIX_GFXCOORD(y);
72 /* is this the very first entry in the vector collection matrix */
73 if (0 == areainfo->Count)
75 areainfo->FirstX = x;
76 areainfo->FirstY = y;
78 /* Insert the new point into the matrix */
79 areainfo->VctrPtr[0] = x;
80 areainfo->VctrPtr[1] = y;
81 areainfo->VctrPtr = &areainfo->VctrPtr[2];
83 areainfo->FlagPtr[0] = AREAINFOFLAG_MOVE;
84 areainfo->FlagPtr++;
86 areainfo->Count++;
88 else
90 /* if the previous command was also an AreaMove() then we will replace
91 * that one ...
93 if ( AREAINFOFLAG_MOVE == areainfo->FlagPtr[-1])
95 areainfo->FirstX = x;
96 areainfo->FirstY = y;
98 /* replace the previous point */
99 areainfo->VctrPtr[-2] = x;
100 areainfo->VctrPtr[-1] = y;
102 else /* it's not the first command and the previous command wasn't AreaMove() */
104 /* ... otherwise close the polygon if necessary */
106 areaclosepolygon(areainfo);
108 /* Need to check again, if there is enough room, because
109 areaclosepolygon might have eaten one vector!! */
111 if (areainfo->Count + 1 > areainfo->MaxCount)
112 return -1;
114 areainfo->FirstX = x;
115 areainfo->FirstY = y;
117 /* Insert the new point into the matrix */
118 areainfo->VctrPtr[0] = x;
119 areainfo->VctrPtr[1] = y;
120 areainfo->VctrPtr = &areainfo->VctrPtr[2];
122 areainfo->FlagPtr[0] = AREAINFOFLAG_MOVE;
123 areainfo->FlagPtr++;
125 areainfo->Count++;
128 } /* if (0 == areainfo->Count) */
130 } /* if (areainfo->Count + 1 <= areainfo->MaxCount) */
131 else
132 return -1;
134 return 0;
136 AROS_LIBFUNC_EXIT
138 } /* AreaMove */