2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function AreaEllipse()
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_LH5(ULONG
, AreaEllipse
,
21 AROS_LHA(struct RastPort
*, rp
, A1
),
22 AROS_LHA(WORD
, cx
, D0
),
23 AROS_LHA(WORD
, cy
, D1
),
24 AROS_LHA(WORD
, a
, D2
),
25 AROS_LHA(WORD
, b
, D3
),
28 struct GfxBase
*, GfxBase
, 31, Graphics
)
31 Add an ellipse to the vector buffer. An ellipse takes up two
32 entries in the buffer.
35 rp - pointer to a valid RastPort structure with a pointer to
36 the previously initialized AreaInfo structure.
37 cx - x coordinate of the center point relative to rastport
38 cy - y coordinate of the center point relative to rastport
39 a - horizontal radius of the ellipse (> 0)
40 b - vertical radius of the ellipse (> 0)
44 -1 if the vector collection matrix is full
53 InitArea(), AreaMove(), AreaDraw(), AreaCircle()
60 *****************************************************************************/
64 struct AreaInfo
* areainfo
= rp
->AreaInfo
;
66 /* Is there still enough storage area in the areainfo-buffer?
67 * We need at least a storage area for two vectors
69 if (areainfo
->Count
+ 2 <= areainfo
->MaxCount
)
76 /* is this the very first entry in the vector collection matrix */
77 if (0 == areainfo
->Count
)
79 areainfo
->VctrPtr
[0] = cx
;
80 areainfo
->VctrPtr
[1] = cy
;
81 areainfo
->FlagPtr
[0] = AREAINFOFLAG_ELLIPSE
;
83 areainfo
->VctrPtr
[2] = a
;
84 areainfo
->VctrPtr
[3] = b
;
85 areainfo
->FlagPtr
[1] = AREAINFOFLAG_ELLIPSE
;
87 areainfo
->VctrPtr
= &areainfo
->VctrPtr
[4];
88 areainfo
->FlagPtr
= &areainfo
->FlagPtr
[2];
94 areaclosepolygon(areainfo
);
96 /* Need to check again, if there is enough room, because
97 areaclosepolygon might have eaten one vector!! */
99 if (areainfo
->Count
+ 2 > areainfo
->MaxCount
)
102 /* If the previous command in the vector collection matrix was a move then
106 if (AREAINFOFLAG_MOVE
== areainfo
->FlagPtr
[-1])
108 areainfo
->VctrPtr
= &areainfo
->VctrPtr
[-2];
113 /* still enough storage area?? */
114 if (areainfo
->Count
+ 2 <= areainfo
->MaxCount
)
116 areainfo
->VctrPtr
[0] = cx
;
117 areainfo
->VctrPtr
[1] = cy
;
118 areainfo
->FlagPtr
[0] = AREAINFOFLAG_ELLIPSE
;
120 areainfo
->VctrPtr
[2] = a
;
121 areainfo
->VctrPtr
[3] = b
;
122 areainfo
->FlagPtr
[1] = AREAINFOFLAG_ELLIPSE
;
124 areainfo
->VctrPtr
= &areainfo
->VctrPtr
[4];
125 areainfo
->FlagPtr
= &areainfo
->FlagPtr
[2];
127 areainfo
->Count
+= 2;
134 } /* else branch of if (0 == areainfo->Count) */
136 /* will never get to this point! */
138 } /* if (areainfo->Count + 2 < areainfo->MaxCount) */