From 29e9c8a0bf0b70295fd2668958104180c69da569 Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Tue, 16 Mar 2021 11:35:41 +0100 Subject: [PATCH] evas vg: added shape fill rule Added brief comments, removed trailing spaces Change-Id: Id041734c0a96ed4652d04967e47326260f9a4e37 --- src/lib/evas/Evas_Legacy.h | 31 ++++++++++++++++++++++++++++++ src/lib/evas/canvas/efl_canvas_vg_shape.c | 10 ++++++++++ src/static_libs/vg_common/vg_common_json.c | 6 ++---- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 2e79f8e..36e8dfc 100755 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -3833,6 +3833,27 @@ typedef enum Evas_Vg_Gradient_Spread_Type } Evas_Vg_Gradient_Spread; /** + * @brief Specifies how an image content get filled. + * @ref evas_vg_shape_fill_rule_set + * + * @since 1.25.1 + */ +typedef enum Evas_Vg_Fill_Rule_Type +{ + EVAS_VG_FILL_RULE_WINDING = 0, /**< Draw a horizontal line from the point to + * a location outside the shape. Determine whether + * the direction of the line at each intersection point + * is up or down. The winding number is determined by + * summing the direction of each intersection. If the number + * is non zero, the point is inside the shape. This mode is + * the default */ + EVAS_VG_FILL_RULE_ODD_EVEN /**< Draw a horizontal line from the point to a location outside + * the shape, and count the number of intersections. If the number + * of intersections is an odd number, the point is inside the + * shape. */ +} Evas_Vg_Fill_Rule; + +/** * @brief Type describing dash. * @ref evas_vg_shape_stroke_dash_set * @@ -4206,6 +4227,16 @@ EAPI Evas_Vg_Join evas_vg_shape_stroke_join_get(Evas_Vg_Shape *obj); EAPI void evas_vg_shape_stroke_join_set(Evas_Vg_Shape *obj, Evas_Vg_Join j); /** + * @brief Sets the fill rule to be used. + * + * @param[in] obj The object. + * @param[in] r The fill rule to use, default is EVAS_VG_FILL_RULE_WINDING. + * + * @since 1.25.1 + */ +EAPI void evas_vg_shape_fill_rule_set(Evas_Vg_Shape *obj, Evas_Vg_Fill_Rule r); + +/** * @brief Set the list of commands and points to be used to create the * content of shape. * diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c index b13a0cc..216807b 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_shape.c +++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c @@ -1133,6 +1133,16 @@ evas_vg_shape_stroke_join_set(Evas_Vg_Shape *obj, Evas_Vg_Join j) } 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 evas_vg_shape_path_set(Evas_Vg_Shape *obj, const Evas_Vg_Path_Command *op, const double *points) { if (!op || !points) return; diff --git a/src/static_libs/vg_common/vg_common_json.c b/src/static_libs/vg_common/vg_common_json.c index 352f1b3..1bd7465 100644 --- a/src/static_libs/vg_common/vg_common_json.c +++ b/src/static_libs/vg_common/vg_common_json.c @@ -250,12 +250,10 @@ _construct_drawable_nodes(Efl_Canvas_Vg_Container *parent, const LOTLayerNode *l } //3: Fill Rule - #ifndef HAVE_THORVG if (node->mFillRule == FillEvenOdd) - efl_gfx_shape_fill_rule_set(shape, EFL_GFX_FILL_RULE_ODD_EVEN); + evas_vg_shape_fill_rule_set(shape, EVAS_VG_FILL_RULE_ODD_EVEN); else if (node->mFillRule == FillWinding) - efl_gfx_shape_fill_rule_set(shape, EFL_GFX_FILL_RULE_WINDING); - #endif + evas_vg_shape_fill_rule_set(shape, EVAS_VG_FILL_RULE_WINDING); } } -- 2.7.4