1#include "eglcommon.h" 2 3#include <VG/openvg.h> 4 5const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0}; 6const VGfloat green_color[4] = {0.0, 1.0, 0.0, 0.8}; 7 8VGPath path; 9VGPaint fill; 10 11 12static void 13init(void) 14{ 15 static const VGubyte cmds[6] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, 16 VG_LINE_TO_ABS, VG_CLOSE_PATH}; 17 static const VGfloat coords[] = { 0, 200, 18 300, 200, 19 50, 0, 20 150, 300, 21 250, 0}; 22 path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0, 23 VG_PATH_CAPABILITY_APPEND_TO); 24 vgAppendPathData(path, 6, cmds, coords); 25 26 fill = vgCreatePaint(); 27 vgSetParameterfv(fill, VG_PAINT_COLOR, 4, green_color); 28 vgSetPaint(fill, VG_FILL_PATH); 29 30 vgSetfv(VG_CLEAR_COLOR, 4, white_color); 31 vgSeti(VG_FILL_RULE, VG_NON_ZERO); 32} 33 34/* new window size or exposure */ 35static void 36reshape(int w, int h) 37{ 38 vgLoadIdentity(); 39} 40 41static void 42draw(void) 43{ 44 vgClear(0, 0, window_width(), window_height()); 45 vgDrawPath(path, VG_FILL_PATH | VG_STROKE_PATH); 46 47 vgFlush(); 48} 49 50 51int main(int argc, char **argv) 52{ 53 return run(argc, argv, init, reshape, 54 draw, 0); 55} 56