summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_vg_gradient.c
blob: 245b6fe3347a8cda7fec9343e1147e60800dc493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "evas_common_private.h"
#include "evas_private.h"

#include "evas_vg_private.h"

#include <strings.h>

static void
_efl_vg_gradient_efl_gfx_gradient_base_stop_set(Eo *obj EINA_UNUSED,
                                                Efl_VG_Gradient_Data *pd,
                                                const Efl_Gfx_Gradient_Stop *colors,
                                                unsigned int length)
{
   pd->colors = realloc(pd->colors, length * sizeof(Efl_Gfx_Gradient_Stop));
   if (!pd->colors)
     {
        pd->colors_count = 0;
        return ;
     }

   memcpy(pd->colors, colors, length * sizeof(Efl_Gfx_Gradient_Stop));
   pd->colors_count = length;

   _efl_vg_base_changed(obj);
}

static void
_efl_vg_gradient_efl_gfx_gradient_base_stop_get(Eo *obj EINA_UNUSED,
                                                Efl_VG_Gradient_Data *pd,
                                                const Efl_Gfx_Gradient_Stop **colors,
                                                unsigned int *length)
{
   if (colors) *colors = pd->colors;
   if (length) *length = pd->colors_count;
}

static void
_efl_vg_gradient_efl_gfx_gradient_base_spread_set(Eo *obj EINA_UNUSED,
                                                  Efl_VG_Gradient_Data *pd,
                                                  Efl_Gfx_Gradient_Spread s)
{
   pd->s = s;

   _efl_vg_base_changed(obj);
}

static Efl_Gfx_Gradient_Spread
_efl_vg_gradient_efl_gfx_gradient_base_spread_get(Eo *obj EINA_UNUSED,
                                                  Efl_VG_Gradient_Data *pd)
{
   return pd->s;
}

EAPI void
evas_vg_gradient_stop_set(Eo *obj, const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
{
   eo_do(obj, efl_gfx_gradient_stop_set(colors, length));
}

EAPI void
evas_vg_gradient_stop_get(Eo *obj, const Efl_Gfx_Gradient_Stop **colors, unsigned int *length)
{
   eo_do(obj, efl_gfx_gradient_stop_get(colors, length));
}

EAPI void
evas_vg_gradient_spread_set(Eo *obj, Efl_Gfx_Gradient_Spread s)
{
   eo_do(obj, efl_gfx_gradient_spread_set(s));
}

EAPI Efl_Gfx_Gradient_Spread
evas_vg_gradient_spread_get(Eo *obj)
{
   Efl_Gfx_Gradient_Spread ret;

   return eo_do_ret(obj, ret, efl_gfx_gradient_spread_get());
}

#include "efl_vg_gradient.eo.c"