From 991cbad675827209952fa46a9c8811b179ab9044 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 23 Dec 2014 16:48:51 +0100 Subject: [PATCH] efl: add a gradient interface. Change-Id: I91b8d127b0d059dde3ca207954487817e4608ab2 --- src/Makefile_Efl.am | 3 ++- src/lib/efl/Efl.h | 27 +++++++++++++++++++ src/lib/efl/interfaces/efl_graphics_gradient.eo | 26 ++++++++++++++++++ src/lib/efl/interfaces/efl_interfaces_main.c | 1 + src/lib/evas/Evas_Eo.h | 18 ------------- src/lib/evas/canvas/evas_vg_gradient.c | 36 ++++++++++++------------- src/lib/evas/canvas/evas_vg_gradient.eo | 27 +++++-------------- 7 files changed, 80 insertions(+), 58 deletions(-) create mode 100644 src/lib/efl/interfaces/efl_graphics_gradient.eo diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index 0336e8f..815c78a 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -5,7 +5,8 @@ efl_eolian_files = \ lib/efl/interfaces/efl_player.eo \ lib/efl/interfaces/efl_text.eo \ lib/efl/interfaces/efl_text_properties.eo \ - lib/efl/interfaces/efl_graphics_shape.eo + lib/efl/interfaces/efl_graphics_shape.eo \ + lib/efl/interfaces/efl_graphics_gradient.eo efl_eolian_files_h = $(efl_eolian_files:%.eo=%.eo.h) efl_eolian_files_c = $(efl_eolian_files:%.eo=%.eo.c) diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index fe798ed..a86d018 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -100,7 +100,34 @@ typedef enum _Efl_Graphics_Join EFL_GRAPHICS_JOIN_LAST } Efl_Graphics_Join; +/** + * Type defining gradient stop. + * @since 1.13 + */ +typedef struct _Efl_Graphics_Gradient_Stop Efl_Graphics_Gradient_Stop; +struct _Efl_Graphics_Gradient_Stop +{ + double offset; + int r; + int g; + int b; + int a; +}; + +/** + * Type defining how the gradient spread after its limit. + * @since 1.13 + */ +typedef enum _Efl_Graphics_Gradient_Spread +{ + EFL_GRAPHICS_GRADIENT_SPREAD_PAD, + EFL_GRAPHICS_GRADIENT_SPREAD_REFLECT, + EFL_GRAPHICS_GRADIENT_SPREAD_REPEAT, + EFL_GRAPHICS_GRADIENT_SPREAD_LAST +} Efl_Graphics_Gradient_Spread; + #include "interfaces/efl_graphics_shape.eo.h" +#include "interfaces/efl_graphics_gradient.eo.h" #if defined ( __cplusplus ) } diff --git a/src/lib/efl/interfaces/efl_graphics_gradient.eo b/src/lib/efl/interfaces/efl_graphics_gradient.eo new file mode 100644 index 0000000..378ffaf --- /dev/null +++ b/src/lib/efl/interfaces/efl_graphics_gradient.eo @@ -0,0 +1,26 @@ +interface Efl.Graphics.Gradient +{ + legacy_prefix: null; + properties { + stop { + set { + } + get { + } + values { + const(Efl_Graphics_Gradient_Stop) *colors; + uint length; + } + } + spread { + set { + } + get { + } + values { + Efl_Graphics_Gradient_Spread s; + } + } + } + +} diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 793dbb6..10f9d1e 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -12,3 +12,4 @@ #include "interfaces/efl_text_properties.eo.c" #include "interfaces/efl_graphics_shape.eo.c" +#include "interfaces/efl_graphics_gradient.eo.c" diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 0b1b411..9f877d4 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -816,24 +816,6 @@ typedef enum _Evas_3D_Material_Attrib */ typedef Eo Evas_VG_Node; -typedef struct _Evas_VG_Gradient_Stop Evas_VG_Gradient_Stop; -struct _Evas_VG_Gradient_Stop -{ - double offset; - int r; - int g; - int b; - int a; -}; - -typedef enum _Evas_VG_Gradient_Spread -{ - EVAS_VG_GRADIENT_SPREAD_PAD, - EVAS_VG_GRADIENT_SPREAD_REFLECT, - EVAS_VG_GRADIENT_SPREAD_REPEAT, - EVAS_VG_GRADIENT_SPREAD_LAST -} Evas_VG_Gradient_Spread; - /** * @ingroup Evas_Object_VG * diff --git a/src/lib/evas/canvas/evas_vg_gradient.c b/src/lib/evas/canvas/evas_vg_gradient.c index df7edc6..72bddf7 100644 --- a/src/lib/evas/canvas/evas_vg_gradient.c +++ b/src/lib/evas/canvas/evas_vg_gradient.c @@ -7,50 +7,50 @@ typedef struct _Evas_VG_Gradient_Data Evas_VG_Gradient_Data; struct _Evas_VG_Gradient_Data { // FIXME: Later on we should deduplicate it somehow. - Evas_VG_Gradient_Stop *colors; + Efl_Graphics_Gradient_Stop *colors; unsigned int colors_count; - Evas_VG_Gradient_Spread s; + Efl_Graphics_Gradient_Spread s; }; void -_evas_vg_gradient_stop_set(Eo *obj EINA_UNUSED, - Evas_VG_Gradient_Data *pd, - const Evas_VG_Gradient_Stop *colors, - unsigned int length) +_evas_vg_gradient_efl_graphics_gradient_stop_set(Eo *obj EINA_UNUSED, + Evas_VG_Gradient_Data *pd, + const Efl_Graphics_Gradient_Stop *colors, + unsigned int length) { - pd->colors = realloc(pd->colors, length * sizeof(Evas_VG_Gradient_Stop)); + pd->colors = realloc(pd->colors, length * sizeof(Efl_Graphics_Gradient_Stop)); if (!pd->colors) { pd->colors_count = 0; return ; } - memcpy(pd->colors, colors, length * sizeof(Evas_VG_Gradient_Stop)); + memcpy(pd->colors, colors, length * sizeof(Efl_Graphics_Gradient_Stop)); pd->colors_count = length; } void -_evas_vg_gradient_stop_get(Eo *obj EINA_UNUSED, - Evas_VG_Gradient_Data *pd, - const Evas_VG_Gradient_Stop **colors, - unsigned int *length) +_evas_vg_gradient_efl_graphics_gradient_stop_get(Eo *obj EINA_UNUSED, + Evas_VG_Gradient_Data *pd, + const Efl_Graphics_Gradient_Stop **colors, + unsigned int *length) { if (colors) *colors = pd->colors; if (length) *length = pd->colors_count; } void -_evas_vg_gradient_spread_set(Eo *obj EINA_UNUSED, - Evas_VG_Gradient_Data *pd, - Evas_VG_Gradient_Spread s) +_evas_vg_gradient_efl_graphics_gradient_spread_set(Eo *obj EINA_UNUSED, + Evas_VG_Gradient_Data *pd, + Efl_Graphics_Gradient_Spread s) { pd->s = s; } -Evas_VG_Gradient_Spread -_evas_vg_gradient_spread_get(Eo *obj EINA_UNUSED, - Evas_VG_Gradient_Data *pd) +Efl_Graphics_Gradient_Spread +_evas_vg_gradient_efl_graphics_gradient_spread_get(Eo *obj EINA_UNUSED, + Evas_VG_Gradient_Data *pd) { return pd->s; } diff --git a/src/lib/evas/canvas/evas_vg_gradient.eo b/src/lib/evas/canvas/evas_vg_gradient.eo index 549d28a..a71a7e7 100644 --- a/src/lib/evas/canvas/evas_vg_gradient.eo +++ b/src/lib/evas/canvas/evas_vg_gradient.eo @@ -1,26 +1,11 @@ -abstract Evas.VG_Gradient (Evas.VG_Node) +abstract Evas.VG_Gradient (Evas.VG_Node, Efl.Graphics.Gradient) { eo_prefix: evas_vg_gradient; legacy_prefix: null; - properties { - stop { - set { - } - get { - } - values { - const(Evas_VG_Gradient_Stop) *colors; - uint length; - } - } - spread { - set { - } - get { - } - values { - Evas_VG_Gradient_Spread s; - } - } + implements { + Efl.Graphics.Gradient.stop.set; + Efl.Graphics.Gradient.stop.get; + Efl.Graphics.Gradient.spread.set; + Efl.Graphics.Gradient.spread.get; } } -- 2.7.4