evas: implement Efl.Gfx.Base in Evas.VG_Node.

This commit is contained in:
Cedric BAIL 2015-04-03 16:23:20 +02:00
parent 651436f410
commit c1118e7282
2 changed files with 50 additions and 54 deletions

View 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,

View 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,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, <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 {
}
@ -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;
}
}