#else
static void
_gradient_linear_render_pre_tvg(Efl_Canvas_Vg_Gradient_Data *gd,
- Tvg_Paint *shape)
+ Tvg_Paint *shape,
+ Evas_Vg_Gradient_Owner_Type owner)
{
if (!gd || !shape) return;
//FIX_TVG: ignore the flag.... if nothing changed, do it needs to call again?
- tvg_shape_set_linear_gradient(shape, gd->gradient);
+ if (owner == EVAS_VG_GRADIENT_OWNER_TYPE_SHAPE)
+ tvg_shape_set_linear_gradient(shape, gd->gradient);
+ else if (owner == EVAS_VG_GRADIENT_OWNER_TYPE_STROKE)
+ tvg_shape_set_stroke_linear_gradient(shape, gd->gradient);
}
#endif
#else
static void
_gradient_radial_render_pre_tvg(Efl_Canvas_Vg_Gradient_Data *gd,
- Tvg_Paint *shape)
+ Tvg_Paint *shape,
+ Evas_Vg_Gradient_Owner_Type owner)
{
if (!gd || !gd->gradient || !shape) return;
- tvg_shape_set_radial_gradient(shape, gd->gradient);
+
+ if (owner == EVAS_VG_GRADIENT_OWNER_TYPE_SHAPE)
+ tvg_shape_set_radial_gradient(shape, gd->gradient);
+ else if (owner == EVAS_VG_GRADIENT_OWNER_TYPE_STROKE)
+ tvg_shape_set_stroke_radial_gradient(shape, gd->gradient);
}
#endif
if (gd) gd->gradient = grad;
}
+ if (sd_from->stroke.fill)
+ {
+ Efl_Canvas_Vg_Gradient_Data *gd = NULL;
+ Tvg_Gradient *grad = NULL;
+ sd->stroke.fill = efl_duplicate(sd_from->stroke.fill);
+ tvg_shape_get_stroke_gradient(sd_from->shape, &grad);
+ gd = efl_data_scope_get(sd->stroke.fill, EFL_CANVAS_VG_GRADIENT_CLASS);
+ if (gd) gd->gradient = grad;
+ }
+
sd->curr_ctrl.x = sd_from->curr_ctrl.x;
sd->curr_ctrl.y = sd_from->curr_ctrl.y;
#ifdef HAVE_THORVG
Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(pd->fill, EFL_CANVAS_VG_GRADIENT_CLASS);
- if (gd) gd->gradient_render_pre_tvg(gd, pd->shape);
+ if (gd) gd->gradient_render_pre_tvg(gd, pd->shape, EVAS_VG_GRADIENT_OWNER_TYPE_SHAPE);
#endif
}
{
if (pd->stroke.fill == f) return;
+ if (efl_isa(pd->stroke.fill, EFL_CANVAS_VG_GRADIENT_CLASS))
+ {
+ efl_del(pd->stroke.fill);
+ pd->stroke.fill = NULL;
+ }
+
Efl_Canvas_Vg_Node *tmp = pd->stroke.fill;
pd->stroke.fill = efl_ref(f);
efl_unref(tmp);
+
+#ifdef HAVE_THORVG
+ Efl_Canvas_Vg_Gradient_Data *gd = efl_data_scope_get(pd->stroke.fill, EFL_CANVAS_VG_GRADIENT_CLASS);
+ if (gd) gd->gradient_render_pre_tvg(gd, pd->shape, EVAS_VG_GRADIENT_OWNER_TYPE_STROKE);
+#endif
}
static Efl_Canvas_Vg_Node *
if (gd)
{
gd->shape = obj;
- gd->gradient_render_pre_tvg(gd, sd->shape);
+ gd->gradient_render_pre_tvg(gd, sd->shape, EVAS_VG_GRADIENT_OWNER_TYPE_SHAPE);
}
}
if (gd) gd->gradient = grad;
}
+ if (pd->stroke.fill)
+ {
+ Tvg_Gradient *grad = NULL;
+ Efl_Canvas_Vg_Gradient_Data *gd = NULL;
+
+ sd->stroke.fill = efl_duplicate(pd->stroke.fill);
+ tvg_shape_get_stroke_gradient(sd->shape, &grad);
+ gd = efl_data_scope_get(sd->stroke.fill, EFL_CANVAS_VG_GRADIENT_CLASS);
+ if (gd) gd->gradient = grad;
+ }
+
sd->curr_ctrl = pd->curr_ctrl;
sd->curr = pd->curr;
sd->start = pd->start;
#include <Ector.h>
#endif
+#ifdef HAVE_THORVG
+typedef enum
+{
+ EVAS_VG_GRADIENT_OWNER_TYPE_SHAPE = 0, /**< Gradient set as the fill of the shape */
+ EVAS_VG_GRADIENT_OWNER_TYPE_STROKE /**< Gradient set as the fill of the shape's stroke */
+} Evas_Vg_Gradient_Owner_Type;
+#endif
+
typedef struct _Efl_Canvas_Vg_Node_Data Efl_Canvas_Vg_Node_Data;
typedef struct _Efl_Canvas_Vg_Container_Data Efl_Canvas_Vg_Container_Data;
typedef struct _Efl_Canvas_Vg_Gradient_Data Efl_Canvas_Vg_Gradient_Data;
#ifdef HAVE_THORVG
Tvg_Gradient *gradient;
Evas_Vg_Shape *shape;
- void (*gradient_render_pre_tvg)(Efl_Canvas_Vg_Gradient_Data *gd, Tvg_Paint *shape);
+ void (*gradient_render_pre_tvg)(Efl_Canvas_Vg_Gradient_Data *gd, Tvg_Paint *shape, Evas_Vg_Gradient_Owner_Type owner);
#endif
};