#define MY_CLASS EFL_CANVAS_VG_SHAPE_CLASS
-#ifdef HAVE_THORVG
#include "evas_vg_path_helper.h"
-#endif
-
-#ifdef HAVE_THORVG
#define DASH_PATTERN_EL_SIZE 2
PATH_CMD_TYPE_BEZIER_QUADRATIC /**< For svg path commands T/t/Q/q */
} Path_Cmd_Type;
-#endif
-
typedef struct _Efl_Canvas_Vg_Shape_Data Efl_Canvas_Vg_Shape_Data;
struct _Efl_Canvas_Vg_Shape_Data
struct {
Efl_Canvas_Vg_Node *fill;
- Efl_Canvas_Vg_Node *marker;
+ Efl_Canvas_Vg_Node *marker; //FIX_TVG: marker not supported
} stroke;
-#ifdef HAVE_THORVG
+
Tvg_Paint *shape;
//Variables need by cubic, squbic and arc_to. Used to recreate properly svg_path
//Flag indicates if shape was started. It is used to store start position
//and keep shape current point valid when shape close API is called.
Eina_Bool started;
-#endif
};
-#ifdef HAVE_THORVG
static inline double
_interpolate(double from, double to, double pos_map)
{
return EINA_TRUE;
}
-#endif
// FIXME: Use the renderer bounding box when it has been created instead of an estimation
static void
pd->fill = efl_ref(f);
efl_unref(tmp);
-#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, EVAS_VG_GRADIENT_OWNER_TYPE_SHAPE);
-#endif
}
static Efl_Canvas_Vg_Node *
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 *
return pd->stroke.marker;
}
-#ifndef HAVE_THORVG
-static void
-_efl_canvas_vg_shape_render_pre(Evas_Object_Protected_Data *vg_pd,
- Efl_VG *obj,
- Efl_Canvas_Vg_Node_Data *nd,
- void *engine, void *output, void *context,
- Ector_Surface *surface,
- Eina_Matrix3 *ptransform,
- int p_opacity,
- Ector_Buffer *comp,
- Efl_Gfx_Vg_Composite_Method comp_method,
- void *data)
-{
- Efl_Canvas_Vg_Shape_Data *pd = data;
- Efl_Canvas_Vg_Node_Data *fill, *stroke_fill, *stroke_marker;
-
- if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return;
-
- nd->flags = EFL_GFX_CHANGE_FLAG_NONE;
-
- EFL_CANVAS_VG_COMPUTE_MATRIX(ctransform, ptransform, nd);
- EFL_CANVAS_VG_COMPUTE_ALPHA(c_r, c_g, c_b, c_a, p_opacity, nd);
-
- fill = _evas_vg_render_pre(vg_pd, pd->fill,
- engine, output, context,
- surface, ctransform, c_a, comp, comp_method);
- stroke_fill = _evas_vg_render_pre(vg_pd, pd->stroke.fill,
- engine, output, context,
- surface, ctransform, c_a, comp, comp_method);
- stroke_marker = _evas_vg_render_pre(vg_pd, pd->stroke.marker,
- engine, output, context,
- surface, ctransform, c_a, comp, comp_method);
-
- if (!nd->renderer)
- {
- efl_domain_current_push(EFL_ID_DOMAIN_SHARED);
- nd->renderer = ector_surface_renderer_factory_new(surface, ECTOR_RENDERER_SHAPE_MIXIN);
- efl_domain_current_pop();
- }
- ector_renderer_transformation_set(nd->renderer, ctransform);
- ector_renderer_origin_set(nd->renderer, nd->x, nd->y);
- ector_renderer_color_set(nd->renderer, c_r, c_g, c_b, c_a);
- ector_renderer_visibility_set(nd->renderer, nd->visibility);
- ector_renderer_shape_fill_set(nd->renderer, fill ? fill->renderer : NULL);
- ector_renderer_shape_stroke_fill_set(nd->renderer, stroke_fill ? stroke_fill->renderer : NULL);
- ector_renderer_shape_stroke_marker_set(nd->renderer, stroke_marker ? stroke_marker->renderer : NULL);
- efl_gfx_path_copy_from(nd->renderer, obj);
- efl_gfx_path_commit(nd->renderer);
- ector_renderer_prepare(nd->renderer);
- ector_renderer_comp_method_set(nd->renderer, comp, comp_method);
-}
-#endif
-
-#ifdef HAVE_THORVG
static void
_efl_canvas_vg_shape_render_pre_tvg(EINA_UNUSED Evas_Object_Protected_Data *vg_pd,
Efl_VG *obj,
if (scene) tvg_scene_push(scene, sd->shape);
else if (canvas) tvg_canvas_push(canvas, sd->shape);
}
-#endif
static void
_efl_canvas_vg_shape_efl_gfx_path_bounds_get(const Eo *obj EINA_UNUSED,
Efl_Canvas_Vg_Shape_Data *sd,
Eina_Rect *r)
{
-#ifndef HAVE_THORVG
- efl_gfx_path_bounds_get(efl_super(obj, MY_CLASS), r);
-#else
float px, py, pw, ph;
tvg_paint_get_bounds(sd->shape, &px, &py, &pw, &ph);
r->x = (int)px;
r->y = (int)py;
r->w = (int)pw;
r->h = (int)ph;
-#endif
}
static Eo *
obj = efl_constructor(efl_super(obj, MY_CLASS));
nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
-#ifndef HAVE_THORVG
- efl_gfx_shape_stroke_scale_set(obj, 1);
- efl_gfx_shape_stroke_location_set(obj, 0.5);
- efl_gfx_shape_stroke_cap_set(obj, EFL_GFX_CAP_BUTT);
- efl_gfx_shape_stroke_join_set(obj, EFL_GFX_JOIN_MITER);
-
- //NOTE: The default value is 4. It only refers to the standard of web svg.
- // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit
- efl_gfx_shape_stroke_miterlimit_set(obj, 4);
-
- nd->render_pre = _efl_canvas_vg_shape_render_pre;
-#else
nd->render_pre_tvg = _efl_canvas_vg_shape_render_pre_tvg;
pd->shape = tvg_shape_new();
pd->scale = 1.0;
//default EFL implementation. We don't want to draw invisible shapes.
//when object is visible, renderer changes opacity to valid value.
tvg_paint_set_opacity(pd->shape, 0);
-#endif
nd->data = pd;
return obj;
if (pd->stroke.fill) efl_unref(pd->stroke.fill);
if (pd->stroke.marker) efl_unref(pd->stroke.marker);
-#ifdef HAVE_THORVG
tvg_paint_del(pd->shape);
-#else
- efl_gfx_path_reset(obj);
-#endif
efl_destructor(efl_super(obj, MY_CLASS));
}
static Eina_Bool
_efl_canvas_vg_shape_efl_gfx_path_interpolate(Eo *obj,
- Efl_Canvas_Vg_Shape_Data *pd,
+ Efl_Canvas_Vg_Shape_Data *pd EINA_UNUSED,
const Efl_Canvas_Vg_Node *from,
const Efl_Canvas_Vg_Node *to,
double pos_map)
{
- Eina_Bool r = EINA_TRUE;
-#ifndef HAVE_THORVG
- Efl_Canvas_Vg_Shape_Data *fromd, *tod;
-
- //Check if both objects have same type
- if (!(efl_isa(from, MY_CLASS) && efl_isa(to, MY_CLASS)))
- return EINA_FALSE;
-
- //Is this the best way?
- r &= efl_gfx_path_interpolate(efl_cast(obj, EFL_CANVAS_VG_NODE_CLASS),
- from, to, pos_map);
- r &= efl_gfx_path_interpolate(efl_super(obj, MY_CLASS), from, to, pos_map);
-
- fromd = efl_data_scope_get(from, MY_CLASS);
- tod = efl_data_scope_get(to, MY_CLASS);
-
- //Fill
- if (fromd->fill && tod->fill && pd->fill)
- r &= efl_gfx_path_interpolate(pd->fill, fromd->fill, tod->fill, pos_map);
-
- //Stroke Fill
- if (fromd->stroke.fill && tod->stroke.fill && pd->stroke.fill)
- r &= efl_gfx_path_interpolate(pd->stroke.fill, fromd->stroke.fill, tod->stroke.fill, pos_map);
-
- //Stroke Marker
- if (fromd->stroke.marker && tod->stroke.marker && pd->stroke.marker)
- r &= efl_gfx_path_interpolate(pd->stroke.marker, fromd->stroke.marker, tod->stroke.marker, pos_map);
-#else
- r = evas_vg_shape_interpolate(obj, from, to, pos_map);
-#endif
-
- return r;
+ return evas_vg_shape_interpolate(obj, from, to, pos_map);
}
EOLIAN static void
EOLIAN static Efl_Canvas_Vg_Node *
_efl_canvas_vg_shape_efl_duplicate_duplicate(const Eo *obj, Efl_Canvas_Vg_Shape_Data *pd)
{
-#ifndef HAVE_THORVG
- Efl_Canvas_Vg_Node *node;
- Efl_Canvas_Vg_Shape_Data *sd;
-
- node = efl_duplicate(efl_super(obj, MY_CLASS));
- sd = efl_data_scope_get(node, MY_CLASS);
-
- if (pd->fill)
- {
- sd->fill = efl_duplicate(pd->fill);
- efl_parent_set(sd->fill, efl_parent_get(node));
- }
-
- if (pd->stroke.fill)
- {
- sd->stroke.fill = efl_duplicate(pd->stroke.fill);
- efl_parent_set(sd->stroke.fill, efl_parent_get(node));
- }
-
- if (pd->stroke.marker)
- {
- sd->stroke.marker = efl_duplicate(pd->stroke.marker);
- efl_parent_set(sd->stroke.marker, efl_parent_get(node));
- }
-
- efl_gfx_path_copy_from(node, obj);
-
- return node;
-#else
Efl_Canvas_Vg_Node *node = NULL;
Efl_Canvas_Vg_Shape_Data *sd = NULL;
sd->cmd_prev = pd->cmd_prev;
return node;
-#endif
}
EAPI double
evas_vg_shape_stroke_scale_get(Evas_Vg_Shape *obj)
{
-#ifdef HAVE_THORVG
if (!obj) return 0;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
if (!sd) return 0;
return sd->scale;
-#else
- return efl_gfx_shape_stroke_scale_get(obj);
-#endif
}
EAPI void
evas_vg_shape_stroke_scale_set(Evas_Vg_Shape *obj, double s)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
sd->scale = s;
tvg_shape_set_stroke_width(sd->shape, sd->scale * sd->width);
-#else
- efl_gfx_shape_stroke_scale_set(obj, s);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_stroke_color_get(Evas_Vg_Shape *obj, int *r, int *g, int *b, int *a)
{
-#ifdef HAVE_THORVG
uint8_t r2, g2, b2, a2;
tvg_shape_get_stroke_color(_get_tvg_shape(obj), &r2, &g2, &b2, &a2);
if (r) *r = (uint32_t)r2;
*a = (uint32_t)a2;
evas_color_argb_premul(*a, r, g, b);
}
-#else
- efl_gfx_shape_stroke_color_get(obj, r, g, b, a);
-#endif
}
EAPI void
evas_vg_shape_stroke_color_set(Evas_Vg_Shape *obj, int r, int g, int b, int a)
{
-#ifdef HAVE_THORVG
evas_color_argb_unpremul(a, &r, &g, &b);
tvg_shape_set_stroke_color(_get_tvg_shape(obj), r, g, b, a);
-#else
- efl_gfx_shape_stroke_color_set(obj, r, g, b, a);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI double
evas_vg_shape_stroke_width_get(Evas_Vg_Shape *obj)
{
-#ifdef HAVE_THORVG
float w = 0.0;
tvg_shape_get_stroke_width(_get_tvg_shape(obj), &w);
return w;
-#else
- return efl_gfx_shape_stroke_width_get(obj);
-#endif
}
EAPI void
evas_vg_shape_stroke_width_set(Evas_Vg_Shape *obj, double w)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
sd->width = w;
tvg_shape_set_stroke_width(_get_tvg_shape(obj), sd->scale * sd->width);
-#else
- efl_gfx_shape_stroke_width_set(obj, w);
-#endif
+
efl_canvas_vg_node_change(obj);
}
evas_vg_shape_stroke_location_get(Evas_Vg_Shape *obj)
{
//TODO: implement
- return efl_gfx_shape_stroke_location_get(obj);
+ return 0.0;
}
EAPI void
evas_vg_shape_stroke_location_set(Evas_Vg_Shape *obj, double centered)
{
//TODO: implement
- efl_gfx_shape_stroke_location_set(obj, centered);
- efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_stroke_dash_get(Evas_Vg_Shape *obj, const Evas_Vg_Dash **dash, unsigned int *length)
{
-#ifdef HAVE_THORVG
if (!dash || !length) return;
const float *dashPattern;
*dash = d;
*length = cnt / 2;
-#else
- efl_gfx_shape_stroke_dash_get(obj, (const Efl_Gfx_Dash **)dash, length);
-#endif
}
EAPI void
evas_vg_shape_stroke_dash_set(Evas_Vg_Shape *obj, const Evas_Vg_Dash *dash, unsigned int length)
{
-#ifdef HAVE_THORVG
_dash_set(obj, dash, length);
-#else
- efl_gfx_shape_stroke_dash_set(obj, (const Efl_Gfx_Dash *)dash, length);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI Evas_Vg_Cap
evas_vg_shape_stroke_cap_get(Evas_Vg_Shape *obj)
{
-#ifdef HAVE_THORVG
Tvg_Stroke_Cap cap;
tvg_shape_get_stroke_cap(_get_tvg_shape(obj), &cap);
return _tvg_to_efl_stroke_cap(cap);
-#else
- return (Evas_Vg_Cap)efl_gfx_shape_stroke_cap_get(obj);
-#endif
}
EAPI void
evas_vg_shape_stroke_cap_set(Evas_Vg_Shape *obj, Evas_Vg_Cap c)
{
-#ifdef HAVE_THORVG
tvg_shape_set_stroke_cap(_get_tvg_shape(obj), _efl_to_tvg_stroke_cap(c));
-#else
- efl_gfx_shape_stroke_cap_set(obj, (Efl_Gfx_Cap)c);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI Evas_Vg_Join
evas_vg_shape_stroke_join_get(Evas_Vg_Shape *obj)
{
-#ifdef HAVE_THORVG
Tvg_Stroke_Join join;
tvg_shape_get_stroke_join(_get_tvg_shape(obj), &join);
return _tvg_to_efl_stroke_join(join);
-#else
- return (Evas_Vg_Join)efl_gfx_shape_stroke_join_get(obj);
-#endif
}
EAPI void
evas_vg_shape_stroke_join_set(Evas_Vg_Shape *obj, Evas_Vg_Join j)
{
-#ifdef HAVE_THORVG
tvg_shape_set_stroke_join(_get_tvg_shape(obj), _efl_to_tvg_stroke_join(j));
-#else
- efl_gfx_shape_stroke_join_set(obj, (Efl_Gfx_Join)j);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_fill_rule_set(Evas_Vg_Shape *obj, Evas_Vg_Fill_Rule r)
{
-#ifdef HAVE_THORVG
tvg_shape_set_fill_rule(_get_tvg_shape(obj), (Tvg_Stroke_Cap) r);
-#else
- efl_gfx_shape_fill_rule_set(obj, (Efl_Gfx_Fill_Rule) r);
-#endif
}
EAPI void
{
if (!op || !points) return;
-#ifdef HAVE_THORVG
unsigned int cmd_length = 0;
unsigned int pts_length = 0;
unsigned int i = 0, k = 0;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
if (!sd) return;
+
if (pts_length >= 2) _assign_current_point(sd, NULL, points[pts_length - 2], points[pts_length - 1]);
-#else
- efl_gfx_path_set(obj, (const Efl_Gfx_Path_Command *)op, points);
-#endif
+
efl_canvas_vg_node_change(obj);
}
evas_vg_shape_path_get(Evas_Vg_Shape *obj, const Evas_Vg_Path_Command **op, const double **points)
{
if (!op || !points) return;
-#ifdef HAVE_THORVG
+
unsigned int i = 0, j = 0;
Evas_Vg_Path_Command *evas_cmds = NULL;
double *evas_pts = NULL;
*points = evas_pts;
}
else *points = NULL;
-
-#else
- efl_gfx_path_get(obj, (const Efl_Gfx_Path_Command **)op, points);
-#endif
}
EAPI void
evas_vg_shape_path_length_get(Evas_Vg_Shape *obj, unsigned int *commands, unsigned int *points)
{
-#ifdef HAVE_THORVG
Tvg_Paint *tvg_shape = _get_tvg_shape(obj);
if (!tvg_shape) return;
//evas array stores x, y coordinates in one array, tvg use array of points
*points = *points * 2;
-
-#else
- efl_gfx_path_length_get(obj, commands, points);
-#endif
}
EAPI void
evas_vg_shape_current_get(Evas_Vg_Shape *obj, double *x, double *y)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
if (x) *x = sd->curr.x;
if (y) *y = sd->curr.y;
-#else
- efl_gfx_path_current_get(obj, x, y);
-#endif
}
EAPI void
evas_vg_shape_current_ctrl_get(Evas_Vg_Shape *obj, double *x, double *y)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
if (x) *x = sd->curr_ctrl.x;
if (y) *y = sd->curr_ctrl.y;
-#else
- efl_gfx_path_current_ctrl_get(obj, x, y);
-#endif
}
EAPI void
evas_vg_shape_dup(Evas_Vg_Shape *obj, Evas_Vg_Shape *dup_from)
{
-#ifdef HAVE_THORVG
_shape_dup(obj, dup_from);
-#else
- efl_gfx_path_copy_from(obj, dup_from);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_reset(Evas_Vg_Shape *obj)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Node_Data* nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
sd->start.x = sd->start.y = 0;
tvg_shape_reset(sd->shape);
-#else
- efl_gfx_path_reset(obj);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_move_to(Evas_Vg_Shape *obj, double x, double y)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
tvg_shape_move_to(sd->shape, x, y);
_assign_current_point(sd, NULL, x, y);
sd->cmd_prev = PATH_CMD_TYPE_NO_BEZIER;
-#else
- efl_gfx_path_append_move_to(obj, x, y);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_line_to(Evas_Vg_Shape *obj, double x, double y)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
tvg_shape_line_to(sd->shape, x, y);
_assign_current_point(sd, NULL, x, y);
sd->cmd_prev = PATH_CMD_TYPE_NO_BEZIER;
-#else
- efl_gfx_path_append_line_to(obj, x, y);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_quadratic_to(Evas_Vg_Shape *obj, double x, double y, double ctrl_x, double ctrl_y)
{
-#ifdef HAVE_THORVG
_append_quadratic(obj, x, y, ctrl_x, ctrl_y);
-#else
- efl_gfx_path_append_quadratic_to(obj, x, y, ctrl_x, ctrl_y);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_squadratic_to(Evas_Vg_Shape *obj, double x, double y)
{
-#ifdef HAVE_THORVG
_append_squadratic(obj, x, y);
-#else
- efl_gfx_path_append_squadratic_to(obj, x, y);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_cubic_to(Evas_Vg_Shape *obj, double x, double y, double ctrl_x0, double ctrl_y0, double ctrl_x1, double ctrl_y1)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
_assign_current_point(sd, NULL, x, y);
_assign_current_ctrl_point(sd, ctrl_x1, ctrl_y1);
sd->cmd_prev = PATH_CMD_TYPE_BEZIER_CUBIC;
-#else
- efl_gfx_path_append_cubic_to(obj, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1, x, y);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_scubic_to(Evas_Vg_Shape *obj, double x, double y, double ctrl_x, double ctrl_y)
{
-#ifdef HAVE_THORVG
_append_scubic_to(obj, x, y, ctrl_x, ctrl_y);
-#else
- efl_gfx_path_append_scubic_to(obj, x, y, ctrl_x, ctrl_y);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_arc_to(Evas_Vg_Shape *obj, double x, double y, double rx, double ry, double angle, Eina_Bool large_arc, Eina_Bool sweep)
{
-#ifdef HAVE_THORVG
_append_arc_to(obj, x, y, rx, ry, angle, large_arc, sweep);
-#else
- efl_gfx_path_append_arc_to(obj, x, y, rx, ry, angle, large_arc, sweep);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_arc(Evas_Vg_Shape *obj, double x, double y, double w, double h, double start_angle, double sweep_length)
{
-#ifndef HAVE_THORVG
- efl_gfx_path_append_arc(obj, x, y, w, h, start_angle, sweep_length);
-#else
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
pts[i+2].x, pts[i+2].y);
_assign_current_point(sd, NULL, pts[i+2].x, pts[i+2].y);
}
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_close(Evas_Vg_Shape *obj)
{
-#ifdef HAVE_THORVG
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
if (!sd) return;
sd->curr.x = sd->start.x;
sd->curr.y = sd->start.y;
-#else
- efl_gfx_path_append_close(obj);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_circle(Evas_Vg_Shape *obj, double x, double y, double radius)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
tvg_shape_append_circle(sd->shape, x, y, radius, radius);
tvg_shape_move_to(sd->shape, x + radius, y);
_assign_current_point(sd, NULL, x + radius, y);
-#else
- efl_gfx_path_append_circle(obj, x, y, radius);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_ellipse(Evas_Vg_Shape *obj, double cx, double cy, double rx, double ry)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
tvg_shape_append_circle(sd->shape, cx, cy, rx, ry);
tvg_shape_move_to(sd->shape, cx + rx, cy);
_assign_current_point(sd, NULL, cx + rx, cy);
-#else
- efl_gfx_path_append_arc(obj, cx - rx, cy - ry, 2 * rx, 2 * ry, 0, 360);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_rect(Evas_Vg_Shape *obj, double x, double y, double w, double h, double rx, double ry)
{
-#ifdef HAVE_THORVG
if (!obj) return;
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
_assign_current_point(sd, NULL, x, y + ry);
tvg_shape_move_to(sd->shape, x, y + h/2);
}
-#else
- efl_gfx_path_append_rect(obj, x, y, w, h, rx, ry);
-#endif
+
efl_canvas_vg_node_change(obj);
}
EAPI void
evas_vg_shape_append_svg_path(Evas_Vg_Shape *obj, const char *svg_path_data)
{
-#ifdef HAVE_THORVG
#define SVG_PATH_NUM_LEN 7
Efl_Canvas_Vg_Shape_Data *sd = _get_shape_data(obj);
if (svg_path.cmds) free(svg_path.cmds);
if (svg_path.pts) free(svg_path.pts);
-#else
- efl_gfx_path_append_svg_path(obj, svg_path_data);
-#endif
+
efl_canvas_vg_node_change(obj);
}
evas_vg_shape_interpolate(Evas_Vg_Shape *obj, const Evas_Vg_Shape *from, const Evas_Vg_Shape *to, double pos_map)
{
Eina_Bool ret = EINA_FALSE;
-#ifdef HAVE_THORVG
+
if (!evas_vg_shape_equal_commands((Evas_Vg_Shape*)from, (Evas_Vg_Shape*)to)) return EINA_FALSE;
ret = _shape_interpolate(obj, from, to, pos_map);
-#else
- ret = efl_gfx_path_interpolate(obj, from, to, pos_map);
-#endif
+
efl_canvas_vg_node_change(obj);
return ret;
}
EAPI Eina_Bool
evas_vg_shape_equal_commands(Evas_Vg_Shape *obj, const Evas_Vg_Shape *with)
{
-#ifdef HAVE_THORVG
const Tvg_Path_Command *cmds = NULL;
const Tvg_Path_Command *cmds_with = NULL;
}
return EINA_TRUE;
-#else
- return efl_gfx_path_equal_commands(obj, with);
-#endif
}
EAPI Efl_Canvas_Vg_Shape*