efl/src/lib/ector/ector_renderer_gradient.c

62 lines
2.0 KiB
C
Raw Normal View History

2015-04-03 07:15:04 -07:00
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Ector.h>
#include "ector_private.h"
#define MY_CLASS ECTOR_RENDERER_GRADIENT_MIXIN
static void
_ector_renderer_gradient_efl_gfx_gradient_stop_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Data *pd,
const Efl_Gfx_Gradient_Stop *colors,
unsigned int length)
2015-04-03 07:15:04 -07:00
{
2015-04-03 07:23:16 -07:00
pd->colors = realloc(pd->colors, length * sizeof(Efl_Gfx_Gradient_Stop));
2015-04-03 07:21:49 -07:00
if (!pd->colors)
{
pd->colors_count = 0;
return ;
}
2015-04-03 07:23:16 -07:00
memcpy(pd->colors, colors, length * sizeof(Efl_Gfx_Gradient_Stop));
2015-04-03 07:21:49 -07:00
pd->colors_count = length;
2015-04-03 07:15:04 -07:00
}
static void
_ector_renderer_gradient_efl_gfx_gradient_stop_get(const Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Data *pd,
const Efl_Gfx_Gradient_Stop **colors,
unsigned int *length)
2015-04-03 07:15:04 -07:00
{
2015-04-03 07:21:49 -07:00
if (colors) *colors = pd->colors;
if (length) *length = pd->colors_count;
2015-04-03 07:15:04 -07:00
}
static void
_ector_renderer_gradient_efl_gfx_gradient_spread_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Data *pd,
Efl_Gfx_Gradient_Spread s)
2015-04-03 07:15:04 -07:00
{
2015-04-03 07:21:49 -07:00
pd->s = s;
2015-04-03 07:15:04 -07:00
}
2015-04-03 07:23:16 -07:00
static Efl_Gfx_Gradient_Spread
_ector_renderer_gradient_efl_gfx_gradient_spread_get(const Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Data *pd)
2015-04-03 07:15:04 -07:00
{
2015-04-03 07:21:49 -07:00
return pd->s;
2015-04-03 07:15:04 -07:00
}
static void
_ector_renderer_gradient_efl_object_invalidate(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Data *pd)
{
if (pd->colors) free(pd->colors);
}
2015-04-03 07:15:04 -07:00
#include "ector_renderer_gradient.eo.c"