evas: implement Efl.Gfx.Base in Evas.VG_Node. 58/43258/1
authorCedric BAIL <cedric@osg.samsung.com>
Tue, 3 Feb 2015 23:16:48 +0000 (00:16 +0100)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Wed, 8 Jul 2015 02:09:51 +0000 (11:09 +0900)
Change-Id: I1ae0c245ab9bbb26fc5c4b2f424cfc42a8da926e

src/lib/evas/canvas/evas_vg_node.c
src/lib/evas/canvas/evas_vg_node.eo

index 3e28814..f426d64 100644 (file)
@@ -4,6 +4,7 @@
 #include "evas_vg_private.h"
 
 #include <string.h>
+#include <math.h>
 
 #define MY_CLASS EVAS_VG_NODE_CLASS
 
@@ -50,23 +51,42 @@ _evas_vg_node_origin_get(Eo *obj EINA_UNUSED,
 }
 
 void
-_evas_vg_node_visibility_set(Eo *obj EINA_UNUSED,
-                             Evas_VG_Node_Data *pd,
-                             Eina_Bool v)
+_evas_vg_node_efl_gfx_base_position_set(Eo *obj EINA_UNUSED,
+                                        Evas_VG_Node_Data *pd,
+                                        int x, int y)
+{
+   pd->x = lrint(x);
+   pd->y = lrint(y);
+}
+
+void
+_evas_vg_node_efl_gfx_base_position_get(Eo *obj EINA_UNUSED,
+                                        Evas_VG_Node_Data *pd,
+                                        int *x, int *y)
+{
+   if (x) *x = pd->x;
+   if (y) *y = pd->y;
+}
+
+void
+_evas_vg_node_efl_gfx_base_visible_set(Eo *obj EINA_UNUSED,
+                                       Evas_VG_Node_Data *pd, Eina_Bool v)
 {
    pd->visibility = v;
 }
 
+
 Eina_Bool
-_evas_vg_node_visibility_get(Eo *obj EINA_UNUSED, Evas_VG_Node_Data *pd)
+_evas_vg_node_efl_gfx_base_visible_get(Eo *obj EINA_UNUSED,
+                                       Evas_VG_Node_Data *pd)
 {
    return pd->visibility;
 }
 
 void
-_evas_vg_node_color_set(Eo *obj EINA_UNUSED,
-                        Evas_VG_Node_Data *pd,
-                        int r, int g, int b, int a)
+_evas_vg_node_efl_gfx_base_color_set(Eo *obj EINA_UNUSED,
+                                     Evas_VG_Node_Data *pd,
+                                     int r, int g, int b, int a)
 {
    pd->r = r;
    pd->g = g;
@@ -75,9 +95,9 @@ _evas_vg_node_color_set(Eo *obj EINA_UNUSED,
 }
 
 void
-_evas_vg_node_color_get(Eo *obj EINA_UNUSED,
-                        Evas_VG_Node_Data *pd,
-                        int *r, int *g, int *b, int *a)
+_evas_vg_node_efl_gfx_base_color_get(Eo *obj EINA_UNUSED,
+                                     Evas_VG_Node_Data *pd,
+                                     int *r, int *g, int *b, int *a)
 {
    if (r) *r = pd->r;
    if (g) *g = pd->g;
@@ -102,6 +122,18 @@ _evas_vg_node_mask_get(Eo *obj EINA_UNUSED, Evas_VG_Node_Data *pd)
    return pd->mask;
 }
 
+void
+_evas_vg_node_efl_gfx_base_size_get(Eo *obj,
+                                    Evas_VG_Node_Data *pd EINA_UNUSED,
+                                    int *w, int *h)
+{
+   Eina_Rectangle bound = { 0, 0, 0, 0 };
+
+   eo_do(obj, evas_vg_node_bound_get(&bound));
+   if (w) *w = bound.w;
+   if (h) *h = bound.h;
+}
+
 // Parent should be a container otherwise dismissing the stacking operation
 static Eina_Bool
 _evas_vg_node_parent_checked_get(Eo *obj,
index a05f685..e9b9f20 100644 (file)
@@ -1,4 +1,4 @@
-abstract Evas.VG_Node (Eo.Base)
+abstract Evas.VG_Node (Eo.Base, Efl.Gfx.Base)
 {
    eo_prefix: evas_vg_node;
    legacy_prefix: null;
@@ -22,45 +22,6 @@ abstract Evas.VG_Node (Eo.Base)
             double y;
          }
       }
-      visibility {
-         set {
-            /*@ Makes the given Evas_VG node visible or invisible. */
-         }
-         get {
-            /*@ Retrieves whether or not the given Evas_VG node is visible. */
-         }
-         values {
-            Eina_Bool v; /*@ @c EINA_TRUE if to make the object visible,
-                             @c EINA_FALSE otherwise */
-         }
-      }
-      color {
-         set {
-            /*@
-             Sets the general/main color of the given Evas_VG node to the given
-             one.
-             @note These color values are expected to be premultiplied by @p a.
-             @ingroup Evas_VG_Node_Group */
-         }
-         get {
-            /*@
-             Retrieves the general/main color of the given Evas_VG node.
-             Retrieves the “main” color's RGB component (and alpha channel)
-             values, <b>which range from 0 to 255</b>. For the alpha channel,
-             which defines the object's transparency level, 0 means totally
-             transparent, while 255 means opaque. These color values are
-             premultiplied by the alpha value.
-             @note Use @c NULL pointers on the components you're not
-                   interested in: they'll be ignored by the function.
-             @ingroup Evas_VG_Node_Group */
-         }
-         values {
-            int r; /*@ The red component of the given color. */
-            int g; /*@ The green component of the given color. */
-            int b; /*@ The blue component of the given color. */
-            int a; /*@ The alpha component of the given color. */
-         }
-      }
       mask {
          set {
          }
@@ -164,6 +125,13 @@ abstract Evas.VG_Node (Eo.Base)
    implements {
       Eo.Base.parent.set;
       Eo.Base.constructor;
+      Efl.Gfx.Base.visible.set;
+      Efl.Gfx.Base.visible.get;
+      Efl.Gfx.Base.color.set;
+      Efl.Gfx.Base.color.get;
+      Efl.Gfx.Base.size.get;
+      Efl.Gfx.Base.position.set;
+      Efl.Gfx.Base.position.get;
       @virtual .bound_get;
    }
 }