5 const VGfloat white_color
[4] = {1.0, 1.0, 1.0, 1.0};
6 const VGfloat color
[4] = {0.4, 0.1, 1.0, 1.0};
15 /* Absent VG_CLOSE_PATH */
16 VGubyte commands
[] = {VG_MOVE_TO_ABS
, VG_LINE_TO_ABS
, VG_LINE_TO_ABS
, VG_LINE_TO_ABS
,
17 VG_MOVE_TO_ABS
, VG_LINE_TO_ABS
, VG_LINE_TO_ABS
, VG_LINE_TO_ABS
};
18 VGfloat clearColor
[] = {1.0f
, 1.0f
, 1.0f
, 1.0f
};/* white color */
19 VGfloat fillColor
[] = {1.0f
, 0.0f
, 0.0f
, 1.0f
};/* red color */
20 VGfloat coords
[] = {-16.0f
, -16.0f
, 0.0f
, -16.0f
, 0.0f
, 0.0f
, -16.0f
, 0.0f
,
21 0.0f
, 0.0f
, 16.0f
, 0.0f
, 16.0f
, 16.0f
, 0.0f
, 16.0f
};
23 vgSetfv(VG_CLEAR_COLOR
, 4, clearColor
);
24 vgSeti(VG_RENDERING_QUALITY
, VG_RENDERING_QUALITY_NONANTIALIASED
);
26 vgSeti(VG_MATRIX_MODE
, VG_MATRIX_PATH_USER_TO_SURFACE
);
28 vgTranslate(32.0f
, 32.0f
);
30 path
= vgCreatePath(VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
, 1.0f
, 0.0f
, 0, 0,
31 VG_PATH_CAPABILITY_ALL
);
32 if (path
== VG_INVALID_HANDLE
)
34 fill
= vgCreatePaint();
35 if (fill
== VG_INVALID_HANDLE
) {
39 vgAppendPathData(path
, 8, commands
, coords
);
40 vgSetPaint(fill
, VG_FILL_PATH
);
41 vgSetParameterfv(fill
, VG_PAINT_COLOR
, 4, fillColor
);
42 vgSetParameteri(fill
, VG_PAINT_TYPE
, VG_PAINT_TYPE_COLOR
);
45 /* new window size or exposure */
54 vgClear(0, 0, window_width(), window_height());
55 vgDrawPath(path
, VG_FILL_PATH
);
61 int main(int argc
, char **argv
)
63 set_window_size(64, 64);
64 return run(argc
, argv
, init
, reshape
,