summaryrefslogtreecommitdiff
path: root/progs/openvg/trivial/star-nonzero.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2009-07-06 21:43:26 -0400
committerZack Rusin <zackr@vmware.com>2009-07-06 21:43:26 -0400
commitedb02671704aeb60e3eeaa7f58c73f4845c5b7e2 (patch)
tree0bd971c7c8aa4639fcbd5b060f560d978b9f0cf3 /progs/openvg/trivial/star-nonzero.c
parent124a6b1958c630ea049025e2b72547096fdc8f2c (diff)
parent54324d9e0c6956bdc7bc9b0620fe53c8e6b66a04 (diff)
Merge commit 'origin/openvg-1.0'
Diffstat (limited to 'progs/openvg/trivial/star-nonzero.c')
-rw-r--r--progs/openvg/trivial/star-nonzero.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/progs/openvg/trivial/star-nonzero.c b/progs/openvg/trivial/star-nonzero.c
new file mode 100644
index 0000000000..012fbd3929
--- /dev/null
+++ b/progs/openvg/trivial/star-nonzero.c
@@ -0,0 +1,55 @@
+#include "eglcommon.h"
+
+#include <VG/openvg.h>
+
+const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
+const VGfloat green_color[4] = {0.0, 1.0, 0.0, 0.8};
+
+VGPath path;
+VGPaint fill;
+
+
+static void
+init(void)
+{
+ static const VGubyte cmds[6] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
+ VG_LINE_TO_ABS, VG_CLOSE_PATH};
+ static const VGfloat coords[] = { 0, 200,
+ 300, 200,
+ 50, 0,
+ 150, 300,
+ 250, 0};
+ path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ vgAppendPathData(path, 6, cmds, coords);
+
+ fill = vgCreatePaint();
+ vgSetParameterfv(fill, VG_PAINT_COLOR, 4, green_color);
+ vgSetPaint(fill, VG_FILL_PATH);
+
+ vgSetfv(VG_CLEAR_COLOR, 4, white_color);
+ vgSeti(VG_FILL_RULE, VG_NON_ZERO);
+}
+
+/* new window size or exposure */
+static void
+reshape(int w, int h)
+{
+ vgLoadIdentity();
+}
+
+static void
+draw(void)
+{
+ vgClear(0, 0, window_width(), window_height());
+ vgDrawPath(path, VG_FILL_PATH | VG_STROKE_PATH);
+
+ vgFlush();
+}
+
+
+int main(int argc, char **argv)
+{
+ return run(argc, argv, init, reshape,
+ draw, 0);
+}