evas vg: added shape fill rule 01/255301/4 accepted/tizen/unified/20210319.141010 submit/tizen/20210318.015037
authorMichal Maciola <m.maciola@samsung.com>
Tue, 16 Mar 2021 10:35:41 +0000 (11:35 +0100)
committerHermet Park <chuneon.park@samsung.com>
Wed, 17 Mar 2021 11:48:55 +0000 (11:48 +0000)
Added brief comments, removed trailing spaces

Change-Id: Id041734c0a96ed4652d04967e47326260f9a4e37

src/lib/evas/Evas_Legacy.h
src/lib/evas/canvas/efl_canvas_vg_shape.c
src/static_libs/vg_common/vg_common_json.c

index 2e79f8e..36e8dfc 100755 (executable)
@@ -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.
  *
index b13a0cc..216807b 100644 (file)
@@ -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;
index 352f1b3..1bd7465 100644 (file)
@@ -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);
      }
 }