132001f49Smrg#include "eglcommon.h"
232001f49Smrg
332001f49Smrg#include <VG/openvg.h>
432001f49Smrg
532001f49Smrg#include <math.h>
632001f49Smrg#include <stdlib.h>
732001f49Smrg#include <stdio.h>
832001f49Smrg
932001f49Smrgconst VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
1032001f49Smrgconst VGfloat color[4] = {1.0, 1.0, 1.0, 0.5};
1132001f49SmrgVGfloat clearColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
1232001f49SmrgVGImage parent;
1332001f49Smrg
1432001f49SmrgVGPaint fill;
1532001f49Smrg
1632001f49Smrgstatic void
1732001f49Smrginit(void)
1832001f49Smrg{
1932001f49Smrg    VGImage child1, child2;
2032001f49Smrg    VGubyte *data;
2132001f49Smrg    VGuint  LUT[256];
2232001f49Smrg    VGint i;
2332001f49Smrg
2432001f49Smrg    data = (VGubyte *)malloc(sizeof(VGubyte)*window_width()*window_height());
2532001f49Smrg
2632001f49Smrg    for (i=0;i<window_width()*window_height();i++) {
2732001f49Smrg        data[i] = 0x00;
2832001f49Smrg    }
2932001f49Smrg
3032001f49Smrg    for (i=0; i<256; i++) {
3132001f49Smrg        if ( i == 0 )
3232001f49Smrg            LUT[0] = 0xFFFFFFFF;
3332001f49Smrg        else
3432001f49Smrg            LUT[i] = 0xFF00FFFF;
3532001f49Smrg    }
3632001f49Smrg
3732001f49Smrg    parent = vgCreateImage( VG_A_8, 64, 64, VG_IMAGE_QUALITY_NONANTIALIASED );
3832001f49Smrg
3932001f49Smrg    vgImageSubData(parent, data, window_width(), VG_A_8, 0, 0,
4032001f49Smrg                   window_width(), window_height());
4132001f49Smrg    child1 = vgChildImage(parent, 0, 0, 32, 64);
4232001f49Smrg    child2 = vgChildImage(parent, 32, 0, 32, 64);
4332001f49Smrg
4432001f49Smrg    vgLookupSingle(child2, child1, LUT, VG_GREEN, VG_FALSE, VG_TRUE);
4532001f49Smrg}
4632001f49Smrg
4732001f49Smrg/* new window size or exposure */
4832001f49Smrgstatic void
4932001f49Smrgreshape(int w, int h)
5032001f49Smrg{
5132001f49Smrg}
5232001f49Smrg
5332001f49Smrgstatic void
5432001f49Smrgdraw(void)
5532001f49Smrg{
5632001f49Smrg   vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
5732001f49Smrg   vgClear(0, 0, window_width(), window_height());
5832001f49Smrg   //vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
5932001f49Smrg   //vgLoadIdentity();
6032001f49Smrg   //vgTranslate(10, 10);
6132001f49Smrg   vgDrawImage(parent);
6232001f49Smrg   vgFlush();
6332001f49Smrg}
6432001f49Smrg
6532001f49Smrg
6632001f49Smrgint main(int argc, char **argv)
6732001f49Smrg{
6832001f49Smrg   set_window_size(64, 64);
6932001f49Smrg   return run(argc, argv, init, reshape,
7032001f49Smrg              draw, 0);
7132001f49Smrg}
72