efl: add a gradient interface.

This commit is contained in:
Cedric BAIL 2015-04-03 16:15:03 +02:00
parent 1d49ff7df2
commit d59351732d
7 changed files with 80 additions and 58 deletions

View File

@ -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)

View File

@ -89,6 +89,32 @@ 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;
#ifdef EFL_BETA_API_SUPPORT
/* Interfaces */
@ -100,6 +126,7 @@ typedef enum _Efl_Graphics_Join
#include "interfaces/efl_text_properties.eo.h"
#include "interfaces/efl_graphics_shape.eo.h"
#include "interfaces/efl_graphics_gradient.eo.h"
#endif

View File

@ -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;
}
}
}
}

View File

@ -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"

View File

@ -850,24 +850,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
*

View File

@ -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;
}

View File

@ -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;
}
}