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   static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
1632001f49Smrg   static const VGfloat sqrCoords[5]   = {50.0f, 50.0f, 250.0f, 250.0f, 50.0f};
1732001f49Smrg   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
1832001f49Smrg                       VG_PATH_CAPABILITY_APPEND_TO);
1932001f49Smrg   vgAppendPathData(path, 5, sqrCmds, sqrCoords);
2032001f49Smrg
2132001f49Smrg   fill = vgCreatePaint();
2232001f49Smrg   vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
2332001f49Smrg   vgSetPaint(fill, VG_FILL_PATH);
2432001f49Smrg
2532001f49Smrg   vgSetfv(VG_CLEAR_COLOR, 4, white_color);
2632001f49Smrg   vgSetf(VG_STROKE_LINE_WIDTH, 10);
2732001f49Smrg   vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
2832001f49Smrg   vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
2932001f49Smrg   vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
3032001f49Smrg}
3132001f49Smrg
3232001f49Smrg/* new window size or exposure */
3332001f49Smrgstatic void
3432001f49Smrgreshape(int w, int h)
3532001f49Smrg{
3632001f49Smrg   vgLoadIdentity();
3732001f49Smrg}
3832001f49Smrg
3932001f49Smrgstatic void
4032001f49Smrgdraw(void)
4132001f49Smrg{
4232001f49Smrg   vgClear(0, 0, window_width(), window_height());
4332001f49Smrg   vgSeti(VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER);
4432001f49Smrg   vgLoadIdentity();
4532001f49Smrg   vgScale(2.25, 2.25);
4632001f49Smrg   vgDrawPath(path, VG_STROKE_PATH);
4732001f49Smrg
4832001f49Smrg   vgFlush();
4932001f49Smrg}
5032001f49Smrg
5132001f49Smrg
5232001f49Smrgint main(int argc, char **argv)
5332001f49Smrg{
5432001f49Smrg   return run(argc, argv, init, reshape,
5532001f49Smrg              draw, 0);
5632001f49Smrg}
57