2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function AreaMove()
8 #include <exec/types.h>
9 #include <graphics/rastport.h>
10 #include "graphics_intern.h"
11 #include "gfxfuncsupport.h"
13 /*****************************************************************************
16 #include <proto/graphics.h>
18 AROS_LH3(ULONG
, AreaMove
,
21 AROS_LHA(struct RastPort
*, rp
, A1
),
22 AROS_LHA(WORD
, x
, D0
),
23 AROS_LHA(WORD
, y
, D1
),
26 struct GfxBase
*, GfxBase
, 42, Graphics
)
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.
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
42 -1 if the vector collection matrix is full
51 InitArea(), AreaDraw(), AreaEllipse(), AreaCircle()
58 *****************************************************************************/
62 struct AreaInfo
* areainfo
= rp
->AreaInfo
;
64 /* Is there still enough storage area in the areainfo-buffer?
65 * We just need room for one entry.
68 if (areainfo
->Count
+ 1 <= areainfo
->MaxCount
)
73 /* is this the very first entry in the vector collection matrix */
74 if (0 == areainfo
->Count
)
79 /* Insert the new point into the matrix */
80 areainfo
->VctrPtr
[0] = x
;
81 areainfo
->VctrPtr
[1] = y
;
82 areainfo
->VctrPtr
= &areainfo
->VctrPtr
[2];
84 areainfo
->FlagPtr
[0] = AREAINFOFLAG_MOVE
;
91 /* if the previous command was also an AreaMove() then we will replace
94 if ( AREAINFOFLAG_MOVE
== areainfo
->FlagPtr
[-1])
99 /* replace the previous point */
100 areainfo
->VctrPtr
[-2] = x
;
101 areainfo
->VctrPtr
[-1] = y
;
103 else /* it's not the first command and the previous command wasn't AreaMove() */
105 /* ... otherwise close the polygon if necessary */
107 areaclosepolygon(areainfo
);
109 /* Need to check again, if there is enough room, because
110 areaclosepolygon might have eaten one vector!! */
112 if (areainfo
->Count
+ 1 > areainfo
->MaxCount
)
115 areainfo
->FirstX
= x
;
116 areainfo
->FirstY
= y
;
118 /* Insert the new point into the matrix */
119 areainfo
->VctrPtr
[0] = x
;
120 areainfo
->VctrPtr
[1] = y
;
121 areainfo
->VctrPtr
= &areainfo
->VctrPtr
[2];
123 areainfo
->FlagPtr
[0] = AREAINFOFLAG_MOVE
;
129 } /* if (0 == areainfo->Count) */
131 } /* if (areainfo->Count + 1 <= areainfo->MaxCount) */