14 /* new window size or exposure */
24 VGint WINDSIZEX
= window_width();
25 VGint WINDSIZEY
= window_height();
29 VGfloat clearColor
[] = {1.0f
, 1.0f
, 1.0f
, 0.0f
};/* white color */
30 VGfloat fillColor
[] = {1.0f
, 0.0f
, 0.0f
, 1.0f
};/* red color */
33 VGubyte commands
[4] = {VG_MOVE_TO_ABS
, VG_LCWARC_TO_ABS
, VG_SCWARC_TO_ABS
, VG_CLOSE_PATH
};
35 VGubyte commands
[4] = {VG_MOVE_TO_ABS
, VG_SCCWARC_TO_ABS
, VG_LCCWARC_TO_ABS
,VG_CLOSE_PATH
};
37 VGfloat coords
[] = {32.0f
, 0.0f
,
38 -32.0f
, -32.0f
, 0.0f
, 64.0f
, 32.0f
,
39 -32.0f
, -32.0f
, 0.0f
, 32.0f
, 0.0f
};
42 vgSetfv(VG_CLEAR_COLOR
, 4, clearColor
);
43 vgClear(0, 0, WINDSIZEX
, WINDSIZEY
);
44 vgSeti(VG_RENDERING_QUALITY
, VG_RENDERING_QUALITY_NONANTIALIASED
);
46 vgSeti(VG_MATRIX_MODE
, VG_MATRIX_PATH_USER_TO_SURFACE
);
48 //vgTranslate(32.0f, 32.0f);
50 path
= vgCreatePath( VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
,
51 1.0f
, 0.0f
, 0, 0, VG_PATH_CAPABILITY_ALL
);
52 if ( path
== VG_INVALID_HANDLE
) {
55 paint
= vgCreatePaint();
56 if ( paint
== VG_INVALID_HANDLE
) {
61 vgAppendPathData(path
, 4, commands
, coords
);
62 vgSetParameterfv(paint
, VG_PAINT_COLOR
, 4, fillColor
);
63 vgSetParameteri( paint
, VG_PAINT_TYPE
, VG_PAINT_TYPE_COLOR
);
64 vgSetPaint(paint
, VG_FILL_PATH
);
65 vgDrawPath(path
, VG_FILL_PATH
);
68 vgDestroyPaint(paint
);
72 int main(int argc
, char **argv
)
74 set_window_size(64, 64);
75 return run(argc
, argv
, init
, reshape
,