5 const VGfloat white_color
[4] = {1.0, 1.0, 1.0, 1.0};
6 const VGfloat green_color
[4] = {0.0, 1.0, 0.0, 0.8};
7 const VGfloat black_color
[4] = {0.0, 0.0, 0.0, 1.0};
13 static void draw_point(VGfloat x
, VGfloat y
)
16 static const VGubyte cmds
[] = {VG_MOVE_TO_ABS
, VG_LINE_TO_ABS
, VG_LINE_TO_ABS
,
17 VG_LINE_TO_ABS
, VG_CLOSE_PATH
};
18 const VGfloat coords
[] = { x
- 2, y
- 2,
25 path
= vgCreatePath(VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
, 1, 0, 0, 0,
26 VG_PATH_CAPABILITY_ALL
);
27 vgAppendPathData(path
, 5, cmds
, coords
);
29 fill
= vgCreatePaint();
30 vgSetParameterfv(fill
, VG_PAINT_COLOR
, 4, black_color
);
31 vgSetPaint(fill
, VG_FILL_PATH
);
33 vgDrawPath(path
, VG_FILL_PATH
);
39 static void draw_marks(VGPath path
)
41 VGfloat point
[2], tangent
[2];
44 for (i
= 0; i
< 1300; i
+= 50) {
45 vgPointAlongPath(path
, 0, 6, i
,
47 tangent
+ 0, tangent
+ 1);
48 draw_point(point
[0], point
[1]);
55 static const VGubyte cmds
[6] = {VG_MOVE_TO_ABS
, VG_LINE_TO_ABS
, VG_LINE_TO_ABS
, VG_LINE_TO_ABS
,
56 VG_LINE_TO_ABS
, VG_CLOSE_PATH
};
57 static const VGfloat coords
[] = { 0, 200,
62 path
= vgCreatePath(VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
, 1, 0, 0, 0,
63 VG_PATH_CAPABILITY_ALL
);
64 vgAppendPathData(path
, 6, cmds
, coords
);
66 fill
= vgCreatePaint();
67 vgSetParameterfv(fill
, VG_PAINT_COLOR
, 4, green_color
);
68 vgSetPaint(fill
, VG_FILL_PATH
);
70 vgSetfv(VG_CLEAR_COLOR
, 4, white_color
);
73 /* new window size or exposure */
83 VGfloat point
[2], tangent
[2];
86 vgClear(0, 0, window_width(), window_height());
88 vgSetPaint(fill
, VG_FILL_PATH
);
89 vgDrawPath(path
, VG_FILL_PATH
);
98 int main(int argc
, char **argv
)
100 return run(argc
, argv
, init
, reshape
,