diff src/graph_engine_openvg.c @ 610:e78bff7d23d3 openvg

create pattern from surface for OpenVG
author Thinker K.F. Li <thinker@branda.to>
date Mon, 05 Jul 2010 14:29:26 +0800
parents 6c74bc371e37
children b1d1b6c5af90
line wrap: on
line diff
--- a/src/graph_engine_openvg.c	Mon Jul 05 13:15:17 2010 +0800
+++ b/src/graph_engine_openvg.c	Mon Jul 05 14:29:26 2010 +0800
@@ -13,6 +13,31 @@
 				   (((int)(0xf * b) & 0xf) << 16) |	\
 				   ((int)(0xf * a) & 0xf))
 
+/*
+ * This implementation supports only from image surface.
+ */
+mbe_pattern_t *
+mbe_pattern_create_for_surface(mbe_surface_t *surface) {
+    mbe_pattern_t *pattern;
+    _ge_openvg_img_t *ge_img;
+    VGPaint paint;
+
+    /* Support only from image surface */
+    if(surface->asso_img == NULL)
+	return NULL;
+
+    paint = vgCreatePaint();
+    if(paint == VG_INVALID_HANDLE)
+	return NULL;
+
+    ge_img = surface->asso_img;
+    pattern = O_ALLOC(mbe_pattern_t);
+    pattern->asso_img = ge_img;
+    pattern->paint = paint;
+
+    return pattern;
+}
+
 static mbe_pattern_t *
 _mbe_pattern_create_gradient(VGfloat *gradient, int grad_len,
 			     int grad_type,