summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-09-06 17:41:52 +0900
committerHermet Park <hermetpark@gmail.com>2019-09-06 17:56:02 +0900
commit690dd5d33a39aec8537dbab3321a75e506b306de (patch)
tree0d4d160caf4b55ecadd3b3934da2546eaa0b2ade
parentae29408b86eaf8f6f324baff0312b336d56b1efc (diff)
ector: code refactoring.
Current vector drawing requires several methods for compositing, it's shouldnt have only masking but other blending functions such as matte in lottie, porter&duff in android, etc. Previously we didn't specify this method name, just reserved the options and now we started to define the methods with ector_renderer_composite_method() with Efl.Gfx.VG_Composite_Method instead of mask_set().
-rw-r--r--src/lib/ector/ector_renderer.c8
-rw-r--r--src/lib/ector/ector_renderer.eo8
-rw-r--r--src/lib/ector/software/ector_renderer_software_image.c28
-rw-r--r--src/lib/ector/software/ector_renderer_software_image.eo2
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.c32
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.eo2
-rw-r--r--src/lib/ector/software/ector_software_private.h8
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c137
-rw-r--r--src/lib/efl/interfaces/efl_gfx_types.eot11
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_container.c192
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_container.eo2
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c6
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c6
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_image.c6
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_node.c8
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_node.eo8
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_node_eo.legacy.c4
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c4
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_shape.c12
-rw-r--r--src/lib/evas/canvas/evas_vg_private.h28
-rw-r--r--src/static_libs/vg_common/vg_common_json.c39
21 files changed, 258 insertions, 293 deletions
diff --git a/src/lib/ector/ector_renderer.c b/src/lib/ector/ector_renderer.c
index d0efab6a6c..15bd96e627 100644
--- a/src/lib/ector/ector_renderer.c
+++ b/src/lib/ector/ector_renderer.c
@@ -146,10 +146,10 @@ _ector_renderer_crc_get(const Eo *obj EINA_UNUSED,
146} 146}
147 147
148static void 148static void
149_ector_renderer_mask_set(Eo *obj EINA_UNUSED, 149_ector_renderer_comp_method_set(Eo *obj EINA_UNUSED,
150 Ector_Renderer_Data *pd EINA_UNUSED, 150 Ector_Renderer_Data *pd EINA_UNUSED,
151 Ector_Buffer *mask EINA_UNUSED, 151 Ector_Buffer *comp EINA_UNUSED,
152 int op EINA_UNUSED) 152 Efl_Gfx_Vg_Composite_Method method EINA_UNUSED)
153{ 153{
154} 154}
155 155
diff --git a/src/lib/ector/ector_renderer.eo b/src/lib/ector/ector_renderer.eo
index 4d7279aebd..74d0f8bd43 100644
--- a/src/lib/ector/ector_renderer.eo
+++ b/src/lib/ector/ector_renderer.eo
@@ -78,13 +78,13 @@ abstract @beta Ector.Renderer extends Efl.Object
78 return: uint; [[CRC value]] 78 return: uint; [[CRC value]]
79 } 79 }
80 } 80 }
81 @property mask { 81 @property comp_method {
82 [[Set Mask Image to this Renderer]] 82 [[Set Composite Buffer to this Renderer]]
83 set { 83 set {
84 } 84 }
85 values { 85 values {
86 mask: Ector.Buffer; [[Mask Image Buffer]] 86 comp: Ector.Buffer; [[Composite Buffer]]
87 op: int; [[Masking option]] 87 method: Efl.Gfx.Vg_Composite_Method; [[Composite method]]
88 } 88 }
89 } 89 }
90 draw @pure_virtual { 90 draw @pure_virtual {
diff --git a/src/lib/ector/software/ector_renderer_software_image.c b/src/lib/ector/software/ector_renderer_software_image.c
index cb8d93ad6c..e06e79d574 100644
--- a/src/lib/ector/software/ector_renderer_software_image.c
+++ b/src/lib/ector/software/ector_renderer_software_image.c
@@ -21,10 +21,10 @@ struct _Ector_Renderer_Software_Image_Data
21 Ector_Software_Surface_Data *surface; 21 Ector_Software_Surface_Data *surface;
22 Ector_Renderer_Image_Data *image; 22 Ector_Renderer_Image_Data *image;
23 Ector_Renderer_Data *base; 23 Ector_Renderer_Data *base;
24 Ector_Buffer *mask; 24 Ector_Buffer *comp;
25 int mask_op; 25 Efl_Gfx_Vg_Composite_Method comp_method;
26 int opacity; 26 int opacity;
27 Eina_Matrix3 inv_m; 27 Eina_Matrix3 inv_m;
28 struct { 28 struct {
29 int x1, y1, x2, y2; 29 int x1, y1, x2, y2;
30 } boundary; 30 } boundary;
@@ -101,7 +101,7 @@ _ector_renderer_software_image_ector_renderer_draw(Eo *obj EINA_UNUSED,
101 return EINA_TRUE; 101 return EINA_TRUE;
102 102
103 const int pix_stride = pd->surface->rasterizer->fill_data.raster_buffer->stride / 4; 103 const int pix_stride = pd->surface->rasterizer->fill_data.raster_buffer->stride / 4;
104 Ector_Software_Buffer_Base_Data *mask = pd->mask ? efl_data_scope_get(pd->mask, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL; 104 Ector_Software_Buffer_Base_Data *comp = pd->comp ? efl_data_scope_get(pd->comp, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL;
105 Ector_Software_Buffer_Base_Data *bpd = efl_data_scope_get(pd->image->buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN); 105 Ector_Software_Buffer_Base_Data *bpd = efl_data_scope_get(pd->image->buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
106 double im11, im12, im21, im22, im31, im32; 106 double im11, im12, im21, im22, im31, im32;
107 uint32_t *dst_buf, *src_buf; 107 uint32_t *dst_buf, *src_buf;
@@ -128,10 +128,10 @@ _ector_renderer_software_image_ector_renderer_draw(Eo *obj EINA_UNUSED,
128 continue; 128 continue;
129 uint32_t *src = src_buf + (rx + (ry * image_w)); //FIXME: use to stride 129 uint32_t *src = src_buf + (rx + (ry * image_w)); //FIXME: use to stride
130 uint32_t temp = 0x0; 130 uint32_t temp = 0x0;
131 if (mask) 131 if (comp)
132 { 132 {
133 uint32_t *m = mask->pixels.u32 + ((int)local_x + ((int)local_y * mask->generic->w)); 133 uint32_t *m = comp->pixels.u32 + ((int)local_x + ((int)local_y * comp->generic->w));
134 //FIXME : This masking can work only matte case. 134 //FIXME : This comping can work only matte case.
135 // We need consider to inverse matte case. 135 // We need consider to inverse matte case.
136 temp = draw_mul_256((((*m)>>24) * pd->opacity)>>8, *src); 136 temp = draw_mul_256((((*m)>>24) * pd->opacity)>>8, *src);
137 } 137 }
@@ -182,13 +182,13 @@ _ector_renderer_software_image_ector_renderer_crc_get(const Eo *obj,
182} 182}
183 183
184static void 184static void
185_ector_renderer_software_image_ector_renderer_mask_set(Eo *obj EINA_UNUSED, 185_ector_renderer_software_image_ector_renderer_comp_method_set(Eo *obj EINA_UNUSED,
186 Ector_Renderer_Software_Image_Data *pd, 186 Ector_Renderer_Software_Image_Data *pd,
187 Ector_Buffer *mask, 187 Ector_Buffer *comp,
188 int op) 188 Efl_Gfx_Vg_Composite_Method method)
189{ 189{
190 pd->mask = mask; 190 pd->comp = comp;
191 pd->mask_op = op; 191 pd->comp_method = method;
192} 192}
193 193
194#include "ector_renderer_software_image.eo.c" 194#include "ector_renderer_software_image.eo.c"
diff --git a/src/lib/ector/software/ector_renderer_software_image.eo b/src/lib/ector/software/ector_renderer_software_image.eo
index 8a3f9c51e7..477170242b 100644
--- a/src/lib/ector/software/ector_renderer_software_image.eo
+++ b/src/lib/ector/software/ector_renderer_software_image.eo
@@ -5,7 +5,7 @@ class @beta Ector.Renderer.Software.Image extends Ector.Renderer.Software implem
5 implements { 5 implements {
6 Ector.Renderer.prepare; 6 Ector.Renderer.prepare;
7 Ector.Renderer.draw; 7 Ector.Renderer.draw;
8 Ector.Renderer.mask { set; } 8 Ector.Renderer.comp_method { set; }
9 Ector.Renderer.crc { get; } 9 Ector.Renderer.crc { get; }
10 Efl.Object.constructor; 10 Efl.Object.constructor;
11 Efl.Object.destructor; 11 Efl.Object.destructor;
diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c
index 6210179b03..601d03cf9f 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.c
+++ b/src/lib/ector/software/ector_renderer_software_shape.c
@@ -38,8 +38,8 @@ struct _Ector_Renderer_Software_Shape_Data
38 Shape_Rle_Data *shape_data; 38 Shape_Rle_Data *shape_data;
39 Shape_Rle_Data *outline_data; 39 Shape_Rle_Data *outline_data;
40 40
41 Ector_Buffer *mask; 41 Ector_Buffer *comp;
42 int mask_op; 42 Efl_Gfx_Vg_Composite_Method comp_method;
43 43
44 Ector_Software_Shape_Task *task; 44 Ector_Software_Shape_Task *task;
45 45
@@ -675,8 +675,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
675 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 675 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
676 x, y, mul_col, op, 676 x, y, mul_col, op,
677 pd->shape_data, 677 pd->shape_data,
678 pd->mask, 678 pd->comp,
679 pd->mask_op); 679 pd->comp_method);
680 } 680 }
681 else 681 else
682 { 682 {
@@ -690,8 +690,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
690 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 690 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
691 x, y, mul_col, op, 691 x, y, mul_col, op,
692 pd->shape_data, 692 pd->shape_data,
693 pd->mask, 693 pd->comp,
694 pd->mask_op); 694 pd->comp_method);
695 } 695 }
696 } 696 }
697 697
@@ -703,8 +703,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
703 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 703 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
704 x, y, mul_col, op, 704 x, y, mul_col, op,
705 pd->outline_data, 705 pd->outline_data,
706 pd->mask, 706 pd->comp,
707 pd->mask_op); 707 pd->comp_method);
708 } 708 }
709 else 709 else
710 { 710 {
@@ -718,8 +718,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
718 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 718 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
719 x, y, mul_col, op, 719 x, y, mul_col, op,
720 pd->outline_data, 720 pd->outline_data,
721 pd->mask, 721 pd->comp,
722 pd->mask_op); 722 pd->comp_method);
723 } 723 }
724 } 724 }
725 725
@@ -829,14 +829,14 @@ _ector_renderer_software_shape_ector_renderer_crc_get(const Eo *obj,
829} 829}
830 830
831static void 831static void
832_ector_renderer_software_shape_ector_renderer_mask_set(Eo *obj EINA_UNUSED, 832_ector_renderer_software_shape_ector_renderer_comp_method_set(Eo *obj EINA_UNUSED,
833 Ector_Renderer_Software_Shape_Data *pd, 833 Ector_Renderer_Software_Shape_Data *pd,
834 Ector_Buffer *mask, 834 Ector_Buffer *comp,
835 int op) 835 Efl_Gfx_Vg_Composite_Method method)
836{ 836{
837 //Use ref/unref. 837 //Use ref/unref.
838 pd->mask = mask; 838 pd->comp = comp;
839 pd->mask_op = op; 839 pd->comp_method = method;
840} 840}
841 841
842#include "ector_renderer_software_shape.eo.c" 842#include "ector_renderer_software_shape.eo.c"
diff --git a/src/lib/ector/software/ector_renderer_software_shape.eo b/src/lib/ector/software/ector_renderer_software_shape.eo
index 4ea56f9260..83b87c0121 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.eo
+++ b/src/lib/ector/software/ector_renderer_software_shape.eo
@@ -6,7 +6,7 @@ class @beta Ector.Renderer.Software.Shape extends Ector.Renderer.Software implem
6 Ector.Renderer.prepare; 6 Ector.Renderer.prepare;
7 Ector.Renderer.draw; 7 Ector.Renderer.draw;
8 Ector.Renderer.Software.op_fill; 8 Ector.Renderer.Software.op_fill;
9 Ector.Renderer.mask { set; } 9 Ector.Renderer.comp_method { set; }
10 Ector.Renderer.crc { get; } 10 Ector.Renderer.crc { get; }
11 Efl.Gfx.Path.commit; 11 Efl.Gfx.Path.commit;
12 Efl.Object.constructor; 12 Efl.Object.constructor;
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index f7e47fed22..24fe240f58 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -83,8 +83,8 @@ typedef struct _Span_Data
83 83
84 int offx, offy; 84 int offx, offy;
85 Clip_Data clip; 85 Clip_Data clip;
86 Ector_Software_Buffer_Base_Data *mask; 86 Ector_Software_Buffer_Base_Data *comp;
87 int mask_op; 87 Efl_Gfx_Vg_Composite_Method comp_method;
88 Eina_Matrix3 inv; 88 Eina_Matrix3 inv;
89 Span_Data_Type type; 89 Span_Data_Type type;
90 Eina_Bool fast_matrix; 90 Eina_Bool fast_matrix;
@@ -136,8 +136,8 @@ void ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
136 int x, int y, uint32_t mul_col, 136 int x, int y, uint32_t mul_col,
137 Efl_Gfx_Render_Op op, 137 Efl_Gfx_Render_Op op,
138 Shape_Rle_Data* rle, 138 Shape_Rle_Data* rle,
139 Ector_Buffer *mask, 139 Ector_Buffer *comp,
140 int mask_op); 140 Efl_Gfx_Vg_Composite_Method comp_method);
141 141
142void ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle); 142void ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle);
143 143
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index ad4aa25e70..8cd085432a 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -11,21 +11,6 @@
11 11
12#include "draw.h" 12#include "draw.h"
13 13
14//FIXME: This enum add temporarily to help understanding of additional code
15//related to masking in prepare_mask.
16//This needs to be formally declared through the eo class.
17typedef enum _EFL_CANVAS_VG_NODE_BLEND_TYPE
18{
19 EFL_CANVAS_VG_NODE_BLEND_TYPE_NONE = 0,
20 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA,
21 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV,
22 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD,
23 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT,
24 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT,
25 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE
26}EFL_CANVAS_VG_NODE_BLEND_TYPE;
27//
28
29static void 14static void
30_blend_argb(int count, const SW_FT_Span *spans, void *user_data) 15_blend_argb(int count, const SW_FT_Span *spans, void *user_data)
31{ 16{
@@ -49,12 +34,12 @@ _blend_argb(int count, const SW_FT_Span *spans, void *user_data)
49} 34}
50 35
51static void 36static void
52_blend_alpha(int count, const SW_FT_Span *spans, void *user_data) 37_comp_matte_alpha(int count, const SW_FT_Span *spans, void *user_data)
53{ 38{
54 Span_Data *sd = user_data; 39 Span_Data *sd = user_data;
55 const int pix_stride = sd->raster_buffer->stride / 4; 40 const int pix_stride = sd->raster_buffer->stride / 4;
56 Ector_Software_Buffer_Base_Data *mask = sd->mask; 41 Ector_Software_Buffer_Base_Data *comp = sd->comp;
57 if (!mask || !mask->pixels.u32) return; 42 if (!comp || !comp->pixels.u32) return;
58 43
59 // multiply the color with mul_col if any 44 // multiply the color with mul_col if any
60 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 45 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
@@ -63,7 +48,7 @@ _blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
63 // move to the offset location 48 // move to the offset location
64 uint32_t *buffer = 49 uint32_t *buffer =
65 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 50 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
66 uint32_t *mbuffer = mask->pixels.u32; 51 uint32_t *mbuffer = comp->pixels.u32;
67 52
68 //Temp buffer for intermediate processing 53 //Temp buffer for intermediate processing
69 int tsize = sd->raster_buffer->generic->w; 54 int tsize = sd->raster_buffer->generic->w;
@@ -73,12 +58,12 @@ _blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
73 { 58 {
74 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 59 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
75 uint32_t *mtarget = 60 uint32_t *mtarget =
76 mbuffer + ((mask->generic->w * spans->y) + spans->x); 61 mbuffer + ((comp->generic->w * spans->y) + spans->x);
77 uint32_t *temp = tbuffer; 62 uint32_t *temp = tbuffer;
78 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 63 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
79 comp_func(temp, spans->len, color, spans->coverage); 64 comp_func(temp, spans->len, color, spans->coverage);
80 65
81 //masking 66 //composite
82 for (int i = 0; i < spans->len; i++) 67 for (int i = 0; i < spans->len; i++)
83 { 68 {
84 *temp = draw_mul_256(((*mtarget)>>24), *temp); 69 *temp = draw_mul_256(((*mtarget)>>24), *temp);
@@ -93,12 +78,12 @@ _blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
93} 78}
94 79
95static void 80static void
96_blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data) 81_comp_matte_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
97{ 82{
98 Span_Data *sd = user_data; 83 Span_Data *sd = user_data;
99 const int pix_stride = sd->raster_buffer->stride / 4; 84 const int pix_stride = sd->raster_buffer->stride / 4;
100 Ector_Software_Buffer_Base_Data *mask = sd->mask; 85 Ector_Software_Buffer_Base_Data *comp = sd->comp;
101 if (!mask || !mask->pixels.u32) return; 86 if (!comp || !comp->pixels.u32) return;
102 87
103 // multiply the color with mul_col if any 88 // multiply the color with mul_col if any
104 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 89 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
@@ -107,7 +92,7 @@ _blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
107 // move to the offset location 92 // move to the offset location
108 uint32_t *buffer = 93 uint32_t *buffer =
109 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 94 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
110 uint32_t *mbuffer = mask->pixels.u32; 95 uint32_t *mbuffer = comp->pixels.u32;
111 96
112 //Temp buffer for intermediate processing 97 //Temp buffer for intermediate processing
113 int tsize = sd->raster_buffer->generic->w; 98 int tsize = sd->raster_buffer->generic->w;
@@ -117,12 +102,12 @@ _blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
117 { 102 {
118 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 103 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
119 uint32_t *mtarget = 104 uint32_t *mtarget =
120 mbuffer + ((mask->generic->w * spans->y) + spans->x); 105 mbuffer + ((comp->generic->w * spans->y) + spans->x);
121 uint32_t *temp = tbuffer; 106 uint32_t *temp = tbuffer;
122 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 107 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
123 comp_func(temp, spans->len, color, spans->coverage); 108 comp_func(temp, spans->len, color, spans->coverage);
124 109
125 //masking 110 //composite
126 for (int i = 0; i < spans->len; i++) 111 for (int i = 0; i < spans->len; i++)
127 { 112 {
128 if (*mtarget) 113 if (*mtarget)
@@ -138,22 +123,22 @@ _blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
138} 123}
139 124
140static void 125static void
141_blend_mask_add(int count, const SW_FT_Span *spans, void *user_data) 126_comp_mask_add(int count, const SW_FT_Span *spans, void *user_data)
142{ 127{
143 Span_Data *sd = user_data; 128 Span_Data *sd = user_data;
144 Ector_Software_Buffer_Base_Data *mask = sd->mask; 129 Ector_Software_Buffer_Base_Data *comp = sd->comp;
145 if (!mask || !mask->pixels.u32) return; 130 if (!comp || !comp->pixels.u32) return;
146 131
147 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 132 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
148 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 133 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
149 uint32_t *mbuffer = mask->pixels.u32; 134 uint32_t *mbuffer = comp->pixels.u32;
150 135
151 int tsize = sd->raster_buffer->generic->w; 136 int tsize = sd->raster_buffer->generic->w;
152 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 137 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
153 138
154 while (count--) 139 while (count--)
155 { 140 {
156 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 141 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
157 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 142 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
158 comp_func(ttarget, spans->len, color, spans->coverage); 143 comp_func(ttarget, spans->len, color, spans->coverage);
159 for (int i = 0; i < spans->len; i++) 144 for (int i = 0; i < spans->len; i++)
@@ -163,22 +148,22 @@ _blend_mask_add(int count, const SW_FT_Span *spans, void *user_data)
163} 148}
164 149
165static void 150static void
166_blend_mask_sub(int count, const SW_FT_Span *spans, void *user_data) 151_comp_mask_sub(int count, const SW_FT_Span *spans, void *user_data)
167{ 152{
168 Span_Data *sd = user_data; 153 Span_Data *sd = user_data;
169 Ector_Software_Buffer_Base_Data *mask = sd->mask; 154 Ector_Software_Buffer_Base_Data *comp = sd->comp;
170 if (!mask || !mask->pixels.u32) return; 155 if (!comp || !comp->pixels.u32) return;
171 156
172 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 157 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
173 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 158 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
174 uint32_t *mbuffer = mask->pixels.u32; 159 uint32_t *mbuffer = comp->pixels.u32;
175 160
176 int tsize = sd->raster_buffer->generic->w; 161 int tsize = sd->raster_buffer->generic->w;
177 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 162 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
178 163
179 while (count--) 164 while (count--)
180 { 165 {
181 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 166 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
182 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 167 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
183 comp_func(ttarget, spans->len, color, spans->coverage); 168 comp_func(ttarget, spans->len, color, spans->coverage);
184 for (int i = 0; i < spans->len; i++) 169 for (int i = 0; i < spans->len; i++)
@@ -189,28 +174,28 @@ _blend_mask_sub(int count, const SW_FT_Span *spans, void *user_data)
189 174
190 175
191static void 176static void
192_blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data) 177_comp_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
193{ 178{
194 Span_Data *sd = user_data; 179 Span_Data *sd = user_data;
195 Ector_Software_Buffer_Base_Data *mask = sd->mask; 180 Ector_Software_Buffer_Base_Data *comp = sd->comp;
196 if (!mask || !mask->pixels.u32) return; 181 if (!comp || !comp->pixels.u32) return;
197 182
198 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 183 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
199 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 184 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
200 uint32_t *mbuffer = mask->pixels.u32; 185 uint32_t *mbuffer = comp->pixels.u32;
201 186
202 int tsize = sd->raster_buffer->generic->w; 187 int tsize = sd->raster_buffer->generic->w;
203 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 188 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
204 189
205 for(unsigned int y = 0; y < mask->generic->h; y++) 190 for(unsigned int y = 0; y < comp->generic->h; y++)
206 { 191 {
207 for(unsigned int x = 0; x < mask->generic->w; x++) 192 for(unsigned int x = 0; x < comp->generic->w; x++)
208 { 193 {
209 if (x == (unsigned int)spans->x && x + spans->len <= mask->generic->w && 194 if (x == (unsigned int)spans->x && x + spans->len <= comp->generic->w &&
210 y == (unsigned int)spans->y && count > 0) 195 y == (unsigned int)spans->y && count > 0)
211 { 196 {
212 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 197 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
213 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 198 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
214 comp_func(ttarget, spans->len, color, spans->coverage); 199 comp_func(ttarget, spans->len, color, spans->coverage);
215 for (int c = 0; c < spans->len; c++) 200 for (int c = 0; c < spans->len; c++)
216 mtarget[c] = draw_mul_256(ttarget[c]>>24, mtarget[c]); 201 mtarget[c] = draw_mul_256(ttarget[c]>>24, mtarget[c]);
@@ -220,7 +205,7 @@ _blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
220 } 205 }
221 else 206 else
222 { 207 {
223 mbuffer[x + (mask->generic->w * y)] = (0x00FFFFFF & mbuffer[x + (mask->generic->w * y)]); 208 mbuffer[x + (comp->generic->w * y)] = (0x00FFFFFF & mbuffer[x + (comp->generic->w * y)]);
224 } 209 }
225 } 210 }
226 } 211 }
@@ -228,15 +213,15 @@ _blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
228 213
229 214
230static void 215static void
231_blend_mask_diff(int count, const SW_FT_Span *spans, void *user_data) 216_comp_mask_diff(int count, const SW_FT_Span *spans, void *user_data)
232{ 217{
233 Span_Data *sd = user_data; 218 Span_Data *sd = user_data;
234 Ector_Software_Buffer_Base_Data *mask = sd->mask; 219 Ector_Software_Buffer_Base_Data *comp = sd->comp;
235 if (!mask || !mask->pixels.u32) return; 220 if (!comp || !comp->pixels.u32) return;
236 221
237 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 222 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
238 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 223 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
239 uint32_t *mbuffer = mask->pixels.u32; 224 uint32_t *mbuffer = comp->pixels.u32;
240 225
241 int tsize = sd->raster_buffer->generic->w; 226 int tsize = sd->raster_buffer->generic->w;
242 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 227 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
@@ -244,7 +229,7 @@ _blend_mask_diff(int count, const SW_FT_Span *spans, void *user_data)
244 while (count--) 229 while (count--)
245 { 230 {
246 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 231 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
247 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 232 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
248 comp_func(ttarget, spans->len, color, spans->coverage); 233 comp_func(ttarget, spans->len, color, spans->coverage);
249 for (int i = 0; i < spans->len; i++) 234 for (int i = 0; i < spans->len; i++)
250 mtarget[i] = draw_mul_256(0xFF - (mtarget[i]>>24), ttarget[i]) + draw_mul_256(0xFF - (ttarget[i]>>24), mtarget[i]); 235 mtarget[i] = draw_mul_256(0xFF - (mtarget[i]>>24), ttarget[i]) + draw_mul_256(0xFF - (ttarget[i]>>24), mtarget[i]);
@@ -309,8 +294,8 @@ _blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
309 294
310 if (!fetchfunc) return; 295 if (!fetchfunc) return;
311 296
312 Ector_Software_Buffer_Base_Data *mask = sd->mask; 297 Ector_Software_Buffer_Base_Data *comp = sd->comp;
313 uint32_t *mbuffer = mask->pixels.u32; 298 uint32_t *mbuffer = comp->pixels.u32;
314 299
315 // move to the offset location 300 // move to the offset location
316 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 301 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
@@ -318,7 +303,7 @@ _blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
318 while (count--) 303 while (count--)
319 { 304 {
320 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 305 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
321 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 306 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
322 int length = spans->len; 307 int length = spans->len;
323 308
324 while (length) 309 while (length)
@@ -358,8 +343,8 @@ _blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
358 343
359 if (!fetchfunc) return; 344 if (!fetchfunc) return;
360 345
361 Ector_Software_Buffer_Base_Data *mask = sd->mask; 346 Ector_Software_Buffer_Base_Data *comp = sd->comp;
362 uint32_t *mbuffer = mask->pixels.u32; 347 uint32_t *mbuffer = comp->pixels.u32;
363 348
364 // move to the offset location 349 // move to the offset location
365 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 350 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
@@ -367,7 +352,7 @@ _blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
367 while (count--) 352 while (count--)
368 { 353 {
369 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 354 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
370 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 355 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
371 int length = spans->len; 356 int length = spans->len;
372 357
373 while (length) 358 while (length)
@@ -584,38 +569,38 @@ static void
584_adjust_span_fill_methods(Span_Data *spdata) 569_adjust_span_fill_methods(Span_Data *spdata)
585{ 570{
586 //Blending Function 571 //Blending Function
587 if (spdata->mask) 572 if (spdata->comp)
588 { 573 {
589 switch (spdata->mask_op) 574 switch (spdata->comp_method)
590 { 575 {
591 default: 576 default:
592 case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA: 577 case EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA:
593 if (spdata->type == Solid) 578 if (spdata->type == Solid)
594 spdata->unclipped_blend = &_blend_alpha; 579 spdata->unclipped_blend = &_comp_matte_alpha;
595 else if (spdata->type == LinearGradient || spdata->type == RadialGradient) 580 else if (spdata->type == LinearGradient || spdata->type == RadialGradient)
596 spdata->unclipped_blend = &_blend_gradient_alpha; 581 spdata->unclipped_blend = &_blend_gradient_alpha;
597 else //None 582 else //None
598 spdata->unclipped_blend = NULL; 583 spdata->unclipped_blend = NULL;
599 break; 584 break;
600 case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV: 585 case EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE:
601 if (spdata->type == Solid) 586 if (spdata->type == Solid)
602 spdata->unclipped_blend = &_blend_alpha_inv; 587 spdata->unclipped_blend = &_comp_matte_alpha_inv;
603 else if (spdata->type == LinearGradient || spdata->type == RadialGradient) 588 else if (spdata->type == LinearGradient || spdata->type == RadialGradient)
604 spdata->unclipped_blend = &_blend_gradient_alpha_inv; 589 spdata->unclipped_blend = &_blend_gradient_alpha_inv;
605 else //None 590 else //None
606 spdata->unclipped_blend = NULL; 591 spdata->unclipped_blend = NULL;
607 break; 592 break;
608 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD: 593 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_ADD:
609 spdata->unclipped_blend = &_blend_mask_add; 594 spdata->unclipped_blend = &_comp_mask_add;
610 break; 595 break;
611 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT: 596 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_SUBSTRACT:
612 spdata->unclipped_blend = &_blend_mask_sub; 597 spdata->unclipped_blend = &_comp_mask_sub;
613 break; 598 break;
614 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT: 599 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT:
615 spdata->unclipped_blend = &_blend_mask_ins; 600 spdata->unclipped_blend = &_comp_mask_ins;
616 break; 601 break;
617 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE: 602 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_DIFFERENCE:
618 spdata->unclipped_blend = &_blend_mask_diff; 603 spdata->unclipped_blend = &_comp_mask_diff;
619 break; 604 break;
620 } 605 }
621 } 606 }
@@ -895,8 +880,8 @@ void
895ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer, 880ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
896 int x, int y, uint32_t mul_col, 881 int x, int y, uint32_t mul_col,
897 Efl_Gfx_Render_Op op, Shape_Rle_Data* rle, 882 Efl_Gfx_Render_Op op, Shape_Rle_Data* rle,
898 Ector_Buffer *mask, 883 Ector_Buffer *comp,
899 int mask_op) 884 Efl_Gfx_Vg_Composite_Method comp_method)
900{ 885{
901 if (!rle) return; 886 if (!rle) return;
902 if (!rasterizer->fill_data.raster_buffer->pixels.u32) return; 887 if (!rasterizer->fill_data.raster_buffer->pixels.u32) return;
@@ -905,9 +890,9 @@ ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
905 rasterizer->fill_data.offy = y; 890 rasterizer->fill_data.offy = y;
906 rasterizer->fill_data.mul_col = mul_col; 891 rasterizer->fill_data.mul_col = mul_col;
907 rasterizer->fill_data.op = op; 892 rasterizer->fill_data.op = op;
908 rasterizer->fill_data.mask = 893 rasterizer->fill_data.comp =
909 mask ? efl_data_scope_get(mask, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL; 894 comp ? efl_data_scope_get(comp, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL;
910 rasterizer->fill_data.mask_op = mask_op; 895 rasterizer->fill_data.comp_method = comp_method;
911 896
912 _setup_span_fill_matrix(rasterizer); 897 _setup_span_fill_matrix(rasterizer);
913 _adjust_span_fill_methods(&rasterizer->fill_data); 898 _adjust_span_fill_methods(&rasterizer->fill_data);
diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot
index 0f2954b954..ecc0588b1d 100644
--- a/src/lib/efl/interfaces/efl_gfx_types.eot
+++ b/src/lib/efl/interfaces/efl_gfx_types.eot
@@ -141,6 +141,17 @@ struct @beta Efl.Gfx.Shape_Public
141 stroke: Efl.Gfx.Stroke; [[Internal representation as stroke]] 141 stroke: Efl.Gfx.Stroke; [[Internal representation as stroke]]
142} 142}
143 143
144enum @beta Efl.Gfx.Vg_Composite_Method
145{
146 none,
147 matte_alpha,
148 matte_alpha_inverse,
149 mask_add,
150 mask_substract,
151 mask_intersect,
152 mask_difference
153}
154
144enum @beta Efl.Gfx.Border_Fill_Mode 155enum @beta Efl.Gfx.Border_Fill_Mode
145{ 156{
146 [[How an image's center region (the complement to the border region) should be rendered by EFL]] 157 [[How an image's center region (the complement to the border region) should be rendered by EFL]]
diff --git a/src/lib/evas/canvas/efl_canvas_vg_container.c b/src/lib/evas/canvas/efl_canvas_vg_container.c
index 2daa65fb80..e265e33e11 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_container.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_container.c
@@ -5,23 +5,6 @@
5 5
6#define MY_CLASS EFL_CANVAS_VG_CONTAINER_CLASS 6#define MY_CLASS EFL_CANVAS_VG_CONTAINER_CLASS
7 7
8
9//FIXME: This enum add temporarily to help understanding of additional code
10//related to masking in prepare_mask.
11//This needs to be formally declared through the eo class.
12//This is a list of blending supported via efl_canvas_vg_node_mask_set().
13typedef enum _EFL_CANVAS_VG_NODE_BLEND_TYPE
14{
15 EFL_CANVAS_VG_NODE_BLEND_TYPE_NONE = 0,
16 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA,
17 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV,
18 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD,
19 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT,
20 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT,
21 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE
22}EFL_CANVAS_VG_NODE_BLEND_TYPE;
23//
24
25static void 8static void
26_invalidate_cb(void *data EINA_UNUSED, const Efl_Event *event) 9_invalidate_cb(void *data EINA_UNUSED, const Efl_Event *event)
27{ 10{
@@ -40,7 +23,7 @@ _invalidate_cb(void *data EINA_UNUSED, const Efl_Event *event)
40} 23}
41 24
42static void 25static void
43_draw_mask(Evas_Object_Protected_Data *obj, Efl_VG *node, 26_draw_comp(Evas_Object_Protected_Data *obj, Efl_VG *node,
44 Ector_Surface *ector, void *engine, void *output, 27 Ector_Surface *ector, void *engine, void *output,
45 void *context) 28 void *context)
46{ 29{
@@ -51,11 +34,11 @@ _draw_mask(Evas_Object_Protected_Data *obj, Efl_VG *node,
51 Efl_Canvas_Vg_Container_Data *cd = 34 Efl_Canvas_Vg_Container_Data *cd =
52 efl_data_scope_get(node, EFL_CANVAS_VG_CONTAINER_CLASS); 35 efl_data_scope_get(node, EFL_CANVAS_VG_CONTAINER_CLASS);
53 36
54 //Draw Mask Image. 37 //Draw Composite Image.
55 Efl_VG *child; 38 Efl_VG *child;
56 Eina_List *l; 39 Eina_List *l;
57 EINA_LIST_FOREACH(cd->children, l, child) 40 EINA_LIST_FOREACH(cd->children, l, child)
58 _draw_mask(obj, child, ector, engine, output, context); 41 _draw_comp(obj, child, ector, engine, output, context);
59 } 42 }
60 else 43 else
61 { 44 {
@@ -65,93 +48,94 @@ _draw_mask(Evas_Object_Protected_Data *obj, Efl_VG *node,
65} 48}
66 49
67static Ector_Buffer * 50static Ector_Buffer *
68_prepare_mask(Evas_Object_Protected_Data *obj, //vector object 51_prepare_comp(Evas_Object_Protected_Data *obj, //vector object
69 Efl_Canvas_Vg_Node* mask_obj, 52 Efl_Canvas_Vg_Node* comp_target,
70 void *engine, void *output, void *context, 53 void *engine, void *output, void *context,
71 Ector_Surface *surface, 54 Ector_Surface *surface,
72 Eina_Matrix3 *ptransform, 55 Eina_Matrix3 *ptransform,
73 Eina_Matrix3 *ctransform, 56 Eina_Matrix3 *ctransform,
74 Ector_Buffer *mask, 57 Ector_Buffer *comp,
75 int mask_op) 58 Efl_Gfx_Vg_Composite_Method comp_method)
76{ 59{
77 Efl_Canvas_Vg_Container_Data *pd = efl_data_scope_get(mask_obj, MY_CLASS); 60 Efl_Canvas_Vg_Container_Data *pd = efl_data_scope_get(comp_target, MY_CLASS);
78 Efl_Canvas_Vg_Node_Data *nd = 61 Efl_Canvas_Vg_Node_Data *nd =
79 efl_data_scope_get(mask_obj, EFL_CANVAS_VG_NODE_CLASS); 62 efl_data_scope_get(comp_target, EFL_CANVAS_VG_NODE_CLASS);
80 if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return pd->mask.buffer; 63 if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return pd->comp.buffer;
81 uint32_t init_buffer = 0x0; 64 uint32_t init_buffer = 0x0;
82 65
83 //1. Mask Size 66 //1. Composite Size
84 Eina_Rect mbound; 67 Eina_Rect mbound;
85 mbound.x = 0; 68 mbound.x = 0;
86 mbound.y = 0; 69 mbound.y = 0;
87 mbound.w = obj->cur->geometry.w; 70 mbound.w = obj->cur->geometry.w;
88 mbound.h = obj->cur->geometry.h; 71 mbound.h = obj->cur->geometry.h;
89 72
90 //FIXME: If mask typs is SUBSTRACT or INTERSECT, buffer fills in white color(Full alpha color). 73 //FIXME: If composite method is SUBSTRACT or INTERSECT, buffer fills in white color(Full alpha color).
91 if (pd->mask.option == EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT || pd->mask.option == EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT) 74 if (pd->comp.method == EFL_GFX_VG_COMPOSITE_METHOD_MASK_SUBSTRACT ||
75 pd->comp.method == EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT)
92 init_buffer = 0xFFFFFFFF; 76 init_buffer = 0xFFFFFFFF;
93 77
94 //2. Reusable ector buffer? 78 //2. Reusable ector buffer?
95 if (!pd->mask.buffer || (pd->mask.bound.w != mbound.w) || 79 if (!pd->comp.buffer || (pd->comp.bound.w != mbound.w) ||
96 (pd->mask.bound.h != mbound.h)) 80 (pd->comp.bound.h != mbound.h))
97 { 81 {
98 if (pd->mask.pixels) free(pd->mask.pixels); 82 if (pd->comp.pixels) free(pd->comp.pixels);
99 if (pd->mask.buffer) efl_unref(pd->mask.buffer); 83 if (pd->comp.buffer) efl_unref(pd->comp.buffer);
100 pd->mask.pixels = malloc(sizeof(uint32_t) * (mbound.w * mbound.h)); 84 pd->comp.pixels = malloc(sizeof(uint32_t) * (mbound.w * mbound.h));
101 memset(pd->mask.pixels, init_buffer, sizeof(uint32_t) * (mbound.w * mbound.h)); 85 memset(pd->comp.pixels, init_buffer, sizeof(uint32_t) * (mbound.w * mbound.h));
102 pd->mask.buffer = ENFN->ector_buffer_new(ENC, obj->layer->evas->evas, 86 pd->comp.buffer = ENFN->ector_buffer_new(ENC, obj->layer->evas->evas,
103 mbound.w, mbound.h, 87 mbound.w, mbound.h,
104 EFL_GFX_COLORSPACE_ARGB8888, 88 EFL_GFX_COLORSPACE_ARGB8888,
105 ECTOR_BUFFER_FLAG_DRAWABLE | 89 ECTOR_BUFFER_FLAG_DRAWABLE |
106 ECTOR_BUFFER_FLAG_CPU_READABLE | 90 ECTOR_BUFFER_FLAG_CPU_READABLE |
107 ECTOR_BUFFER_FLAG_CPU_WRITABLE); 91 ECTOR_BUFFER_FLAG_CPU_WRITABLE);
108 ector_buffer_pixels_set(pd->mask.buffer, pd->mask.pixels, 92 ector_buffer_pixels_set(pd->comp.buffer, pd->comp.pixels,
109 mbound.w, mbound.h, 0, 93 mbound.w, mbound.h, 0,
110 EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 94 EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
111 pd->mask.bound.w = mbound.w; 95 pd->comp.bound.w = mbound.w;
112 pd->mask.bound.h = mbound.h; 96 pd->comp.bound.h = mbound.h;
113 pd->mask.vg_pd = obj; 97 pd->comp.vg_pd = obj;
114 } 98 }
115 else 99 else
116 { 100 {
117 if (pd->mask.pixels) 101 if (pd->comp.pixels)
118 memset(pd->mask.pixels, init_buffer, sizeof(uint32_t) * mbound.w * mbound.h); 102 memset(pd->comp.pixels, init_buffer, sizeof(uint32_t) * mbound.w * mbound.h);
119 } 103 }
120 104
121 pd->mask.bound.x = mbound.x; 105 pd->comp.bound.x = mbound.x;
122 pd->mask.bound.y = mbound.y; 106 pd->comp.bound.y = mbound.y;
123 107
124 if (!pd->mask.buffer) ERR("Mask Buffer is invalid"); 108 if (!pd->comp.buffer) ERR("Composite Buffer is invalid");
125 109
126 //FIXME: This code means that there is another masking container. 110 //FIXME: This code means that there is another composite container.
127 if (pd->mask.option >= EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD) 111 if (pd->comp.method >= EFL_GFX_VG_COMPOSITE_METHOD_MASK_ADD)
128 { 112 {
129 Efl_Canvas_Vg_Container_Data *src_pd = pd; 113 Efl_Canvas_Vg_Container_Data *target_pd = pd;
130 mask = pd->mask.buffer; 114 comp = pd->comp.buffer;
131 for (Efl_VG *mask_src = pd->mask_src; mask_src; mask_src = src_pd->mask_src) 115 for (Efl_VG *comp_target = pd->comp_target; comp_target; comp_target = target_pd->comp_target)
132 { 116 {
133 Efl_Canvas_Vg_Container_Data *target_pd = NULL; 117 Efl_Canvas_Vg_Container_Data *src_pd = NULL;
134 src_pd = efl_data_scope_get(mask_src, MY_CLASS); 118 target_pd = efl_data_scope_get(comp_target, MY_CLASS);
135 target_pd = efl_data_scope_get(eina_list_nth(src_pd->mask.target, 0), MY_CLASS); 119 src_pd = efl_data_scope_get(eina_list_nth(target_pd->comp.src, 0), MY_CLASS);
136 _evas_vg_render_pre(obj, mask_src, 120 _evas_vg_render_pre(obj, comp_target,
137 engine, output, context, surface, 121 engine, output, context, surface,
138 ctransform, mask, target_pd->mask.option); 122 ctransform, comp, src_pd->comp.method);
139 } 123 }
140 } 124 }
141 125
142 //3. Prepare Drawing shapes. 126 //3. Prepare Drawing shapes.
143 _evas_vg_render_pre(obj, mask_obj, 127 _evas_vg_render_pre(obj, comp_target,
144 engine, output, context, 128 engine, output, context,
145 surface, 129 surface,
146 ptransform, mask, mask_op); 130 ptransform, comp, comp_method);
147 131
148 //4. Generating Mask Image. 132 //4. Generating Composite Image.
149 ector_buffer_pixels_set(surface, pd->mask.pixels, mbound.w, mbound.h, 0, 133 ector_buffer_pixels_set(surface, pd->comp.pixels, mbound.w, mbound.h, 0,
150 EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 134 EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
151 ector_surface_reference_point_set(surface, -mbound.x, -mbound.y); 135 ector_surface_reference_point_set(surface, -mbound.x, -mbound.y);
152 _draw_mask(obj, mask_obj, surface, engine, output, context); 136 _draw_comp(obj, comp_target, surface, engine, output, context);
153 137
154 return pd->mask.buffer; 138 return pd->comp.buffer;
155} 139}
156 140
157static void 141static void
@@ -161,8 +145,8 @@ _efl_canvas_vg_container_render_pre(Evas_Object_Protected_Data *vg_pd,
161 void *engine, void *output, void *context, 145 void *engine, void *output, void *context,
162 Ector_Surface *surface, 146 Ector_Surface *surface,
163 Eina_Matrix3 *ptransform, 147 Eina_Matrix3 *ptransform,
164 Ector_Buffer *mask, 148 Ector_Buffer *comp,
165 int mask_op, 149 Efl_Gfx_Vg_Composite_Method comp_method,
166 void *data) 150 void *data)
167{ 151{
168 Efl_Canvas_Vg_Container_Data *pd = data; 152 Efl_Canvas_Vg_Container_Data *pd = data;
@@ -177,27 +161,27 @@ _efl_canvas_vg_container_render_pre(Evas_Object_Protected_Data *vg_pd,
177 161
178 EFL_CANVAS_VG_COMPUTE_MATRIX(ctransform, ptransform, nd); 162 EFL_CANVAS_VG_COMPUTE_MATRIX(ctransform, ptransform, nd);
179 163
180 //Container may have mask source. 164 //Container may have composite target.
181 //FIXME : _prepare_mask() should only work in cases with matte or main mask. 165 //FIXME : _prepare_comp() should only work in cases with matte or masking.
182 // This condition is valid because the main mask use same type as matte alpha. 166 // This condition is valid because the masking use same type as matte.
183 if (pd->mask_src && 167 if (pd->comp_target &&
184 (pd->mask.option == EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA || 168 (pd->comp.method == EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA ||
185 pd->mask.option == EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV)) 169 pd->comp.method == EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE))
186 { 170 {
187 mask_op = pd->mask.option; 171 comp_method = pd->comp.method;
188 mask = _prepare_mask(vg_pd, pd->mask_src, 172 comp = _prepare_comp(vg_pd, pd->comp_target,
189 engine, output, context, surface, 173 engine, output, context, surface,
190 ptransform, ctransform, mask, mask_op); 174 ptransform, ctransform, comp, comp_method);
191 } 175 }
192 176
193 EINA_LIST_FOREACH(pd->children, l, child) 177 EINA_LIST_FOREACH(pd->children, l, child)
194 { 178 {
195 //Don't need to update mask nodes. 179 //Don't need to update composite nodes.
196 if (efl_isa(child, MY_CLASS)) 180 if (efl_isa(child, MY_CLASS))
197 { 181 {
198 Efl_Canvas_Vg_Container_Data *child_cd = 182 Efl_Canvas_Vg_Container_Data *child_cd =
199 efl_data_scope_get(child, MY_CLASS); 183 efl_data_scope_get(child, MY_CLASS);
200 if (child_cd->mask.target) continue; 184 if (child_cd->comp.src) continue;
201 } 185 }
202 186
203 //Skip Gradients. they will be updated by Shape. 187 //Skip Gradients. they will be updated by Shape.
@@ -212,7 +196,7 @@ _efl_canvas_vg_container_render_pre(Evas_Object_Protected_Data *vg_pd,
212 196
213 _evas_vg_render_pre(vg_pd, child, 197 _evas_vg_render_pre(vg_pd, child,
214 engine, output, context, surface, 198 engine, output, context, surface,
215 ctransform, mask, mask_op); 199 ctransform, comp, comp_method);
216 } 200 }
217} 201}
218 202
@@ -243,12 +227,12 @@ _efl_canvas_vg_container_efl_object_destructor(Eo *obj,
243 if (pd->blend_pixels) free(pd->blend_pixels); 227 if (pd->blend_pixels) free(pd->blend_pixels);
244 if (pd->blend_buffer) efl_unref(pd->blend_buffer); 228 if (pd->blend_buffer) efl_unref(pd->blend_buffer);
245 229
246 //Destroy mask surface 230 //Destroy comp surface
247 if (pd->mask.buffer) efl_unref(pd->mask.buffer); 231 if (pd->comp.buffer) efl_unref(pd->comp.buffer);
248 if (pd->mask.pixels) free(pd->mask.pixels); 232 if (pd->comp.pixels) free(pd->comp.pixels);
249 233
250 efl_unref(pd->mask_src); 234 efl_unref(pd->comp_target);
251 eina_list_free(pd->mask.target); 235 eina_list_free(pd->comp.src);
252 eina_hash_free(pd->names); 236 eina_hash_free(pd->names);
253 237
254 efl_destructor(efl_super(obj, MY_CLASS)); 238 efl_destructor(efl_super(obj, MY_CLASS));
@@ -333,14 +317,14 @@ _efl_canvas_vg_container_efl_gfx_path_interpolate(Eo *obj, Efl_Canvas_Vg_Contain
333 if (!r) break; 317 if (!r) break;
334 } 318 }
335 319
336 //Interpolates Mask 320 //Interpolates Composite
337 Efl_Canvas_Vg_Container_Data *fromd = efl_data_scope_get(from, MY_CLASS); 321 Efl_Canvas_Vg_Container_Data *fromd = efl_data_scope_get(from, MY_CLASS);
338 Efl_Canvas_Vg_Container_Data *tod = efl_data_scope_get(to, MY_CLASS); 322 Efl_Canvas_Vg_Container_Data *tod = efl_data_scope_get(to, MY_CLASS);
339 323
340 if (fromd->mask_src && tod->mask_src && pd->mask_src) 324 if (fromd->comp_target && tod->comp_target && pd->comp_target)
341 { 325 {
342 if (!efl_gfx_path_interpolate(pd->mask_src, 326 if (!efl_gfx_path_interpolate(pd->comp_target,
343 fromd->mask_src, tod->mask_src, pos_map)) 327 fromd->comp_target, tod->comp_target, pos_map))
344 return EINA_FALSE; 328 return EINA_FALSE;
345 } 329 }
346 330
@@ -351,30 +335,30 @@ _efl_canvas_vg_container_efl_gfx_path_interpolate(Eo *obj, Efl_Canvas_Vg_Contain
351} 335}
352 336
353static void 337static void
354_efl_canvas_vg_container_efl_canvas_vg_node_mask_set(Eo *obj, 338_efl_canvas_vg_container_efl_canvas_vg_node_comp_method_set(Eo *obj,
355 Efl_Canvas_Vg_Container_Data *pd, 339 Efl_Canvas_Vg_Container_Data *pd,
356 Efl_Canvas_Vg_Node *mask, 340 Efl_Canvas_Vg_Node *target,
357 int op) 341 Efl_Gfx_Vg_Composite_Method method)
358{ 342{
359 if (pd->mask_src == mask) return; 343 if (pd->comp_target == target) return;
360 344
361 EINA_SAFETY_ON_FALSE_RETURN(efl_isa(mask, MY_CLASS)); 345 EINA_SAFETY_ON_FALSE_RETURN(efl_isa(target, MY_CLASS));
362 346
363 if (pd->mask_src) 347 if (pd->comp_target)
364 { 348 {
365 Efl_Canvas_Vg_Container_Data *pd2 = 349 Efl_Canvas_Vg_Container_Data *pd2 =
366 efl_data_scope_get(pd->mask_src, MY_CLASS); 350 efl_data_scope_get(pd->comp_target, MY_CLASS);
367 pd2->mask.target = eina_list_remove(pd2->mask.target, obj); 351 pd2->comp.src = eina_list_remove(pd2->comp.src, obj);
368 } 352 }
369 353
370 if (mask) 354 if (target)
371 { 355 {
372 Efl_Canvas_Vg_Container_Data *pd2 = efl_data_scope_get(mask, MY_CLASS); 356 Efl_Canvas_Vg_Container_Data *pd2 = efl_data_scope_get(target, MY_CLASS);
373 pd2->mask.target = eina_list_append(pd2->mask.target, obj); 357 pd2->comp.src = eina_list_append(pd2->comp.src, obj);
374 } 358 }
375 359
376 pd->mask.option = op; 360 pd->comp.method = method;
377 efl_replace(&pd->mask_src, mask); 361 efl_replace(&pd->comp_target, target);
378 efl_canvas_vg_node_change(obj); 362 efl_canvas_vg_node_change(obj);
379} 363}
380 364
@@ -400,12 +384,12 @@ _efl_canvas_vg_container_efl_duplicate_duplicate(const Eo *obj,
400 container = efl_duplicate(efl_super(obj, MY_CLASS)); 384 container = efl_duplicate(efl_super(obj, MY_CLASS));
401 efl_event_callback_add(container, EFL_EVENT_INVALIDATE, _invalidate_cb, NULL); 385 efl_event_callback_add(container, EFL_EVENT_INVALIDATE, _invalidate_cb, NULL);
402 386
403 //Copy Mask 387 //Copy Composite
404 if (pd->mask_src) 388 if (pd->comp_target)
405 { 389 {
406 Eo * mask_src = efl_duplicate(pd->mask_src); 390 Eo * comp_target = efl_duplicate(pd->comp_target);
407 efl_parent_set(mask_src, container); 391 efl_parent_set(comp_target, container);
408 efl_canvas_vg_node_mask_set(container, mask_src, pd->mask.option); 392 efl_canvas_vg_node_comp_method_set(container, comp_target, pd->comp.method);
409 } 393 }
410 394
411 //Copy Children 395 //Copy Children
diff --git a/src/lib/evas/canvas/efl_canvas_vg_container.eo b/src/lib/evas/canvas/efl_canvas_vg_container.eo
index a987246531..7b1397d447 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_container.eo
+++ b/src/lib/evas/canvas/efl_canvas_vg_container.eo
@@ -21,6 +21,6 @@ class @beta Efl.Canvas.Vg.Container extends Efl.Canvas.Vg.Node
21 Efl.Gfx.Path.bounds_get; 21 Efl.Gfx.Path.bounds_get;
22 Efl.Gfx.Path.interpolate; 22 Efl.Gfx.Path.interpolate;
23 Efl.Duplicate.duplicate; 23 Efl.Duplicate.duplicate;
24 Efl.Canvas.Vg.Node.mask { set; } 24 Efl.Canvas.Vg.Node.comp_method { set; }
25 } 25 }
26} 26}
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
index 0b1435202b..1d4eb6a154 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
@@ -64,8 +64,8 @@ _efl_canvas_vg_gradient_linear_render_pre(Evas_Object_Protected_Data *vg_pd EINA
64 void *context EINA_UNUSED, 64 void *context EINA_UNUSED,
65 Ector_Surface *surface, 65 Ector_Surface *surface,
66 Eina_Matrix3 *ptransform, 66 Eina_Matrix3 *ptransform,
67 Ector_Buffer *mask, 67 Ector_Buffer *comp,
68 int mask_op, 68 Efl_Gfx_Vg_Composite_Method comp_method,
69 void *data) 69 void *data)
70{ 70{
71 Efl_Canvas_Vg_Gradient_Linear_Data *pd = data; 71 Efl_Canvas_Vg_Gradient_Linear_Data *pd = data;
@@ -94,7 +94,7 @@ _efl_canvas_vg_gradient_linear_render_pre(Evas_Object_Protected_Data *vg_pd EINA
94 efl_gfx_gradient_linear_start_set(nd->renderer, pd->start.x, pd->start.y); 94 efl_gfx_gradient_linear_start_set(nd->renderer, pd->start.x, pd->start.y);
95 efl_gfx_gradient_linear_end_set(nd->renderer, pd->end.x, pd->end.y); 95 efl_gfx_gradient_linear_end_set(nd->renderer, pd->end.x, pd->end.y);
96 ector_renderer_prepare(nd->renderer); 96 ector_renderer_prepare(nd->renderer);
97 ector_renderer_mask_set(nd->renderer, mask, mask_op); 97 ector_renderer_comp_method_set(nd->renderer, comp, comp_method);
98} 98}
99 99
100static Eo * 100static Eo *
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
index 691dc5dec8..e54df094ba 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
@@ -80,8 +80,8 @@ _efl_canvas_vg_gradient_radial_render_pre(Evas_Object_Protected_Data *vg_pd EINA
80 void *context EINA_UNUSED, 80 void *context EINA_UNUSED,
81 Ector_Surface *surface, 81 Ector_Surface *surface,
82 Eina_Matrix3 *ptransform, 82 Eina_Matrix3 *ptransform,
83 Ector_Buffer *mask, 83 Ector_Buffer *comp,
84 int mask_op, 84 Efl_Gfx_Vg_Composite_Method comp_method,
85 void *data) 85 void *data)
86{ 86{
87 Efl_Canvas_Vg_Gradient_Radial_Data *pd = data; 87 Efl_Canvas_Vg_Gradient_Radial_Data *pd = data;
@@ -111,7 +111,7 @@ _efl_canvas_vg_gradient_radial_render_pre(Evas_Object_Protected_Data *vg_pd EINA
111 efl_gfx_gradient_radial_focal_set(nd->renderer, pd->focal.x, pd->focal.y); 111 efl_gfx_gradient_radial_focal_set(nd->renderer, pd->focal.x, pd->focal.y);
112 efl_gfx_gradient_radial_radius_set(nd->renderer, pd->radius); 112 efl_gfx_gradient_radial_radius_set(nd->renderer, pd->radius);
113 ector_renderer_prepare(nd->renderer); 113 ector_renderer_prepare(nd->renderer);
114 ector_renderer_mask_set(nd->renderer, mask, mask_op); 114 ector_renderer_comp_method_set(nd->renderer, comp, comp_method);
115} 115}
116 116
117static Eo * 117static Eo *
diff --git a/src/lib/evas/canvas/efl_canvas_vg_image.c b/src/lib/evas/canvas/efl_canvas_vg_image.c
index d008fd74f9..2b99efbaef 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_image.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_image.c
@@ -21,8 +21,8 @@ _efl_canvas_vg_image_render_pre(Evas_Object_Protected_Data *vg_pd,
21 void *engine EINA_UNUSED, void *output EINA_UNUSED, void *context EINA_UNUSED, 21 void *engine EINA_UNUSED, void *output EINA_UNUSED, void *context EINA_UNUSED,
22 Ector_Surface *surface, 22 Ector_Surface *surface,
23 Eina_Matrix3 *ptransform, 23 Eina_Matrix3 *ptransform,
24 Ector_Buffer *mask, 24 Ector_Buffer *comp,
25 int mask_op, 25 Efl_Gfx_Vg_Composite_Method comp_method,
26 void *data) 26 void *data)
27{ 27{
28 Efl_Canvas_Vg_Image_Data *pd = data; 28 Efl_Canvas_Vg_Image_Data *pd = data;
@@ -63,7 +63,7 @@ _efl_canvas_vg_image_render_pre(Evas_Object_Protected_Data *vg_pd,
63 ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a); 63 ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a);
64 ector_renderer_visibility_set(nd->renderer, nd->visibility); 64 ector_renderer_visibility_set(nd->renderer, nd->visibility);
65 65
66 ector_renderer_mask_set(nd->renderer, mask, mask_op); 66 ector_renderer_comp_method_set(nd->renderer, comp, comp_method);
67 ector_renderer_prepare(nd->renderer); 67 ector_renderer_prepare(nd->renderer);
68} 68}
69 69
diff --git a/src/lib/evas/canvas/efl_canvas_vg_node.c b/src/lib/evas/canvas/efl_canvas_vg_node.c
index 95dcdc5152..5064407f03 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_node.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_node.c
@@ -73,10 +73,10 @@ _efl_canvas_vg_node_transformation_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vg_
73} 73}
74 74
75static void 75static void
76_efl_canvas_vg_node_mask_set(Eo *obj EINA_UNUSED, 76_efl_canvas_vg_node_comp_method_set(Eo *obj EINA_UNUSED,
77 Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED, 77 Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
78 Efl_Canvas_Vg_Node *mask EINA_UNUSED, 78 Efl_Canvas_Vg_Node *target EINA_UNUSED,
79 int op EINA_UNUSED) 79 Efl_Gfx_Vg_Composite_Method method EINA_UNUSED)
80{ 80{
81} 81}
82 82
diff --git a/src/lib/evas/canvas/efl_canvas_vg_node.eo b/src/lib/evas/canvas/efl_canvas_vg_node.eo
index e8846fb0c3..a0cbb5d85d 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_node.eo
+++ b/src/lib/evas/canvas/efl_canvas_vg_node.eo
@@ -36,13 +36,13 @@ abstract @beta Efl.Canvas.Vg.Node extends Efl.Object
36 y: double; [[$origin y position.]] 36 y: double; [[$origin y position.]]
37 } 37 }
38 } 38 }
39 @property mask { 39 @property comp_method {
40 [[Set Mask Node to this renderer]] 40 [[Set a composite target node to this node object.]]
41 set { 41 set {
42 } 42 }
43 values { 43 values {
44 mask: Efl.Canvas.Vg.Node; [[Mask object]] 44 target: Efl.Canvas.Vg.Node; [[Composite target node]]
45 op: int; [[Masking Option. Reserved]] 45 method: Efl.Gfx.Vg_Composite_Method; [[Composite Method.]]
46 } 46 }
47 } 47 }
48 } 48 }
diff --git a/src/lib/evas/canvas/efl_canvas_vg_node_eo.legacy.c b/src/lib/evas/canvas/efl_canvas_vg_node_eo.legacy.c
index eda76165cb..559434b294 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_node_eo.legacy.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_node_eo.legacy.c
@@ -24,7 +24,7 @@ evas_vg_node_origin_get(const Efl_Canvas_Vg_Node *obj, double *x, double *y)
24} 24}
25 25
26EAPI void 26EAPI void
27evas_vg_node_mask_set(Efl_Canvas_Vg_Node *obj, Efl_Canvas_Vg_Node *mask, int op) 27evas_vg_node_mask_set(Efl_Canvas_Vg_Node *obj, Efl_Canvas_Vg_Node *mask, int op EINA_UNUSED)
28{ 28{
29 efl_canvas_vg_node_mask_set(obj, mask, op); 29 efl_canvas_vg_node_comp_method_set(obj, mask, 0);
30} 30}
diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c
index a0bcc1ec8f..1617bc1025 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -396,7 +396,7 @@ _evas_vg_render(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd,
396 Eina_List *l; 396 Eina_List *l;
397 Efl_Canvas_Vg_Container_Data *cd = efl_data_scope_get(node, EFL_CANVAS_VG_CONTAINER_CLASS); 397 Efl_Canvas_Vg_Container_Data *cd = efl_data_scope_get(node, EFL_CANVAS_VG_CONTAINER_CLASS);
398 398
399 if (cd->mask.target) return; //Don't draw mask itself. 399 if (cd->comp.src) return; //Don't draw composite target itself.
400 400
401 int alpha = 255; 401 int alpha = 255;
402 efl_gfx_color_get(node, NULL, NULL, NULL, &alpha); 402 efl_gfx_color_get(node, NULL, NULL, NULL, &alpha);
@@ -508,7 +508,7 @@ _render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd
508 evas_common_draw_context_set_render_op(context, _EVAS_RENDER_COPY); 508 evas_common_draw_context_set_render_op(context, _EVAS_RENDER_COPY);
509 evas_common_draw_context_set_color(context, 255, 255, 255, 255); 509 evas_common_draw_context_set_color(context, 255, 255, 255, 255);
510 510
511 //ector begin - end for drawing mask images. 511 //ector begin - end for drawing composite images.
512 //ENFN->ector_begin(engine, buffer, context, ector, 0, 0, EINA_FALSE, EINA_FALSE); 512 //ENFN->ector_begin(engine, buffer, context, ector, 0, 0, EINA_FALSE, EINA_FALSE);
513 _evas_vg_render_pre(obj, root, engine, buffer, context, ector, NULL, NULL, 0); 513 _evas_vg_render_pre(obj, root, engine, buffer, context, ector, NULL, NULL, 0);
514 //ENFN->ector_end(engine, buffer, context, ector, EINA_FALSE); 514 //ENFN->ector_end(engine, buffer, context, ector, EINA_FALSE);
diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c
index fa22b6a3e7..4abdb13af8 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_shape.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c
@@ -78,8 +78,8 @@ _efl_canvas_vg_shape_render_pre(Evas_Object_Protected_Data *vg_pd,
78 void *engine, void *output, void *context, 78 void *engine, void *output, void *context,
79 Ector_Surface *surface, 79 Ector_Surface *surface,
80 Eina_Matrix3 *ptransform, 80 Eina_Matrix3 *ptransform,
81 Ector_Buffer *mask, 81 Ector_Buffer *comp,
82 int mask_op, 82 Efl_Gfx_Vg_Composite_Method comp_method,
83 void *data) 83 void *data)
84{ 84{
85 Efl_Canvas_Vg_Shape_Data *pd = data; 85 Efl_Canvas_Vg_Shape_Data *pd = data;
@@ -93,13 +93,13 @@ _efl_canvas_vg_shape_render_pre(Evas_Object_Protected_Data *vg_pd,
93 93
94 fill = _evas_vg_render_pre(vg_pd, pd->fill, 94 fill = _evas_vg_render_pre(vg_pd, pd->fill,
95 engine, output, context, 95 engine, output, context,
96 surface, ctransform, mask, mask_op); 96 surface, ctransform, comp, comp_method);
97 stroke_fill = _evas_vg_render_pre(vg_pd, pd->stroke.fill, 97 stroke_fill = _evas_vg_render_pre(vg_pd, pd->stroke.fill,
98 engine, output, context, 98 engine, output, context,
99 surface, ctransform, mask, mask_op); 99 surface, ctransform, comp, comp_method);
100 stroke_marker = _evas_vg_render_pre(vg_pd, pd->stroke.marker, 100 stroke_marker = _evas_vg_render_pre(vg_pd, pd->stroke.marker,
101 engine, output, context, 101 engine, output, context,
102 surface, ctransform, mask, mask_op); 102 surface, ctransform, comp, comp_method);
103 103
104 if (!nd->renderer) 104 if (!nd->renderer)
105 { 105 {
@@ -117,7 +117,7 @@ _efl_canvas_vg_shape_render_pre(Evas_Object_Protected_Data *vg_pd,
117 efl_gfx_path_copy_from(nd->renderer, obj); 117 efl_gfx_path_copy_from(nd->renderer, obj);
118 efl_gfx_path_commit(nd->renderer); 118 efl_gfx_path_commit(nd->renderer);
119 ector_renderer_prepare(nd->renderer); 119 ector_renderer_prepare(nd->renderer);
120 ector_renderer_mask_set(nd->renderer, mask, mask_op); 120 ector_renderer_comp_method_set(nd->renderer, comp, comp_method);
121} 121}
122 122
123static Eo * 123static Eo *
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h
index 0fad40d15c..d8a07b24f1 100644
--- a/src/lib/evas/canvas/evas_vg_private.h
+++ b/src/lib/evas/canvas/evas_vg_private.h
@@ -67,7 +67,7 @@ struct _Efl_Canvas_Vg_Node_Data
67 void (*render_pre)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node, 67 void (*render_pre)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node,
68 Efl_Canvas_Vg_Node_Data *nd, 68 Efl_Canvas_Vg_Node_Data *nd,
69 void *engine, void *output, void *contenxt, Ector_Surface *surface, 69 void *engine, void *output, void *contenxt, Ector_Surface *surface,
70 Eina_Matrix3 *ptransform, Ector_Buffer *mask, int mask_op, void *data); 70 Eina_Matrix3 *ptransform, Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method, void *data);
71 void *data; 71 void *data;
72 72
73 double x, y; 73 double x, y;
@@ -78,24 +78,24 @@ struct _Efl_Canvas_Vg_Node_Data
78 Eina_Bool changed : 1; 78 Eina_Bool changed : 1;
79}; 79};
80 80
81typedef struct _Vg_Mask 81typedef struct _Vg_Composite
82{ 82{
83 Evas_Object_Protected_Data *vg_pd; //Vector Object (for accessing backend engine) 83 Evas_Object_Protected_Data *vg_pd; //Vector Object (for accessing backend engine)
84 Ector_Buffer *buffer; //Mask Ector Buffer 84 Ector_Buffer *buffer; //Composite Ector Buffer
85 void *pixels; //Mask pixel buffer (actual data) 85 void *pixels; //Composite pixel buffer (actual data)
86 Eina_Rect bound; //Mask boundary 86 Eina_Rect bound; //Composite boundary
87 Eina_List *target; //Mask target 87 Eina_List *src; //Composite Sources
88 int option; //Mask option 88 Efl_Gfx_Vg_Composite_Method method; //Composite Method
89} Vg_Mask; 89} Vg_Comp;
90 90
91struct _Efl_Canvas_Vg_Container_Data 91struct _Efl_Canvas_Vg_Container_Data
92{ 92{
93 Eina_List *children; 93 Eina_List *children;
94 Eina_Hash *names; 94 Eina_Hash *names;
95 95
96 //Masking feature. 96 //Composite feature.
97 Efl_Canvas_Vg_Node *mask_src; //Mask Source 97 Efl_Canvas_Vg_Node *comp_target; //Composite target
98 Vg_Mask mask; //Mask source data 98 Vg_Comp comp; //Composite target data
99 99
100 //Layer transparency feature. This buffer is only valid when the layer has transparency. 100 //Layer transparency feature. This buffer is only valid when the layer has transparency.
101 Ector_Buffer *blend_buffer; 101 Ector_Buffer *blend_buffer;
@@ -150,13 +150,13 @@ _evas_vg_render_pre(Evas_Object_Protected_Data *vg_pd, Efl_VG *child,
150 void *engine, void *output, void *context, 150 void *engine, void *output, void *context,
151 Ector_Surface *surface, 151 Ector_Surface *surface,
152 Eina_Matrix3 *transform, 152 Eina_Matrix3 *transform,
153 Ector_Buffer *mask, int mask_op) 153 Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method)
154{ 154{
155 if (!child) return NULL; 155 if (!child) return NULL;
156 Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS); 156 Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS);
157 if (nd) nd->render_pre(vg_pd, child, nd, 157 if (nd) nd->render_pre(vg_pd, child, nd,
158 engine, output, context, surface, 158 engine, output, context, surface,
159 transform, mask, mask_op, nd->data); 159 transform, comp, comp_method, nd->data);
160 return nd; 160 return nd;
161} 161}
162 162
diff --git a/src/static_libs/vg_common/vg_common_json.c b/src/static_libs/vg_common/vg_common_json.c
index 27fc86e7e6..910a4055e1 100644
--- a/src/static_libs/vg_common/vg_common_json.c
+++ b/src/static_libs/vg_common/vg_common_json.c
@@ -9,21 +9,6 @@
9 9
10#include <rlottie_capi.h> 10#include <rlottie_capi.h>
11 11
12//FIXME: This enum add temporarily to help understanding of additional code
13//related to masking in prepare_mask.
14//This needs to be formally declared through the eo class.
15typedef enum _EFL_CANVAS_VG_NODE_BLEND_TYPE
16{
17 EFL_CANVAS_VG_NODE_BLEND_TYPE_NONE = 0,
18 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA,
19 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV,
20 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD,
21 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT,
22 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT,
23 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE
24}EFL_CANVAS_VG_NODE_BLEND_TYPE;
25//
26
27static char* 12static char*
28_get_key_val(void *key) 13_get_key_val(void *key)
29{ 14{
@@ -311,10 +296,10 @@ _construct_masks(Efl_Canvas_Vg_Container *mtarget, LOTMask *masks, unsigned int
311 efl_key_data_set(mtarget, key, msource); 296 efl_key_data_set(mtarget, key, msource);
312 } 297 }
313 298
314 //FIXME : EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA option is temporary 299 //FIXME : EFL_GFX_VG_COMPOSITE_METHOD_ALPHA option is temporary
315 //Currently matte alpha implemtnes is same the mask intersect impletment. 300 //Currently matte alpha implements is same the mask intersect implement.
316 //It has been implemented as a multiplication calculation. 301 //It has been implemented as a multiplication calculation.
317 efl_canvas_vg_node_mask_set(mtarget, msource, EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA); 302 efl_canvas_vg_node_comp_method_set(mtarget, msource, EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA);
318 303
319 mtarget = msource; 304 mtarget = msource;
320 305
@@ -332,24 +317,24 @@ _construct_masks(Efl_Canvas_Vg_Container *mtarget, LOTMask *masks, unsigned int
332 } 317 }
333 _construct_mask_nodes(msource, mask, depth + 1); 318 _construct_mask_nodes(msource, mask, depth + 1);
334 319
335 EFL_CANVAS_VG_NODE_BLEND_TYPE mask_mode; 320 Efl_Gfx_Vg_Composite_Method mask_mode;
336 switch (mask->mMode) 321 switch (mask->mMode)
337 { 322 {
338 case MaskSubstract: 323 case MaskSubstract:
339 mask_mode = EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT; 324 mask_mode = EFL_GFX_VG_COMPOSITE_METHOD_MASK_SUBSTRACT;
340 break; 325 break;
341 case MaskIntersect: 326 case MaskIntersect:
342 mask_mode = EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT; 327 mask_mode = EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT;
343 break; 328 break;
344 case MaskDifference: 329 case MaskDifference:
345 mask_mode = EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE; 330 mask_mode = EFL_GFX_VG_COMPOSITE_METHOD_MASK_DIFFERENCE;
346 break; 331 break;
347 case MaskAdd: 332 case MaskAdd:
348 default: 333 default:
349 mask_mode = EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD; 334 mask_mode = EFL_GFX_VG_COMPOSITE_METHOD_MASK_ADD;
350 break; 335 break;
351 } 336 }
352 efl_canvas_vg_node_mask_set(mtarget, msource, mask_mode); 337 efl_canvas_vg_node_comp_method_set(mtarget, msource, mask_mode);
353 mtarget = msource; 338 mtarget = msource;
354 } 339 }
355} 340}
@@ -397,7 +382,7 @@ _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int de
397 382
398 if (matte_mode != 0) 383 if (matte_mode != 0)
399 { 384 {
400 efl_canvas_vg_node_mask_set(ptree, ctree, matte_mode); 385 efl_canvas_vg_node_comp_method_set(ptree, ctree, matte_mode);
401 mtarget = ctree; 386 mtarget = ctree;
402 } 387 }
403 matte_mode = (int) clayer->mMatte; 388 matte_mode = (int) clayer->mMatte;
@@ -417,10 +402,10 @@ _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int de
417 matte_mode = 0; 402 matte_mode = 0;
418 break; 403 break;
419 case MatteAlpha: 404 case MatteAlpha:
420 matte_mode = EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA; 405 matte_mode = EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA;
421 break; 406 break;
422 case MatteAlphaInv: 407 case MatteAlphaInv:
423 matte_mode = EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV; 408 matte_mode = EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE;
424 break; 409 break;
425 case MatteLuma: 410 case MatteLuma:
426 matte_mode = 0; 411 matte_mode = 0;