summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-06-16 16:28:19 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-21 16:40:31 +0200
commit7cb92ff35d3e49c53368b6fe4ade1d2a732018fc (patch)
tree90628a6c6b4e62f507a78ad7a4d8b1e754a453b8
parentd595324a8dbccabf80d13d8f22e59c6166b4c2b6 (diff)
evas: add support for interpolating Efl_VG_Node tree.
-rw-r--r--src/lib/evas/canvas/efl_vg_base.eo8
-rw-r--r--src/lib/evas/canvas/efl_vg_container.eo1
-rw-r--r--src/lib/evas/canvas/efl_vg_gradient.eo1
-rw-r--r--src/lib/evas/canvas/efl_vg_gradient_linear.eo1
-rw-r--r--src/lib/evas/canvas/efl_vg_gradient_radial.eo1
-rw-r--r--src/lib/evas/canvas/efl_vg_shape.eo1
-rw-r--r--src/lib/evas/canvas/evas_vg_container.c38
-rw-r--r--src/lib/evas/canvas/evas_vg_gradient.c43
-rw-r--r--src/lib/evas/canvas/evas_vg_gradient_linear.c31
-rw-r--r--src/lib/evas/canvas/evas_vg_gradient_radial.c32
-rw-r--r--src/lib/evas/canvas/evas_vg_node.c184
-rw-r--r--src/lib/evas/canvas/evas_vg_private.h12
-rw-r--r--src/lib/evas/canvas/evas_vg_shape.c34
13 files changed, 387 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/efl_vg_base.eo b/src/lib/evas/canvas/efl_vg_base.eo
index 1567f5a..7ddfce5 100644
--- a/src/lib/evas/canvas/efl_vg_base.eo
+++ b/src/lib/evas/canvas/efl_vg_base.eo
@@ -88,6 +88,14 @@ abstract Efl.VG.Base (Eo.Base, Efl.Gfx.Base, Efl.Gfx.Stack)
88 @out r: Eina.Rectangle; [[bounding box to be returned.]] 88 @out r: Eina.Rectangle; [[bounding box to be returned.]]
89 } 89 }
90 } 90 }
91 interpolate {
92 return: bool;
93 params {
94 @in from: const(Efl.VG.Base)*;
95 @in to: const(Efl.VG.Base)*;
96 @in pos_map: double;
97 }
98 }
91 } 99 }
92 implements { 100 implements {
93 Eo.Base.parent.set; 101 Eo.Base.parent.set;
diff --git a/src/lib/evas/canvas/efl_vg_container.eo b/src/lib/evas/canvas/efl_vg_container.eo
index 19a7b30..b3a6ec4 100644
--- a/src/lib/evas/canvas/efl_vg_container.eo
+++ b/src/lib/evas/canvas/efl_vg_container.eo
@@ -16,5 +16,6 @@ class Efl.VG.Container (Efl.VG.Base)
16 Eo.Base.constructor; 16 Eo.Base.constructor;
17 Eo.Base.destructor; 17 Eo.Base.destructor;
18 Efl.VG.Base.bounds_get; 18 Efl.VG.Base.bounds_get;
19 Efl.VG.Base.interpolate;
19 } 20 }
20} 21}
diff --git a/src/lib/evas/canvas/efl_vg_gradient.eo b/src/lib/evas/canvas/efl_vg_gradient.eo
index de78039..959da5b 100644
--- a/src/lib/evas/canvas/efl_vg_gradient.eo
+++ b/src/lib/evas/canvas/efl_vg_gradient.eo
@@ -6,5 +6,6 @@ abstract Efl.VG.Gradient (Efl.VG.Base, Efl.Gfx.Gradient.Base)
6 Efl.Gfx.Gradient.Base.stop.get; 6 Efl.Gfx.Gradient.Base.stop.get;
7 Efl.Gfx.Gradient.Base.spread.set; 7 Efl.Gfx.Gradient.Base.spread.set;
8 Efl.Gfx.Gradient.Base.spread.get; 8 Efl.Gfx.Gradient.Base.spread.get;
9 Efl.VG.Base.interpolate;
9 } 10 }
10} 11}
diff --git a/src/lib/evas/canvas/efl_vg_gradient_linear.eo b/src/lib/evas/canvas/efl_vg_gradient_linear.eo
index 4aaddd4..aecfe4e 100644
--- a/src/lib/evas/canvas/efl_vg_gradient_linear.eo
+++ b/src/lib/evas/canvas/efl_vg_gradient_linear.eo
@@ -7,6 +7,7 @@ class Efl.VG.Gradient_Linear (Efl.VG.Gradient, Efl.Gfx.Gradient.Linear)
7 Efl.Gfx.Gradient.Linear.end.set; 7 Efl.Gfx.Gradient.Linear.end.set;
8 Efl.Gfx.Gradient.Linear.end.get; 8 Efl.Gfx.Gradient.Linear.end.get;
9 Efl.VG.Base.bounds_get; 9 Efl.VG.Base.bounds_get;
10 Efl.VG.Base.interpolate;
10 Eo.Base.constructor; 11 Eo.Base.constructor;
11 Eo.Base.destructor; 12 Eo.Base.destructor;
12 } 13 }
diff --git a/src/lib/evas/canvas/efl_vg_gradient_radial.eo b/src/lib/evas/canvas/efl_vg_gradient_radial.eo
index 62eb086..bd99848 100644
--- a/src/lib/evas/canvas/efl_vg_gradient_radial.eo
+++ b/src/lib/evas/canvas/efl_vg_gradient_radial.eo
@@ -9,6 +9,7 @@ class Efl.VG.Gradient_Radial (Efl.VG.Gradient, Efl.Gfx.Gradient.Radial)
9 Efl.Gfx.Gradient.Radial.focal.set; 9 Efl.Gfx.Gradient.Radial.focal.set;
10 Efl.Gfx.Gradient.Radial.focal.get; 10 Efl.Gfx.Gradient.Radial.focal.get;
11 Efl.VG.Base.bounds_get; 11 Efl.VG.Base.bounds_get;
12 Efl.VG.Base.interpolate;
12 Eo.Base.constructor; 13 Eo.Base.constructor;
13 Eo.Base.destructor; 14 Eo.Base.destructor;
14 } 15 }
diff --git a/src/lib/evas/canvas/efl_vg_shape.eo b/src/lib/evas/canvas/efl_vg_shape.eo
index 45d0d30..e2d5c27 100644
--- a/src/lib/evas/canvas/efl_vg_shape.eo
+++ b/src/lib/evas/canvas/efl_vg_shape.eo
@@ -41,6 +41,7 @@ class Efl.VG.Shape (Efl.VG.Base, Efl.Gfx.Shape)
41 Efl.Gfx.Base.color_part.set; 41 Efl.Gfx.Base.color_part.set;
42 Efl.Gfx.Base.color_part.get; 42 Efl.Gfx.Base.color_part.get;
43 Efl.VG.Base.bounds_get; 43 Efl.VG.Base.bounds_get;
44 Efl.VG.Base.interpolate;
44 Eo.Base.constructor; 45 Eo.Base.constructor;
45 Eo.Base.destructor; 46 Eo.Base.destructor;
46 } 47 }
diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c
index e311260..683f5ce 100644
--- a/src/lib/evas/canvas/evas_vg_container.c
+++ b/src/lib/evas/canvas/evas_vg_container.c
@@ -97,6 +97,44 @@ _efl_vg_container_children_get(Eo *obj EINA_UNUSED, Efl_VG_Container_Data *pd)
97 return eina_list_iterator_new(pd->children); 97 return eina_list_iterator_new(pd->children);
98} 98}
99 99
100static Eina_Bool
101_efl_vg_container_efl_vg_base_interpolate(Eo *obj,
102 Efl_VG_Container_Data *pd,
103 const Efl_VG_Base *from, const Efl_VG_Base *to,
104 double pos_map)
105{
106 Efl_VG_Container_Data *fd;
107 Efl_VG_Container_Data *td;
108 Eina_Iterator *it;
109 Eina_Hash_Tuple *tuple;
110 Eina_Bool r;
111
112 eo_do_super(obj, EFL_VG_CONTAINER_CLASS, r = efl_vg_interpolate(from, to, pos_map));
113
114 if (!r) return EINA_FALSE;
115
116 fd = eo_data_scope_get(from, EFL_VG_CONTAINER_CLASS);
117 td = eo_data_scope_get(to, EFL_VG_CONTAINER_CLASS);
118
119 it = eina_hash_iterator_tuple_new(pd->names);
120 EINA_ITERATOR_FOREACH(it, tuple)
121 {
122 Eo *fromc, *toc;
123 Eo *cc = tuple->data;
124
125 fromc = eina_hash_find(fd->names, tuple->key);
126 toc = eina_hash_find(td->names, tuple->key);
127
128 if (!toc || !fromc) continue ;
129 if (eo_class_get(toc) != eo_class_get(fromc)) continue ;
130
131 eo_do(cc, r &= efl_vg_interpolate(fromc, toc, pos_map));
132 }
133 eina_iterator_free(it);
134
135 return r;
136}
137
100EAPI Efl_VG* 138EAPI Efl_VG*
101evas_vg_container_add(Efl_VG *parent) 139evas_vg_container_add(Efl_VG *parent)
102{ 140{
diff --git a/src/lib/evas/canvas/evas_vg_gradient.c b/src/lib/evas/canvas/evas_vg_gradient.c
index 245b6fe..495a493 100644
--- a/src/lib/evas/canvas/evas_vg_gradient.c
+++ b/src/lib/evas/canvas/evas_vg_gradient.c
@@ -51,6 +51,49 @@ _efl_vg_gradient_efl_gfx_gradient_base_spread_get(Eo *obj EINA_UNUSED,
51 return pd->s; 51 return pd->s;
52} 52}
53 53
54static Eina_Bool
55_efl_vg_gradient_efl_vg_base_interpolate(Eo *obj,
56 Efl_VG_Gradient_Data *pd,
57 const Efl_VG_Base *from, const Efl_VG_Base *to,
58 double pos_map)
59{
60 Efl_VG_Gradient_Data *fromd, *tod;
61 Efl_Gfx_Gradient_Stop *colors;
62 unsigned int i;
63 double from_map;
64 Eina_Bool r;
65
66 eo_do_super(obj, EFL_VG_GRADIENT_CLASS, r = efl_vg_interpolate(from, to, pos_map));
67
68 fromd = eo_data_scope_get(from, EFL_VG_GRADIENT_CLASS);
69 tod = eo_data_scope_get(to, EFL_VG_GRADIENT_CLASS);
70 from_map = 1.0 - pos_map;
71
72 if (!r) return EINA_FALSE;
73 if (fromd->colors_count != tod->colors_count) return EINA_FALSE;
74
75 colors = realloc(pd->colors, sizeof (Efl_Gfx_Gradient_Stop) * tod->colors_count);
76 if (!colors) return EINA_FALSE;
77
78 pd->colors = colors;
79
80#define INTP(Pd, From, To, I, Member, From_Map, Pos_Map) \
81 Pd->colors[I].Member = From->colors[I].Member * From_Map + To->colors[I].Member * Pos_Map
82
83 for (i = 0; i < fromd->colors_count; i++)
84 {
85 INTP(pd, fromd, tod, i, offset, from_map, pos_map);
86 INTP(pd, fromd, tod, i, r, from_map, pos_map);
87 INTP(pd, fromd, tod, i, g, from_map, pos_map);
88 INTP(pd, fromd, tod, i, b, from_map, pos_map);
89 INTP(pd, fromd, tod, i, a, from_map, pos_map);
90 }
91
92#undef INTP
93
94 return EINA_TRUE;
95}
96
54EAPI void 97EAPI void
55evas_vg_gradient_stop_set(Eo *obj, const Efl_Gfx_Gradient_Stop *colors, unsigned int length) 98evas_vg_gradient_stop_set(Eo *obj, const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
56{ 99{
diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.c b/src/lib/evas/canvas/evas_vg_gradient_linear.c
index 9a54f7a..609dc7a 100644
--- a/src/lib/evas/canvas/evas_vg_gradient_linear.c
+++ b/src/lib/evas/canvas/evas_vg_gradient_linear.c
@@ -120,6 +120,37 @@ _efl_vg_gradient_linear_efl_vg_base_bounds_get(Eo *obj, Efl_VG_Gradient_Linear_D
120 pd->end.x - pd->start.x, pd->end.y - pd->start.x); 120 pd->end.x - pd->start.x, pd->end.y - pd->start.x);
121} 121}
122 122
123static Eina_Bool
124_efl_vg_gradient_linear_efl_vg_base_interpolate(Eo *obj,
125 Efl_VG_Gradient_Linear_Data *pd,
126 const Efl_VG_Base *from, const Efl_VG_Base *to,
127 double pos_map)
128{
129 Efl_VG_Gradient_Linear_Data *fromd, *tod;
130 double from_map;
131 Eina_Bool r;
132
133 eo_do_super(obj, EFL_VG_GRADIENT_LINEAR_CLASS, r = efl_vg_interpolate(from, to, pos_map));
134
135 if (!r) return EINA_FALSE;
136
137 fromd = eo_data_scope_get(from, EFL_VG_GRADIENT_LINEAR_CLASS);
138 tod = eo_data_scope_get(to, EFL_VG_GRADIENT_LINEAR_CLASS);
139 from_map = 1.0 - pos_map;
140
141#define INTP(Pd, From, To, Member, From_Map, Pos_Map) \
142 Pd->Member = From->Member * From_Map + To->Member * Pos_Map
143
144 INTP(pd, fromd, tod, start.x, from_map, pos_map);
145 INTP(pd, fromd, tod, start.y, from_map, pos_map);
146 INTP(pd, fromd, tod, end.x, from_map, pos_map);
147 INTP(pd, fromd, tod, end.y, from_map, pos_map);
148
149#undef INTP
150
151 return EINA_TRUE;
152}
153
123EAPI void 154EAPI void
124evas_vg_gradient_linear_start_set(Eo *obj, double x, double y) 155evas_vg_gradient_linear_start_set(Eo *obj, double x, double y)
125{ 156{
diff --git a/src/lib/evas/canvas/evas_vg_gradient_radial.c b/src/lib/evas/canvas/evas_vg_gradient_radial.c
index 8af5e7d..52ed957 100644
--- a/src/lib/evas/canvas/evas_vg_gradient_radial.c
+++ b/src/lib/evas/canvas/evas_vg_gradient_radial.c
@@ -138,6 +138,38 @@ _efl_vg_gradient_radial_efl_vg_base_bounds_get(Eo *obj, Efl_VG_Gradient_Radial_D
138 pd->radius * 2, pd->radius * 2); 138 pd->radius * 2, pd->radius * 2);
139} 139}
140 140
141static Eina_Bool
142_efl_vg_gradient_radial_efl_vg_base_interpolate(Eo *obj,
143 Efl_VG_Gradient_Radial_Data *pd,
144 const Efl_VG_Base *from, const Efl_VG_Base *to,
145 double pos_map)
146{
147 Efl_VG_Gradient_Radial_Data *fromd, *tod;
148 double from_map;
149 Eina_Bool r;
150
151 eo_do_super(obj, EFL_VG_GRADIENT_RADIAL_CLASS, r = efl_vg_interpolate(from, to, pos_map));
152
153 if (!r) return EINA_FALSE;
154
155 fromd = eo_data_scope_get(from, EFL_VG_GRADIENT_RADIAL_CLASS);
156 tod = eo_data_scope_get(to, EFL_VG_GRADIENT_RADIAL_CLASS);
157 from_map = 1.0 - pos_map;
158
159#define INTP(Pd, From, To, Member, From_Map, Pos_Map) \
160 Pd->Member = From->Member * From_Map + To->Member * Pos_Map
161
162 INTP(pd, fromd, tod, focal.x, from_map, pos_map);
163 INTP(pd, fromd, tod, focal.y, from_map, pos_map);
164 INTP(pd, fromd, tod, center.x, from_map, pos_map);
165 INTP(pd, fromd, tod, center.y, from_map, pos_map);
166 INTP(pd, fromd, tod, radius, from_map, pos_map);
167
168#undef INTP
169
170 return EINA_TRUE;
171}
172
141EAPI void 173EAPI void
142evas_vg_gradient_radial_center_set(Eo *obj, double x, double y) 174evas_vg_gradient_radial_center_set(Eo *obj, double x, double y)
143{ 175{
diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c
index b54b7ba..0f73808 100644
--- a/src/lib/evas/canvas/evas_vg_node.c
+++ b/src/lib/evas/canvas/evas_vg_node.c
@@ -9,6 +9,14 @@
9 9
10#define MY_CLASS EFL_VG_BASE_CLASS 10#define MY_CLASS EFL_VG_BASE_CLASS
11 11
12static const Efl_VG_Interpolation interpolation_identity = {
13 { 0, 0, 0, 1 },
14 { 0, 0, 0, 1 },
15 { 0, 0, 0 },
16 { 1, 1, 1 },
17 { 0, 0, 0 }
18};
19
12static Eina_Bool 20static Eina_Bool
13_efl_vg_base_property_changed(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) 21_efl_vg_base_property_changed(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
14{ 22{
@@ -28,6 +36,12 @@ _efl_vg_base_transformation_set(Eo *obj,
28 Efl_VG_Base_Data *pd, 36 Efl_VG_Base_Data *pd,
29 const Eina_Matrix3 *m) 37 const Eina_Matrix3 *m)
30{ 38{
39 if (pd->intp)
40 {
41 free(pd->intp);
42 pd->intp = NULL;
43 }
44
31 if (m) 45 if (m)
32 { 46 {
33 if (!pd->m) 47 if (!pd->m)
@@ -272,6 +286,11 @@ _efl_vg_base_eo_base_destructor(Eo *obj, Efl_VG_Base_Data *pd)
272 eo_del(pd->renderer); 286 eo_del(pd->renderer);
273 pd->renderer = NULL; 287 pd->renderer = NULL;
274 } 288 }
289 if (pd->intp)
290 {
291 free(pd->intp);
292 pd->intp = NULL;
293 }
275 294
276 eo_do_super(obj, MY_CLASS, eo_destructor()); 295 eo_do_super(obj, MY_CLASS, eo_destructor());
277} 296}
@@ -597,6 +616,171 @@ _efl_vg_base_efl_gfx_stack_above_get(Eo *obj, Efl_VG_Base_Data *pd EINA_UNUSED)
597 return above; 616 return above;
598} 617}
599 618
619static Efl_VG_Interpolation *
620_efl_vg_interpolation_get(Efl_VG_Base_Data *pd)
621{
622 Eina_Matrix4 m;
623
624 if (!pd->m) return NULL;
625 if (pd->intp) return pd->intp;
626
627 pd->intp = calloc(1, sizeof (Efl_VG_Interpolation));
628 if (!pd->intp) return NULL;
629
630 eina_matrix3_matrix4_to(&m, pd->m);
631
632 if (eina_matrix4_quaternion_to(&pd->intp->rotation,
633 &pd->intp->perspective,
634 &pd->intp->translation,
635 &pd->intp->scale,
636 &pd->intp->skew,
637 &m))
638 return pd->intp;
639
640 free(pd->intp);
641 pd->intp = NULL;
642
643 return NULL;
644}
645
646static inline void
647_efl_vg_interpolate_point(Eina_Point_3D *d,
648 const Eina_Point_3D *a, const Eina_Point_3D *b,
649 double pos_map, double from_map)
650{
651 d->x = a->x * from_map + b->x * pos_map;
652 d->y = a->y * from_map + b->y * pos_map;
653 d->z = a->z * from_map + b->z * pos_map;
654}
655
656static Eina_Bool
657_efl_vg_base_interpolate(Eo *obj,
658 Efl_VG_Base_Data *pd, const Efl_VG_Base *from, const Efl_VG_Base *to,
659 double pos_map)
660{
661 Efl_VG_Base_Data *fromd, *tod;
662 double from_map;
663 Eina_Bool r = EINA_TRUE;
664
665 fromd = eo_data_scope_get(from, EFL_VG_BASE_CLASS);
666 tod = eo_data_scope_get(to, EFL_VG_BASE_CLASS);
667 from_map = 1.0 - pos_map;
668
669 eo_del(pd->renderer);
670 pd->renderer = NULL;
671
672 if (fromd->m || tod->m)
673 {
674 if (!pd->m) pd->m = malloc(sizeof (Eina_Matrix3));
675 if (pd->m)
676 {
677 const Efl_VG_Interpolation *fi, *ti;
678 Efl_VG_Interpolation result;
679 Eina_Matrix4 m;
680
681 fi = _efl_vg_interpolation_get(fromd);
682 if (!fi) fi = &interpolation_identity;
683 ti = _efl_vg_interpolation_get(tod);
684 if (!ti) ti = &interpolation_identity;
685
686 eina_quaternion_slerp(&result.rotation,
687 &fi->rotation, &ti->rotation,
688 pos_map);
689 _efl_vg_interpolate_point(&result.translation,
690 &fi->translation, &ti->translation,
691 pos_map, from_map);
692 _efl_vg_interpolate_point(&result.scale,
693 &fi->scale, &ti->scale,
694 pos_map, from_map);
695 _efl_vg_interpolate_point(&result.skew,
696 &fi->skew, &ti->skew,
697 pos_map, from_map);
698
699 result.perspective.x = fi->perspective.x * from_map + ti->perspective.x * pos_map;
700 result.perspective.y = fi->perspective.y * from_map + ti->perspective.y * pos_map;
701 result.perspective.z = fi->perspective.z * from_map + ti->perspective.z * pos_map;
702 result.perspective.w = fi->perspective.w * from_map + ti->perspective.w * pos_map;
703
704 eina_quaternion_matrix4_to(&m,
705 &result.rotation,
706 &result.perspective,
707 &result.translation,
708 &result.scale,
709 &result.skew);
710 eina_matrix4_matrix3_to(pd->m, &m);
711 }
712 }
713
714 pd->x = fromd->x * from_map + tod->x * pos_map;
715 pd->y = fromd->y * from_map + tod->y * pos_map;
716
717 pd->r = fromd->r * from_map + tod->r * pos_map;
718 pd->g = fromd->g * from_map + tod->g * pos_map;
719 pd->b = fromd->b * from_map + tod->b * pos_map;
720 pd->a = fromd->a * from_map + tod->a * pos_map;
721
722 pd->visibility = pos_map >= 0.5 ? tod->visibility : fromd->visibility;
723
724 if (fromd->mask && tod->mask && pd->mask)
725 {
726 eo_do(pd->mask,
727 r &= efl_vg_interpolate(fromd->mask, tod->mask, pos_map));
728 }
729
730 _efl_vg_base_changed(obj);
731
732 return r;
733}
734
735static void
736_efl_vg_base_dup(Eo *obj, Efl_VG_Base_Data *pd, const Efl_VG_Base *from)
737{
738 Efl_VG_Container_Data *cd = NULL;
739 Efl_VG_Base_Data *fromd;
740 Eo *parent = NULL;
741
742 fromd = eo_data_scope_get(from, EFL_VG_BASE_CLASS);
743 pd->name = eina_stringshare_ref(fromd->name);
744
745 _efl_vg_base_parent_checked_get(obj, &parent, &cd);
746 if (cd) _efl_vg_base_name_insert(obj, pd, cd);
747
748 if (pd->intp)
749 {
750 free(pd->intp);
751 pd->intp = NULL;
752 }
753
754 if (fromd->m)
755 {
756 pd->m = pd->m ? pd->m : malloc(sizeof (Eina_Matrix3)) ;
757 if (pd->m) memcpy(pd->m, fromd->m, sizeof (Eina_Matrix3));
758 }
759 else
760 {
761 free(pd->m);
762 }
763
764 // We may come from an already duped/initialized node, clean it first
765 _efl_vg_clean_object(&pd->mask);
766 if (fromd->mask)
767 {
768 pd->mask = eo_add(eo_class_get(fromd->mask),
769 obj,
770 efl_vg_dup(pd->mask));
771 }
772
773 pd->x = fromd->x;
774 pd->y = fromd->y;
775 pd->r = fromd->r;
776 pd->g = fromd->g;
777 pd->b = fromd->b;
778 pd->a = fromd->a;
779 pd->visibility = fromd->visibility;
780
781 _efl_vg_base_changed(obj);
782}
783
600EAPI Eina_Bool 784EAPI Eina_Bool
601evas_vg_node_visible_get(Eo *obj) 785evas_vg_node_visible_get(Eo *obj)
602{ 786{
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h
index cc5222f..8ee62b6 100644
--- a/src/lib/evas/canvas/evas_vg_private.h
+++ b/src/lib/evas/canvas/evas_vg_private.h
@@ -6,12 +6,15 @@
6typedef struct _Efl_VG_Base_Data Efl_VG_Base_Data; 6typedef struct _Efl_VG_Base_Data Efl_VG_Base_Data;
7typedef struct _Efl_VG_Container_Data Efl_VG_Container_Data; 7typedef struct _Efl_VG_Container_Data Efl_VG_Container_Data;
8typedef struct _Efl_VG_Gradient_Data Efl_VG_Gradient_Data; 8typedef struct _Efl_VG_Gradient_Data Efl_VG_Gradient_Data;
9typedef struct _Efl_VG_Interpolation Efl_VG_Interpolation;
9 10
10struct _Efl_VG_Base_Data 11struct _Efl_VG_Base_Data
11{ 12{
12 const char *name; 13 const char *name;
13 14
14 Eina_Matrix3 *m; 15 Eina_Matrix3 *m;
16 Efl_VG_Interpolation *intp;
17
15 Efl_VG *mask; 18 Efl_VG *mask;
16 Ector_Renderer *renderer; 19 Ector_Renderer *renderer;
17 20
@@ -41,6 +44,15 @@ struct _Efl_VG_Gradient_Data
41 Efl_Gfx_Gradient_Spread s; 44 Efl_Gfx_Gradient_Spread s;
42}; 45};
43 46
47struct _Efl_VG_Interpolation
48{
49 Eina_Quaternion rotation;
50 Eina_Quaternion perspective;
51 Eina_Point_3D translation;
52 Eina_Point_3D scale;
53 Eina_Point_3D skew;
54};
55
44static inline Efl_VG_Base_Data * 56static inline Efl_VG_Base_Data *
45_evas_vg_render_pre(Efl_VG *child, Ector_Surface *s, Eina_Matrix3 *m) 57_evas_vg_render_pre(Efl_VG *child, Ector_Surface *s, Eina_Matrix3 *m)
46{ 58{
diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c
index d736718..d17268d 100644
--- a/src/lib/evas/canvas/evas_vg_shape.c
+++ b/src/lib/evas/canvas/evas_vg_shape.c
@@ -341,6 +341,40 @@ _efl_vg_shape_eo_base_destructor(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED)
341 eo_do_super(obj, MY_CLASS, eo_destructor()); 341 eo_do_super(obj, MY_CLASS, eo_destructor());
342} 342}
343 343
344static Eina_Bool
345_efl_vg_shape_efl_vg_base_interpolate(Eo *obj,
346 Efl_VG_Shape_Data *pd,
347 const Efl_VG_Base *from, const Efl_VG_Base *to,
348 double pos_map)
349{
350 Efl_VG_Shape_Data *fromd, *tod;
351 Eina_Bool r;
352
353 fromd = eo_data_scope_get(from, EFL_VG_SHAPE_CLASS);
354 tod = eo_data_scope_get(to, EFL_VG_SHAPE_CLASS);
355
356 eo_do_super(obj, MY_CLASS, r = efl_vg_interpolate(from, to, pos_map));
357
358 eo_do(obj, r &= efl_gfx_shape_interpolate(from, to, pos_map));
359
360 if (fromd->fill && tod->fill && pd->fill)
361 {
362 eo_do(pd->fill, r &= efl_vg_interpolate(fromd->fill, tod->fill, pos_map));
363 }
364 if (fromd->stroke.fill && tod->stroke.fill && pd->stroke.fill)
365 {
366 eo_do(pd->stroke.fill,
367 r &= efl_vg_interpolate(fromd->stroke.fill, tod->stroke.fill, pos_map));
368 }
369 if (fromd->stroke.marker && tod->stroke.marker && pd->stroke.marker)
370 {
371 eo_do(pd->stroke.marker,
372 r &= efl_vg_interpolate(fromd->stroke.marker, tod->stroke.marker, pos_map));
373 }
374
375 return r;
376}
377
344EAPI double 378EAPI double
345evas_vg_shape_stroke_scale_get(Eo *obj) 379evas_vg_shape_stroke_scale_get(Eo *obj)
346{ 380{