summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_vg_gradient_linear.c
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-11-23 19:59:42 +0900
committerHermet Park <hermetpark@gmail.com>2018-11-23 20:01:53 +0900
commitce8b9e4b8533403f64fe152136d250e30008a089 (patch)
treeb844ba91a8f995053adf3497eb4602fac010b857 /src/lib/evas/canvas/evas_vg_gradient_linear.c
parent206ec05711d0657ff3ec157d61c9af53c8b6ed28 (diff)
evas vg: rename evas_vg prefix to efl_canvas for consistency.
Diffstat (limited to 'src/lib/evas/canvas/evas_vg_gradient_linear.c')
-rw-r--r--src/lib/evas/canvas/evas_vg_gradient_linear.c199
1 files changed, 0 insertions, 199 deletions
diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.c b/src/lib/evas/canvas/evas_vg_gradient_linear.c
deleted file mode 100644
index 26b434b00d..0000000000
--- a/src/lib/evas/canvas/evas_vg_gradient_linear.c
+++ /dev/null
@@ -1,199 +0,0 @@
1#include "evas_common_private.h"
2#include "evas_private.h"
3
4#include "evas_vg_private.h"
5
6#include <strings.h>
7
8#define MY_CLASS EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS
9
10typedef struct _Efl_Canvas_Vg_Gradient_Linear_Data Efl_Canvas_Vg_Gradient_Linear_Data;
11struct _Efl_Canvas_Vg_Gradient_Linear_Data
12{
13 struct {
14 double x, y;
15 } start, end;
16};
17
18static void
19_efl_canvas_vg_gradient_linear_efl_gfx_gradient_linear_start_set(Eo *obj EINA_UNUSED,
20 Efl_Canvas_Vg_Gradient_Linear_Data *pd,
21 double x, double y)
22{
23 pd->start.x = x;
24 pd->start.y = y;
25
26 _efl_canvas_vg_node_changed(obj);
27}
28
29static void
30_efl_canvas_vg_gradient_linear_efl_gfx_gradient_linear_start_get(const Eo *obj EINA_UNUSED,
31 Efl_Canvas_Vg_Gradient_Linear_Data *pd,
32 double *x, double *y)
33{
34 if (x) *x = pd->start.x;
35 if (y) *y = pd->start.y;
36}
37
38static void
39_efl_canvas_vg_gradient_linear_efl_gfx_gradient_linear_end_set(Eo *obj EINA_UNUSED,
40 Efl_Canvas_Vg_Gradient_Linear_Data *pd,
41 double x, double y)
42{
43 pd->end.x = x;
44 pd->end.y = y;
45
46 _efl_canvas_vg_node_changed(obj);
47}
48
49static void
50_efl_canvas_vg_gradient_linear_efl_gfx_gradient_linear_end_get(const Eo *obj EINA_UNUSED,
51 Efl_Canvas_Vg_Gradient_Linear_Data *pd,
52 double *x, double *y)
53{
54 if (x) *x = pd->end.x;
55 if (y) *y = pd->end.y;
56}
57
58static void
59_efl_canvas_vg_gradient_linear_render_pre(Eo *obj,
60 Eina_Matrix3 *parent,
61 Ector_Surface *s,
62 void *data,
63 Efl_Canvas_Vg_Node_Data *nd)
64{
65 Efl_Canvas_Vg_Gradient_Linear_Data *pd = data;
66 Efl_Canvas_Vg_Gradient_Data *gd;
67
68 if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ;
69
70 nd->flags = EFL_GFX_CHANGE_FLAG_NONE;
71
72 gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS);
73 EFL_CANVAS_VG_COMPUTE_MATRIX(current, parent, nd);
74
75 if (!nd->renderer)
76 {
77 efl_domain_current_push(EFL_ID_DOMAIN_SHARED);
78 nd->renderer = ector_surface_renderer_factory_new(s, ECTOR_RENDERER_GRADIENT_LINEAR_MIXIN);
79 efl_domain_current_pop();
80 }
81
82 ector_renderer_transformation_set(nd->renderer, current);
83 ector_renderer_origin_set(nd->renderer, nd->x, nd->y);
84 ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a);
85 ector_renderer_visibility_set(nd->renderer, nd->visibility);
86 efl_gfx_gradient_stop_set(nd->renderer, gd->colors, gd->colors_count);
87 efl_gfx_gradient_spread_set(nd->renderer, gd->s);
88 efl_gfx_gradient_linear_start_set(nd->renderer, pd->start.x, pd->start.y);
89 efl_gfx_gradient_linear_end_set(nd->renderer, pd->end.x, pd->end.y);
90
91 //Prepare renderer triggered by ector shape this gradient applied to.
92 //ector_renderer_prepare(nd->renderer);
93}
94
95static Eo *
96_efl_canvas_vg_gradient_linear_efl_object_constructor(Eo *obj,
97 Efl_Canvas_Vg_Gradient_Linear_Data *pd)
98{
99 Efl_Canvas_Vg_Node_Data *nd;
100
101 obj = efl_constructor(efl_super(obj, MY_CLASS));
102
103 nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
104 nd->render_pre = _efl_canvas_vg_gradient_linear_render_pre;
105 nd->data = pd;
106
107 return obj;
108}
109
110static void
111_efl_canvas_vg_gradient_linear_efl_object_destructor(Eo *obj, Efl_Canvas_Vg_Gradient_Linear_Data *pd EINA_UNUSED)
112{
113 efl_destructor(efl_super(obj, MY_CLASS));
114}
115
116static void
117_efl_canvas_vg_gradient_linear_efl_gfx_path_bounds_get(const Eo *obj, Efl_Canvas_Vg_Gradient_Linear_Data *pd, Eina_Rect *r)
118{
119 Efl_Canvas_Vg_Node_Data *nd;
120
121 nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
122 EINA_RECTANGLE_SET(r,
123 nd->x + pd->start.x, nd->y + pd->start.y,
124 pd->end.x - pd->start.x, pd->end.y - pd->start.x);
125}
126
127static Eina_Bool
128_efl_canvas_vg_gradient_linear_efl_gfx_path_interpolate(Eo *obj,
129 Efl_Canvas_Vg_Gradient_Linear_Data *pd,
130 const Efl_VG *from, const Efl_VG *to,
131 double pos_map)
132{
133 Efl_Canvas_Vg_Gradient_Linear_Data *fromd, *tod;
134 double from_map;
135 Eina_Bool r;
136
137 r = efl_gfx_path_interpolate(efl_super(obj, EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS), from, to, pos_map);
138
139 if (!r) return EINA_FALSE;
140
141 fromd = efl_data_scope_get(from, EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS);
142 tod = efl_data_scope_get(to, EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS);
143 from_map = 1.0 - pos_map;
144
145#define INTP(Pd, From, To, Member, From_Map, Pos_Map) \
146 Pd->Member = From->Member * From_Map + To->Member * Pos_Map
147
148 INTP(pd, fromd, tod, start.x, from_map, pos_map);
149 INTP(pd, fromd, tod, start.y, from_map, pos_map);
150 INTP(pd, fromd, tod, end.x, from_map, pos_map);
151 INTP(pd, fromd, tod, end.y, from_map, pos_map);
152
153#undef INTP
154
155 return EINA_TRUE;
156}
157
158EOLIAN static Efl_VG *
159_efl_canvas_vg_gradient_linear_efl_duplicate_duplicate(const Eo *obj, Efl_Canvas_Vg_Gradient_Linear_Data *pd)
160{
161 Efl_VG *cn = NULL;
162
163 cn = efl_duplicate(efl_super(obj, MY_CLASS));
164 efl_gfx_gradient_linear_start_set(cn, pd->start.x, pd->start.y);
165 efl_gfx_gradient_linear_end_set(cn, pd->end.x, pd->end.y);
166 return cn;
167}
168
169EAPI void
170evas_vg_gradient_linear_start_set(Eo *obj, double x, double y)
171{
172 efl_gfx_gradient_linear_start_set(obj, x, y);
173}
174
175EAPI void
176evas_vg_gradient_linear_start_get(Eo *obj, double *x, double *y)
177{
178 efl_gfx_gradient_linear_start_get(obj, x, y);
179}
180
181EAPI void
182evas_vg_gradient_linear_end_set(Eo *obj, double x, double y)
183{
184 efl_gfx_gradient_linear_end_set(obj, x, y);
185}
186
187EAPI void
188evas_vg_gradient_linear_end_get(Eo *obj, double *x, double *y)
189{
190 efl_gfx_gradient_linear_end_get(obj, x, y);
191}
192
193EAPI Efl_VG*
194evas_vg_gradient_linear_add(Efl_VG *parent)
195{
196 return efl_add(EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS, parent);
197}
198
199#include "efl_canvas_vg_gradient_linear.eo.c"