summaryrefslogtreecommitdiffstats
path: root/progs/egl/openvg/trivial/coord.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-04-01 14:20:24 +0800
committerChia-I Wu <[email protected]>2010-04-01 22:25:48 +0800
commitfc3ddd4b566380e7684c780450016e3e191a4160 (patch)
tree539e4eb39fb89a9ebb83116deef9c5d5ebc57e4d /progs/egl/openvg/trivial/coord.c
parent7f231cab2b7c13ba70d6aa694f74b6d6eee6470f (diff)
progs/openvg: Move OpenVG demos to a subdirectory of progs/egl.
That is, move progs/openvg/demos to progs/egl/openvg, progs/openvg/trivial to progs/egl/openvg/trivial.
Diffstat (limited to 'progs/egl/openvg/trivial/coord.c')
-rw-r--r--progs/egl/openvg/trivial/coord.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/progs/egl/openvg/trivial/coord.c b/progs/egl/openvg/trivial/coord.c
new file mode 100644
index 00000000000..81f7cb6fc9e
--- /dev/null
+++ b/progs/egl/openvg/trivial/coord.c
@@ -0,0 +1,66 @@
+#include "eglcommon.h"
+
+#include <VG/openvg.h>
+
+const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
+const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
+
+VGPath path;
+VGPaint fill;
+
+
+static void
+init(void)
+{
+ /* Absent VG_CLOSE_PATH */
+ VGubyte commands[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
+ VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS};
+ VGfloat clearColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */
+ VGfloat fillColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
+ VGfloat coords[] = {-16.0f, -16.0f, 0.0f, -16.0f, 0.0f, 0.0f, -16.0f, 0.0f,
+ 0.0f, 0.0f, 16.0f, 0.0f, 16.0f, 16.0f, 0.0f, 16.0f};
+
+ vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
+ vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgLoadIdentity();
+ vgTranslate(32.0f, 32.0f);
+
+ path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_ALL);
+ if (path == VG_INVALID_HANDLE)
+ return;
+ fill = vgCreatePaint();
+ if (fill == VG_INVALID_HANDLE) {
+ vgDestroyPath(path);
+ return;
+ }
+ vgAppendPathData(path, 8, commands, coords);
+ vgSetPaint(fill, VG_FILL_PATH);
+ vgSetParameterfv(fill, VG_PAINT_COLOR, 4, fillColor);
+ vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+}
+
+/* new window size or exposure */
+static void
+reshape(int w, int h)
+{
+}
+
+static void
+draw(void)
+{
+ vgClear(0, 0, window_width(), window_height());
+ vgDrawPath(path, VG_FILL_PATH);
+
+ vgFlush();
+}
+
+
+int main(int argc, char **argv)
+{
+ set_window_size(64, 64);
+ return run(argc, argv, init, reshape,
+ draw, 0);
+}