From c1118e728210b249f9577ad87081ad241507361f Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 3 Apr 2015 16:23:20 +0200 Subject: [PATCH] evas: implement Efl.Gfx.Base in Evas.VG_Node. --- src/lib/evas/canvas/evas_vg_node.c | 52 +++++++++++++++++++++++------ src/lib/evas/canvas/evas_vg_node.eo | 52 +++++------------------------ 2 files changed, 50 insertions(+), 54 deletions(-) diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c index 95467a036d..fbe0a60a9f 100644 --- a/src/lib/evas/canvas/evas_vg_node.c +++ b/src/lib/evas/canvas/evas_vg_node.c @@ -4,6 +4,7 @@ #include "evas_vg_private.h" #include +#include #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, diff --git a/src/lib/evas/canvas/evas_vg_node.eo b/src/lib/evas/canvas/evas_vg_node.eo index b7df4693e9..108c2eb2c7 100644 --- a/src/lib/evas/canvas/evas_vg_node.eo +++ b/src/lib/evas/canvas/evas_vg_node.eo @@ -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,49 +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, which range from 0 to 255. 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 { } @@ -173,6 +130,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; } } \ No newline at end of file