1#include "eglcommon.h" 2 3#include <VG/openvg.h> 4 5#include <math.h> 6#include <stdlib.h> 7#include <stdio.h> 8 9const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0}; 10const VGfloat color[4] = {1.0, 1.0, 1.0, 0.5}; 11VGfloat clearColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */ 12VGImage parent; 13 14VGPaint fill; 15 16static void 17init(void) 18{ 19 VGImage child1, child2; 20 VGubyte *data; 21 VGuint LUT[256]; 22 VGint i; 23 24 data = (VGubyte *)malloc(sizeof(VGubyte)*window_width()*window_height()); 25 26 for (i=0;i<window_width()*window_height();i++) { 27 data[i] = 0x00; 28 } 29 30 for (i=0; i<256; i++) { 31 if ( i == 0 ) 32 LUT[0] = 0xFFFFFFFF; 33 else 34 LUT[i] = 0xFF00FFFF; 35 } 36 37 parent = vgCreateImage( VG_A_8, 64, 64, VG_IMAGE_QUALITY_NONANTIALIASED ); 38 39 vgImageSubData(parent, data, window_width(), VG_A_8, 0, 0, 40 window_width(), window_height()); 41 child1 = vgChildImage(parent, 0, 0, 32, 64); 42 child2 = vgChildImage(parent, 32, 0, 32, 64); 43 44 vgLookupSingle(child2, child1, LUT, VG_GREEN, VG_FALSE, VG_TRUE); 45} 46 47/* new window size or exposure */ 48static void 49reshape(int w, int h) 50{ 51} 52 53static void 54draw(void) 55{ 56 vgSetfv(VG_CLEAR_COLOR, 4, clearColor); 57 vgClear(0, 0, window_width(), window_height()); 58 //vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); 59 //vgLoadIdentity(); 60 //vgTranslate(10, 10); 61 vgDrawImage(parent); 62 vgFlush(); 63} 64 65 66int main(int argc, char **argv) 67{ 68 set_window_size(64, 64); 69 return run(argc, argv, init, reshape, 70 draw, 0); 71} 72