changeset 608:6c74bc371e37 openvg

paint with alpha for OpenVG
author Thinker K.F. Li <thinker@branda.to>
date Mon, 05 Jul 2010 10:56:23 +0800
parents 51dc49fd34a8
children 287db640078d
files include/mb_graph_engine_openvg.h src/graph_engine_openvg.c
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/include/mb_graph_engine_openvg.h	Sun Jul 04 21:09:56 2010 +0800
+++ b/include/mb_graph_engine_openvg.h	Mon Jul 05 10:56:23 2010 +0800
@@ -24,7 +24,6 @@
 #define mbe_scaled_font_create(face, fnt_mtx, ctm) ((mbe_scaled_font_t *)NULL)
 #define mbe_pattern_set_matrix(ptn, mtx)
 #define mbe_font_face_destroy(face)
-#define mbe_paint_with_alpha(canvas, alpha)
 #define mbe_set_scaled_font(canvas, scaled)
 #define mbe_pattern_destroy(pattern)
 #define mbe_get_scaled_font(canvas) ((mbe_scaled_font_t *)NULL)
@@ -210,6 +209,7 @@
 
 extern mbe_t *mbe_create(mbe_surface_t *surface);
 extern void mbe_destroy(mbe_t *canvas);
+extern void mbe_paint_with_alpha(mbe_t *canvas, co_comp_t alpha);
 extern void mbe_paint(mbe_t *canvas);
 extern void mbe_clear(mbe_t *canvas);
 
--- a/src/graph_engine_openvg.c	Sun Jul 04 21:09:56 2010 +0800
+++ b/src/graph_engine_openvg.c	Mon Jul 05 10:56:23 2010 +0800
@@ -446,6 +446,25 @@
     free(canvas);
 }
 
+/*
+ * This implementation support only paint with image paint.  OpenVG
+ * does not support paint path with an alpha value.  But, it supports
+ * to draw image with an alpha value.
+ */
+void
+mbe_paint_with_alpha(mbe_t *canvas, co_comp_t alpha) {
+    VGImage vg_img;
+    _ge_openvg_img_t *ge_img;
+    
+    _MK_CURRENT_CTX(canvas);
+
+    ASSERT(canvas->src != NULL && canvas->src->asso_img != NULL);
+    ge_img = canvas->src->asso_img;
+    vg_img = ge_img->img;
+
+    vgDrawImage(vg_img);
+}
+
 void
 mbe_paint(mbe_t *canvas) {
     EGLDisplay display;