changeset 629:608f58b9b84d openvg

Use color transform and make compatible with OpenVG 1.0.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 17 Jul 2010 21:44:23 +0800
parents e50c4e111698
children bd18951b51d5
files src/graph_engine_openvg.c
diffstat 1 files changed, 11 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/graph_engine_openvg.c	Fri Jul 16 18:44:29 2010 +0800
+++ b/src/graph_engine_openvg.c	Sat Jul 17 21:44:23 2010 +0800
@@ -432,8 +432,6 @@
 	attrib_list[i++] = 8;
 	attrib_list[i++] = EGL_ALPHA_SIZE;
 	attrib_list[i++] = 8;
-	attrib_list[i++] = EGL_ALPHA_MASK_SIZE;
-	attrib_list[i++] = 8;
 	break;
 	
     case MB_IFMT_RGB24:
@@ -443,22 +441,16 @@
 	attrib_list[i++] = 8;
 	attrib_list[i++] = EGL_BLUE_SIZE;
 	attrib_list[i++] = 8;
-	attrib_list[i++] = EGL_ALPHA_MASK_SIZE;
-	attrib_list[i++] = 8;
 	break;
 	
     case MB_IFMT_A8:
 	attrib_list[i++] = EGL_ALPHA_SIZE;
 	attrib_list[i++] = 8;
-	attrib_list[i++] = EGL_ALPHA_MASK_SIZE;
-	attrib_list[i++] = 8;
 	break;
 	
     case MB_IFMT_A1:
 	attrib_list[i++] = EGL_ALPHA_SIZE;
 	attrib_list[i++] = 1;
-	attrib_list[i++] = EGL_ALPHA_MASK_SIZE;
-	attrib_list[i++] = 1;
 	break;
 	
     case MB_IFMT_RGB16_565:
@@ -468,8 +460,6 @@
 	attrib_list[i++] = 6;
 	attrib_list[i++] = EGL_BLUE_SIZE;
 	attrib_list[i++] = 5;
-	attrib_list[i++] = EGL_ALPHA_MASK_SIZE;
-	attrib_list[i++] = 5;
 	break;
 	
     default:
@@ -723,8 +713,8 @@
 
 void
 mbe_paint_with_alpha(mbe_t *canvas, co_comp_t alpha) {
+    VGfloat color_trans[8] = {1, 1, 1, alpha, 0, 0, 0, 0};
     EGLDisplay display;
-    VGHandle mask;
     EGLint w, h;
     EGLBoolean r;
     
@@ -736,18 +726,18 @@
     ASSERT(r == EGL_TRUE);
     r = eglQuerySurface(display, canvas->tgt, EGL_HEIGHT, &h);
     ASSERT(r == EGL_TRUE);
-    
-    /* enable and fill mask layer with alpha value */
-    vgSeti(VG_MASKING, VG_TRUE);
-    mask = vgCreateMaskLayer(w, h);
-    ASSERT(mask != VG_INVALID_HANDLE);
-    vgFillMaskLayer(mask, 0, 0, w, h, alpha);
-    vgMask(mask, VG_SET_MASK, 0, 0, w, h);
-    vgDestroyMaskLayer(mask);
-    
+
+    /* Setup color transform for alpha */
+#ifdef OPENVG_1_1
+    vgSetfv(VG_COLOR_TRANSFORM_VALUES, 8, color_trans);
+    vgSeti(VG_COLOR_TRANSFORM, VG_TRUE);
+#endif
+        
     mbe_paint(canvas);
 
-    vgSeti(VG_MASKING, VG_FALSE);
+#ifdef OPENVG_1_1
+    vgSeti(VG_COLOR_TRANSFORM, VG_FALSE);
+#endif
 }
 
 void