Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(obj, MY_CLASS);
if (!gd) return;
- Tvg_Color_Stop *color_stops = malloc(sizeof(Tvg_Color_Stop) * length);
+ Tvg_Color_Stop *color_stops = malloc(sizeof(Tvg_Color_Stop) * length);
if (!color_stops) return;
unsigned int i = 0;
static Eina_Bool
_efl_canvas_vg_gradient_efl_gfx_path_interpolate(Eo *obj,
- Efl_Canvas_Vg_Gradient_Data *pd,
+ Efl_Canvas_Vg_Gradient_Data *pd EINA_UNUSED,
const Efl_VG *from, const Efl_VG *to,
double pos_map)
{
if (!r) return EINA_FALSE;
if (fromd->colors_count != tod->colors_count) return EINA_FALSE;
+#ifndef HAVE_THORVG
colors = realloc(pd->colors, sizeof (Efl_Gfx_Gradient_Stop) * tod->colors_count);
if (!colors) return EINA_FALSE;
-
pd->colors = colors;
#define INTP(Pd, From, To, I, Member, From_Map, Pos_Map) \
#undef INTP
+#else
+ unsigned len = 0, from_len = 0, to_len = 0;
+
+ Efl_Gfx_Gradient_Stop *fcolors, *tcolors;
+
+ _gradient_stop_get(obj, &colors, &len);
+ _gradient_stop_get((Efl_VG*) from, &fcolors, &from_len);
+ _gradient_stop_get((Efl_VG*) to, &tcolors, &to_len);
+
+ if (from_len != to_len) return EINA_FALSE;
+
+#define INTP(destination, f, t, I, Member, From_Map, Pos_Map) \
+ destination[I].Member = f[I].Member * From_Map + t[I].Member * Pos_Map
+
+ for (i = 0; i < len; i++)
+ {
+ INTP(colors, fcolors, tcolors, i, offset, from_map, pos_map);
+ INTP(colors, fcolors, tcolors, i, r, from_map, pos_map);
+ INTP(colors, fcolors, tcolors, i, g, from_map, pos_map);
+ INTP(colors, fcolors, tcolors, i, b, from_map, pos_map);
+ INTP(colors, fcolors, tcolors, i, a, from_map, pos_map);
+ }
+
+#undef INTP
+
+ _gradient_stop_set(obj, colors, len);
+#endif
return EINA_TRUE;
}
static void
_efl_canvas_vg_gradient_efl_object_destructor(Eo *obj, Efl_Canvas_Vg_Gradient_Data *pd)
{
-#ifdef HAVE_THORVG
-#endif
if (pd->colors) free(pd->colors);
efl_destructor(efl_super(obj, MY_CLASS));
}
double pos_map)
{
Efl_Canvas_Vg_Gradient_Linear_Data *fromd, *tod;
+ Efl_Canvas_Vg_Gradient_Data *gd;
+
double from_map;
Eina_Bool r;
#undef INTP
+#ifdef HAVE_THORVG
+ gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
+ if (!gd) return EINA_FALSE;
+
+ tvg_linear_gradient_set(gd->gradient, pd->start.x, pd->start.y, pd->end.x, pd->end.y);
+#endif
return EINA_TRUE;
}
evas_vg_gradient_linear_start_set(Evas_Vg_Gradient_Linear *obj, double x, double y)
{
#ifdef HAVE_THORVG
+ Efl_Canvas_Vg_Gradient_Linear_Data *lgd = NULL;
+ Efl_Canvas_Vg_Gradient_Data *gd = NULL;
+
if (!obj) return;
- Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
+ lgd = efl_data_scope_get(obj, MY_CLASS);
+ if (!lgd) return;
+
+ lgd->start.x = x;
+ lgd->start.y = y;
+
+ gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
if (!gd) return;
float x2 = 0.f, y2 = 0.f;
evas_vg_gradient_linear_end_set(Evas_Vg_Gradient_Linear *obj, double x, double y)
{
#ifdef HAVE_THORVG
+ Efl_Canvas_Vg_Gradient_Linear_Data *lgd = NULL;
+ Efl_Canvas_Vg_Gradient_Data *gd = NULL;
+
if (!obj) return;
- Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
+ lgd = efl_data_scope_get(obj, MY_CLASS);
+ if (!lgd) return;
+
+ lgd->end.x = x;
+ lgd->end.y = y;
+
+ gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
if (!gd) return;
float x1 = 0.f, y1 = 0.f;
#undef INTP
+#ifdef HAVE_THORVG
+ Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
+ tvg_radial_gradient_set(gd->gradient, pd->center.x, pd->center.y, pd->radius);
+#endif
+
return EINA_TRUE;
}
if (!obj) return;
Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
- if (!gd) return;
+ Efl_Canvas_Vg_Gradient_Radial_Data *rgd = efl_data_scope_get(obj, MY_CLASS);
+ if (!gd || !rgd) return;
float r = 0.0f;
tvg_radial_gradient_get(gd->gradient, NULL, NULL, &r);
tvg_radial_gradient_set(gd->gradient, x, y, r);
+ rgd->center.x = x;
+ rgd->center.y = y;
+
if (gd->shape) efl_canvas_vg_node_change(gd->shape);
#else
efl_gfx_gradient_radial_center_set(obj, x, y);
if (!obj) return;
Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
- if (!gd) return;
+ Efl_Canvas_Vg_Gradient_Radial_Data *rgd = efl_data_scope_get(obj, MY_CLASS);
+ if (!gd || !rgd) return;
float x = 0.0f, y = 0.0f;
tvg_radial_gradient_get(gd->gradient, &x, &y, NULL);
tvg_radial_gradient_set(gd->gradient, x, y, r);
+ rgd->radius = r;
if (gd->shape) efl_canvas_vg_node_change(gd->shape);
#else
sd->curr_ctrl.x = _interpolate(sd_from->curr_ctrl.x, sd_to->curr_ctrl.x, pos_map);
sd->curr_ctrl.y = _interpolate(sd_from->curr_ctrl.y, sd_to->curr_ctrl.y, pos_map);
+ //Fill
+ if (sd_from->fill && sd_to->fill && sd->fill)
+ r &= efl_gfx_path_interpolate(sd->fill, sd_from->fill, sd_to->fill, pos_map);
+
+ //Stroke Fill
+ if (sd_from->stroke.fill && sd_to->stroke.fill && sd->stroke.fill)
+ r &= efl_gfx_path_interpolate(sd->stroke.fill, sd_from->stroke.fill, sd_to->stroke.fill, pos_map);
+
+ //Stroke Marker
+ if (sd_from->stroke.marker && sd_to->stroke.marker && sd->stroke.marker)
+ r &= efl_gfx_path_interpolate(sd->stroke.marker, sd_from->stroke.marker, sd_to->stroke.marker, pos_map);
+
return EINA_TRUE;
}