1 /* Public domain */
2
3 typedef struct vg_arc {
4 struct vg_node _inherit;
5 VG_Point *p; /* Centerpoint */
6 float r; /* Arc radius */
7 float a1; /* Start angle (degs) */
8 float a2; /* End angle (degs) */
9 } VG_Arc;
10
11 #define VGARC(p) ((VG_Arc *)(p))
12
13 __BEGIN_DECLS
14 extern VG_NodeOps vgArcOps;
15
16 static __inline__ VG_Arc *
VG_ArcNew(void * pNode,VG_Point * pCenter,float r,float a1,float a2)17 VG_ArcNew(void *pNode, VG_Point *pCenter, float r, float a1, float a2)
18 {
19 VG_Arc *va;
20
21 va = (VG_Arc *)AG_Malloc(sizeof(VG_Arc));
22 VG_NodeInit(va, &vgArcOps);
23 va->p = pCenter;
24 va->r = r;
25 va->a1 = a1;
26 va->a2 = a2;
27 VG_AddRef(va, pCenter);
28 VG_NodeAttach(pNode, va);
29 return (va);
30 }
31
32 static __inline__ void
VG_ArcCenter(VG_Arc * va,VG_Point * pCenter)33 VG_ArcCenter(VG_Arc *va, VG_Point *pCenter)
34 {
35 VG_Lock(VGNODE(va)->vg);
36 VG_DelRef(va, va->p);
37 VG_AddRef(va, pCenter);
38 va->p = pCenter;
39 VG_Unlock(VGNODE(va)->vg);
40 }
41
42 static __inline__ void
VG_ArcRadius(VG_Arc * va,float r)43 VG_ArcRadius(VG_Arc *va, float r)
44 {
45 VG_Lock(VGNODE(va)->vg);
46 va->r = r;
47 VG_Unlock(VGNODE(va)->vg);
48 }
49 __END_DECLS
50