132001f49Smrg#include "eglcommon.h" 232001f49Smrg 332001f49Smrg#include <VG/openvg.h> 432001f49Smrg 532001f49Smrgconst VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0}; 632001f49Smrgconst VGfloat color[4] = {0.4, 0.1, 1.0, 1.0}; 732001f49Smrg 832001f49SmrgVGPath path; 932001f49SmrgVGPaint fill; 1032001f49Smrg 1132001f49Smrg 1232001f49Smrgstatic void 1332001f49Smrginit(void) 1432001f49Smrg{ 1532001f49Smrg /* Absent VG_CLOSE_PATH */ 1632001f49Smrg VGubyte commands[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, 1732001f49Smrg VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS}; 1832001f49Smrg VGfloat clearColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */ 1932001f49Smrg VGfloat fillColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */ 2032001f49Smrg VGfloat coords[] = {-16.0f, -16.0f, 0.0f, -16.0f, 0.0f, 0.0f, -16.0f, 0.0f, 2132001f49Smrg 0.0f, 0.0f, 16.0f, 0.0f, 16.0f, 16.0f, 0.0f, 16.0f}; 2232001f49Smrg 2332001f49Smrg vgSetfv(VG_CLEAR_COLOR, 4, clearColor); 2432001f49Smrg vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED); 2532001f49Smrg 2632001f49Smrg vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); 2732001f49Smrg vgLoadIdentity(); 2832001f49Smrg vgTranslate(32.0f, 32.0f); 2932001f49Smrg 3032001f49Smrg path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, 3132001f49Smrg VG_PATH_CAPABILITY_ALL); 3232001f49Smrg if (path == VG_INVALID_HANDLE) 3332001f49Smrg return; 3432001f49Smrg fill = vgCreatePaint(); 3532001f49Smrg if (fill == VG_INVALID_HANDLE) { 3632001f49Smrg vgDestroyPath(path); 3732001f49Smrg return; 3832001f49Smrg } 3932001f49Smrg vgAppendPathData(path, 8, commands, coords); 4032001f49Smrg vgSetPaint(fill, VG_FILL_PATH); 4132001f49Smrg vgSetParameterfv(fill, VG_PAINT_COLOR, 4, fillColor); 4232001f49Smrg vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); 4332001f49Smrg} 4432001f49Smrg 4532001f49Smrg/* new window size or exposure */ 4632001f49Smrgstatic void 4732001f49Smrgreshape(int w, int h) 4832001f49Smrg{ 4932001f49Smrg} 5032001f49Smrg 5132001f49Smrgstatic void 5232001f49Smrgdraw(void) 5332001f49Smrg{ 5432001f49Smrg vgClear(0, 0, window_width(), window_height()); 5532001f49Smrg vgDrawPath(path, VG_FILL_PATH); 5632001f49Smrg 5732001f49Smrg vgFlush(); 5832001f49Smrg} 5932001f49Smrg 6032001f49Smrg 6132001f49Smrgint main(int argc, char **argv) 6232001f49Smrg{ 6332001f49Smrg set_window_size(64, 64); 6432001f49Smrg return run(argc, argv, init, reshape, 6532001f49Smrg draw, 0); 6632001f49Smrg} 67