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.9, 0.1, 0.1, 0.8};
732001f49Smrg
832001f49SmrgVGPath path;
932001f49SmrgVGPaint fill;
1032001f49Smrg
1132001f49Smrg
1232001f49Smrgstatic void
1332001f49Smrginit(void)
1432001f49Smrg{
1532001f49Smrg   static const VGubyte sqrCmds[10] = {VG_MOVE_TO_ABS,
1632001f49Smrg                                       VG_LINE_TO_ABS,
1732001f49Smrg                                       VG_CUBIC_TO_ABS,
1832001f49Smrg                                       VG_LINE_TO_ABS,
1932001f49Smrg                                       VG_CUBIC_TO_ABS,
2032001f49Smrg                                       VG_LINE_TO_ABS,
2132001f49Smrg                                       VG_CUBIC_TO_ABS,
2232001f49Smrg                                       VG_LINE_TO_ABS,
2332001f49Smrg                                       VG_CUBIC_TO_ABS,
2432001f49Smrg                                       VG_CLOSE_PATH};
2532001f49Smrg   static const VGfloat sqrCoords[]   = {
2632001f49Smrg      45.885571, 62.857143,
2732001f49Smrg      154.11442, 62.857143,
2832001f49Smrg      162.1236, 62.857143, 168.57142, 70.260744, 168.57142, 79.457144,
2932001f49Smrg      168.57142, 123.4,
3032001f49Smrg      168.57142, 132.5964, 162.1236,  140, 154.11442, 140,
3132001f49Smrg      45.885571, 140,
3232001f49Smrg      37.876394, 140, 31.428572, 132.5964, 31.428572, 123.4,
3332001f49Smrg      31.428572, 79.457144,
3432001f49Smrg      31.428572, 70.260744, 37.876394,62.857143, 45.885571,62.857143
3532001f49Smrg   };
3632001f49Smrg   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
3732001f49Smrg                       VG_PATH_CAPABILITY_APPEND_TO);
3832001f49Smrg   vgAppendPathData(path, 10, sqrCmds, sqrCoords);
3932001f49Smrg
4032001f49Smrg   fill = vgCreatePaint();
4132001f49Smrg   vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
4232001f49Smrg   vgSetPaint(fill, VG_FILL_PATH);
4332001f49Smrg
4432001f49Smrg   vgSetfv(VG_CLEAR_COLOR, 4, white_color);
4532001f49Smrg   vgSetf(VG_STROKE_LINE_WIDTH, 6);
4632001f49Smrg}
4732001f49Smrg
4832001f49Smrg/* new window size or exposure */
4932001f49Smrgstatic void
5032001f49Smrgreshape(int w, int h)
5132001f49Smrg{
5232001f49Smrg   vgLoadIdentity();
5332001f49Smrg}
5432001f49Smrg
5532001f49Smrgstatic void
5632001f49Smrgdraw(void)
5732001f49Smrg{
5832001f49Smrg   vgClear(0, 0, window_width(), window_height());
5932001f49Smrg   vgDrawPath(path, VG_STROKE_PATH);
6032001f49Smrg}
6132001f49Smrg
6232001f49Smrg
6332001f49Smrgint main(int argc, char **argv)
6432001f49Smrg{
6532001f49Smrg   return run(argc, argv, init, reshape,
6632001f49Smrg              draw, 0);
6732001f49Smrg}
68