summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2002-11-08 08:02:15 +0000
committerCarsten Haitzler <raster@rasterman.com>2002-11-08 08:02:15 +0000
commit56b5e15f26e16ec835fdcdc7649347f23fb6abf6 (patch)
tree3f86155cee8ee5cec8ae19fcfba6d2625889bff8 /legacy/evas/src/lib
parent5c822574647037eddc7940c1d29702e215c4c832 (diff)
code move
SVN revision: 6445
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/Evas.h449
-rw-r--r--legacy/evas/src/lib/Evas_Engine_DirectFB.h23
-rw-r--r--legacy/evas/src/lib/Evas_Engine_FB.h22
-rw-r--r--legacy/evas/src/lib/Evas_Engine_GL_X11.h35
-rw-r--r--legacy/evas/src/lib/Evas_Engine_Software_Qtopia.h31
-rw-r--r--legacy/evas/src/lib/Evas_Engine_Software_Win32_GDI.h29
-rw-r--r--legacy/evas/src/lib/Evas_Engine_Software_X11.h48
-rw-r--r--legacy/evas/src/lib/Makefile.am104
-rw-r--r--legacy/evas/src/lib/canvas/Makefile.am40
-rw-r--r--legacy/evas/src/lib/canvas/evas_callbacks.c139
-rw-r--r--legacy/evas/src/lib/canvas/evas_clip.c174
-rw-r--r--legacy/evas/src/lib/canvas/evas_data.c74
-rw-r--r--legacy/evas/src/lib/canvas/evas_events.c470
-rw-r--r--legacy/evas/src/lib/canvas/evas_layer.c151
-rw-r--r--legacy/evas/src/lib/canvas/evas_main.c897
-rw-r--r--legacy/evas/src/lib/canvas/evas_name.c41
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_gradient.c373
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_image.c1234
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_line.c399
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_main.c833
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_polygon.c407
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_rectangle.c346
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_smart.c330
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_text.c802
-rw-r--r--legacy/evas/src/lib/canvas/evas_rectangle.c95
-rw-r--r--legacy/evas/src/lib/canvas/evas_render.c326
-rw-r--r--legacy/evas/src/lib/canvas/evas_smart.c87
-rw-r--r--legacy/evas/src/lib/canvas/evas_stack.c216
-rw-r--r--legacy/evas/src/lib/data/Makefile.am24
-rw-r--r--legacy/evas/src/lib/data/evas_hash.c161
-rw-r--r--legacy/evas/src/lib/data/evas_list.c263
-rw-r--r--legacy/evas/src/lib/data/evas_object_list.c172
-rw-r--r--legacy/evas/src/lib/engines/Makefile.am11
-rw-r--r--legacy/evas/src/lib/engines/common/Makefile.am58
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_alpha_color_pixel.c142
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_color_pixel.c215
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_main.c44
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_pixel_cmod_pixel.c119
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_pixel_mul_pixel.c202
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_pixel_pixel.c334
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blit_main.c95
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_color.c1
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_gry_1.c5
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_gry_4.c8
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_gry_8.c17
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_main.c479
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_16.c1012
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_24.c8
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_32.c294
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_8.c209
-rw-r--r--legacy/evas/src/lib/engines/common/evas_cpu.c97
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw_main.c782
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_draw.c169
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_load.c239
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_main.c147
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_query.c226
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_main.c274
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_load.c1143
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_main.c376
-rw-r--r--legacy/evas/src/lib/engines/common/evas_line_main.c230
-rw-r--r--legacy/evas/src/lib/engines/common/evas_polygon_main.c255
-rw-r--r--legacy/evas/src/lib/engines/common/evas_rectangle_main.c73
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_main.c6
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_sample.c409
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth.c740
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler.c1753
-rw-r--r--legacy/evas/src/lib/engines/common/evas_tiler.c361
-rw-r--r--legacy/evas/src/lib/engines/directfb/Makefile.am38
-rw-r--r--legacy/evas/src/lib/engines/directfb/evas_engine_dfb.c938
-rw-r--r--legacy/evas/src/lib/engines/directfb/evas_engine_dfb.h182
-rw-r--r--legacy/evas/src/lib/engines/directfb/evas_engine_dfb_image_objects.c806
-rw-r--r--legacy/evas/src/lib/engines/directfb/evas_engine_dfb_image_objects.h49
-rw-r--r--legacy/evas/src/lib/engines/fb/Makefile.am40
-rw-r--r--legacy/evas/src/lib/engines/fb/evas_engine.c1017
-rw-r--r--legacy/evas/src/lib/engines/fb/evas_engine.h59
-rw-r--r--legacy/evas/src/lib/engines/fb/evas_fb.h95
-rw-r--r--legacy/evas/src/lib/engines/fb/evas_fb_main.c584
-rw-r--r--legacy/evas/src/lib/engines/fb/evas_outbuf.c402
-rw-r--r--legacy/evas/src/lib/engines/gl_common/Makefile.am32
-rw-r--r--legacy/evas/src/lib/engines/gl_common/evas_gl_image.c1
-rw-r--r--legacy/evas/src/lib/engines/gl_x11/Makefile.am36
-rw-r--r--legacy/evas/src/lib/engines/gl_x11/evas_engine.c775
-rw-r--r--legacy/evas/src/lib/engines/gl_x11/evas_engine.h13
-rw-r--r--legacy/evas/src/lib/engines/gl_x11/evas_x_main.c10
-rw-r--r--legacy/evas/src/lib/engines/software_qtopia/Makefile.am40
-rw-r--r--legacy/evas/src/lib/engines/software_qtopia/evas_engine.c1040
-rw-r--r--legacy/evas/src/lib/engines/software_qtopia/evas_engine.h103
-rw-r--r--legacy/evas/src/lib/engines/software_qtopia/evas_outbuf.c238
-rw-r--r--legacy/evas/src/lib/engines/software_qtopia/evas_qt_main.cpp109
-rw-r--r--legacy/evas/src/lib/engines/software_win32_gdi/Makefile.am6
-rw-r--r--legacy/evas/src/lib/engines/software_win32_gdi/evas_engine.c0
-rw-r--r--legacy/evas/src/lib/engines/software_win32_gdi/evas_engine.h0
-rw-r--r--legacy/evas/src/lib/engines/software_win32_gdi/evas_outbuf.c0
-rw-r--r--legacy/evas/src/lib/engines/software_win32_gdi/evas_win32_buffer.c0
-rw-r--r--legacy/evas/src/lib/engines/software_win32_gdi/evas_win32_main.c0
-rw-r--r--legacy/evas/src/lib/engines/software_x11/Makefile.am42
-rw-r--r--legacy/evas/src/lib/engines/software_x11/evas_engine.c1158
-rw-r--r--legacy/evas/src/lib/engines/software_x11/evas_engine.h134
-rw-r--r--legacy/evas/src/lib/engines/software_x11/evas_outbuf.c1297
-rw-r--r--legacy/evas/src/lib/engines/software_x11/evas_x_buffer.c190
-rw-r--r--legacy/evas/src/lib/engines/software_x11/evas_x_color.c337
-rw-r--r--legacy/evas/src/lib/engines/software_x11/evas_x_main.c10
-rw-r--r--legacy/evas/src/lib/file/Makefile.am22
-rw-r--r--legacy/evas/src/lib/file/evas_path.c356
-rw-r--r--legacy/evas/src/lib/include/Makefile.am13
-rw-r--r--legacy/evas/src/lib/include/evas_common.h837
-rw-r--r--legacy/evas/src/lib/include/evas_engine_api_directfb.h8
-rw-r--r--legacy/evas/src/lib/include/evas_engine_api_fb.h6
-rw-r--r--legacy/evas/src/lib/include/evas_engine_api_gl_x11.h10
-rw-r--r--legacy/evas/src/lib/include/evas_engine_api_software_qtopia.h6
-rw-r--r--legacy/evas/src/lib/include/evas_engine_api_software_win32_gdi.h6
-rw-r--r--legacy/evas/src/lib/include/evas_engine_api_software_x11.h7
-rw-r--r--legacy/evas/src/lib/include/evas_mmx.h584
-rw-r--r--legacy/evas/src/lib/include/evas_options.h68
-rw-r--r--legacy/evas/src/lib/include/evas_private.h458
-rw-r--r--legacy/evas/src/lib/main.c70
116 files changed, 31560 insertions, 0 deletions
diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h
new file mode 100644
index 0000000000..35a4ebfe9b
--- /dev/null
+++ b/legacy/evas/src/lib/Evas.h
@@ -0,0 +1,449 @@
1#ifndef _EVAS_H
2#define _EVAS_H
3
4#ifndef EVAS_COMMON_H
5#ifndef EVAS_PRIVATE_H
6
7enum _Evas_Callback_Type
8{
9 EVAS_CALLBACK_MOUSE_IN, /**< Mouse In Event */
10 EVAS_CALLBACK_MOUSE_OUT, /**< Mouse Out Event */
11 EVAS_CALLBACK_MOUSE_DOWN, /**< Mouse Button Down Event */
12 EVAS_CALLBACK_MOUSE_UP, /**< Mouse Button Up Event */
13 EVAS_CALLBACK_MOUSE_MOVE, /**< Mouse Move Event */
14 EVAS_CALLBACK_FREE, /**< Object Being Freed */
15 EVAS_CALLBACK_KEY_DOWN, /**< Key Press Event */
16 EVAS_CALLBACK_KEY_UP, /**< Key Release Event */
17 EVAS_CALLBACK_FOCUS_IN, /**< Focus In Event */
18 EVAS_CALLBACK_FOCUS_OUT /**< Focus Out Event */
19};
20
21/**
22 * The type of event to trigger the callback
23 */
24typedef enum _Evas_Callback_Type Evas_Callback_Type;
25
26/**
27 * A generic linked list node handle
28 */
29typedef struct _Evas_List Evas_List;
30/**
31 * A generic rectangle handle
32 */
33typedef struct _Evas_Rectangle Evas_Rectangle;
34
35struct _Evas_List
36{
37 void *data; /**< Pointer to list element payload */
38 Evas_List *next; /**< Next member in the list */
39 Evas_List *prev; /**< Previous member in the list */
40
41 Evas_List *last; /**< Private member. Don't use this */
42 int count; /**< Private member. Don't use this */
43};
44
45struct _Evas_Rectangle
46{
47 int x, y, w, h; /**< the co-ordinates of the rectangle, starting top-left and width and height */
48};
49
50/** A Hash table handle */
51typedef void Evas_Hash;
52/** An Evas canvas handle */
53typedef void Evas;
54/** An Evas Object handle */
55typedef void Evas_Object;
56/** An Evas Performance handle */
57typedef void Evas_Performance;
58/** An Evas Key */
59typedef void Evas_Key;
60/** An Evas Modifier */
61typedef void Evas_Modifier;
62/** An Evas Lock */
63typedef void Evas_Lock;
64/** An Evas Smart Object handle */
65typedef void Evas_Smart;
66#endif
67#endif
68
69/** A generic Evas Engine information structure */
70typedef struct _Evas_Engine_Info Evas_Engine_Info;
71/** Event structure for #EVAS_CALLBACK_MOUSE_DOWN event callbacks */
72typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down;
73/** Event structure for #EVAS_CALLBACK_MOUSE_UP event callbacks */
74typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up;
75/** Event structure for #EVAS_CALLBACK_MOUSE_IN event callbacks */
76typedef struct _Evas_Event_Mouse_In Evas_Event_Mouse_In;
77/** Event structure for #EVAS_CALLBACK_MOUSE_OUT event callbacks */
78typedef struct _Evas_Event_Mouse_Out Evas_Event_Mouse_Out;
79/** Event structure for #EVAS_CALLBACK_MOUSE_MOVE event callbacks */
80typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move;
81/** Event structure for #EVAS_CALLBACK_KEY_DOWN event callbacks */
82typedef struct _Evas_Event_Key_Down Evas_Event_Key_Down;
83/** Event structure for #EVAS_CALLBACK_KEY_UP event callbacks */
84typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up;
85
86#define EVAS_LOAD_ERROR_NONE 0
87#define EVAS_LOAD_ERROR_GENERIC 1
88#define EVAS_LOAD_ERROR_DOES_NOT_EXIST 2
89#define EVAS_LOAD_ERROR_PERMISSION_DENIED 3
90#define EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED 4
91#define EVAS_LOAD_ERROR_CORRUPT_FILE 5
92#define EVAS_LOAD_ERROR_UNKNOWN_FORMAT 6
93
94struct _Evas_Engine_Info
95{
96 int magic;
97};
98
99struct _Evas_Event_Mouse_Down
100{
101 int button;
102 struct {
103 int x, y;
104 } output;
105 struct {
106 double x, y;
107 } canvas;
108 void *data;
109 Evas_Modifier *modifiers;
110 Evas_Lock *locks;
111};
112
113struct _Evas_Event_Mouse_Up
114{
115 int button;
116 struct {
117 int x, y;
118 } output;
119 struct {
120 double x, y;
121 } canvas;
122 void *data;
123 Evas_Modifier *modifiers;
124 Evas_Lock *locks;
125};
126
127struct _Evas_Event_Mouse_In
128{
129 int buttons;
130 struct {
131 int x, y;
132 } output;
133 struct {
134 double x, y;
135 } canvas;
136 void *data;
137 Evas_Modifier *modifiers;
138 Evas_Lock *locks;
139};
140
141struct _Evas_Event_Mouse_Out
142{
143 int buttons;
144 struct {
145 int x, y;
146 } output;
147 struct {
148 double x, y;
149 } canvas;
150 void *data;
151 Evas_Modifier *modifiers;
152 Evas_Lock *locks;
153};
154
155struct _Evas_Event_Mouse_Move
156{
157 int buttons;
158 struct {
159 struct {
160 int x, y;
161 } output;
162 struct {
163 double x, y;
164 } canvas;
165 } cur, prev;
166 void *data;
167 Evas_Modifier *modifiers;
168 Evas_Lock *locks;
169};
170
171struct _Evas_Event_Key_Down
172{
173 Evas_Key *key;
174 void *data;
175 Evas_Modifier *modifiers;
176 Evas_Lock *locks;
177};
178
179struct _Evas_Event_Key_Up
180{
181 Evas_Key *key;
182 void *data;
183 Evas_Modifier *modifiers;
184 Evas_Lock *locks;
185};
186
187#ifdef __cplusplus
188extern "C" {
189#endif
190
191 Evas_List *evas_list_append (Evas_List *list, void *data);
192 Evas_List *evas_list_prepend (Evas_List *list, void *data);
193 Evas_List *evas_list_append_relative (Evas_List *list, void *data, void *relative);
194 Evas_List *evas_list_prepend_relative (Evas_List *list, void *data, void *relative);
195 Evas_List *evas_list_remove (Evas_List *list, void *data);
196 Evas_List *evas_list_remove_list (Evas_List *list, Evas_List *remove_list);
197 void *evas_list_find (Evas_List *list, void *data);
198 Evas_List *evas_list_free (Evas_List *list);
199 Evas_List *evas_list_last (Evas_List *list);
200 Evas_List *evas_list_next (Evas_List *list);
201 Evas_List *evas_list_prev (Evas_List *list);
202 void *evas_list_data (Evas_List *list);
203 int evas_list_count (Evas_List *list);
204 void *evas_list_nth (Evas_List *list, int n);
205 Evas_List *evas_list_reverse (Evas_List *list);
206
207 /* FIXME: add:
208 * api to add find, del members by data, size not just string and also
209 * provide hash generation functions settable by the app
210 *
211 * do we really need this? hmmm - let me think... there may be a better way
212 */
213 Evas_Hash *evas_hash_add (Evas_Hash *hash, const char *key, void *data);
214 Evas_Hash *evas_hash_del (Evas_Hash *hash, const char *key, void *data);
215 void *evas_hash_find (Evas_Hash *hash, const char *key);
216 int evas_hash_size (Evas_Hash *hash);
217 void evas_hash_free (Evas_Hash *hash);
218 void evas_hash_foreach (Evas_Hash *hash, int (*func) (Evas_Hash *hash, const char *key, void *data, void *fdata), void *fdata);
219
220 Evas *evas_new (void);
221 void evas_free (Evas *e);
222
223 int evas_render_method_lookup (const char *name);
224 Evas_List *evas_render_method_list (void);
225 void evas_render_method_list_free (Evas_List *list);
226
227 void evas_output_method_set (Evas *e, int render_method);
228 int evas_output_method_get (Evas *e);
229
230 Evas_Engine_Info *evas_engine_info_get (Evas *e);
231 void evas_engine_info_set (Evas *e, Evas_Engine_Info *info);
232
233 void evas_output_size_set (Evas *e, int w, int h);
234 void evas_output_size_get (Evas *e, int *w, int *h);
235 void evas_output_viewport_set (Evas *e, double x, double y, double w, double h);
236 void evas_output_viewport_get (Evas *e, double *x, double *y, double *w, double *h);
237
238 double evas_coord_screen_x_to_world (Evas *e, int x);
239 double evas_coord_screen_y_to_world (Evas *e, int y);
240 int evas_coord_world_x_to_screen (Evas *e, double x);
241 int evas_coord_world_y_to_screen (Evas *e, double y);
242
243 void evas_damage_rectangle_add (Evas *e, int x, int y, int w, int h);
244 void evas_obscured_rectangle_add (Evas *e, int x, int y, int w, int h);
245 void evas_obscured_clear (Evas *e);
246 Evas_List *evas_render_updates (Evas *e);
247 void evas_render_updates_free (Evas_List *updates);
248 void evas_render (Evas *e);
249
250 Evas_Object *evas_object_rectangle_add (Evas *e);
251
252 Evas_Object *evas_object_line_add (Evas *e);
253 void evas_object_line_xy_set (Evas_Object *obj, double x1, double y1, double x2, double y2);
254 void evas_object_line_xy_get (Evas_Object *obj, double *x1, double *y1, double *x2, double *y2);
255
256 Evas_Object *evas_object_gradient_add (Evas *e);
257 void evas_object_gradient_color_add (Evas_Object *obj, int r, int g, int b, int a, int distance);
258 void evas_object_gradient_colors_clear (Evas_Object *obj);
259 void evas_object_gradient_angle_set (Evas_Object *obj, double angle);
260 double evas_object_gradient_angle_get (Evas_Object *obj);
261
262 Evas_Object *evas_object_polygon_add (Evas *e);
263 void evas_object_polygon_point_add (Evas_Object *obj, double x, double y);
264 void evas_object_polygon_points_clear (Evas_Object *obj);
265
266 Evas_Object *evas_object_image_add (Evas *e);
267 void evas_object_image_file_set (Evas_Object *obj, char *file, char *key);
268 void evas_object_image_file_get (Evas_Object *obj, char **file, char **key);
269 void evas_object_image_border_set (Evas_Object *obj, int l, int r, int t, int b);
270 void evas_object_image_border_get (Evas_Object *obj, int *l, int *r, int *t, int *b);
271 void evas_object_image_fill_set (Evas_Object *obj, double x, double y, double w, double h);
272 void evas_object_image_fill_get (Evas_Object *obj, double *x, double *y, double *w, double *h);
273 void evas_object_image_size_set (Evas_Object *obj, int w, int h);
274 void evas_object_image_size_get (Evas_Object *obj, int *w, int *h);
275 int evas_object_image_load_error_get (Evas_Object *obj);
276 void evas_object_image_data_set (Evas_Object *obj, int *data);
277 int *evas_object_image_data_get (Evas_Object *obj, int for_writing);
278 void evas_object_image_data_copy_set (Evas_Object *obj, int *data);
279 void evas_object_image_data_update_add (Evas_Object *obj, int x, int y, int w, int h);
280 void evas_object_image_alpha_set (Evas_Object *obj, int has_alpha);
281 int evas_object_image_alpha_get (Evas_Object *obj);
282 void evas_object_image_smooth_scale_set(Evas_Object *obj, int smooth_scale);
283 int evas_object_image_smooth_scale_get(Evas_Object *obj);
284 void evas_object_image_reload (Evas_Object *obj);
285
286 void evas_object_image_cache_flush (Evas *e);
287 void evas_object_image_cache_reload (Evas *e);
288 void evas_object_image_cache_set (Evas *e, int size);
289 int evas_object_image_cache_get (Evas *e);
290
291 /* FIXME: add:
292 * multiple image format handler code (clean internal api)
293 * image loader (provided by app) code (callbacks)
294 * loadable image loader module query etc. code
295 */
296
297 Evas_Object *evas_object_text_add (Evas *e);
298 void evas_object_text_font_set (Evas_Object *obj, char *font, double size);
299 void evas_object_text_font_get (Evas_Object *obj, char **font, double *size);
300 void evas_object_text_text_set (Evas_Object *obj, char *text);
301 char *evas_object_text_text_get (Evas_Object *obj);
302 double evas_object_text_ascent_get (Evas_Object *obj);
303 double evas_object_text_descent_get (Evas_Object *obj);
304 double evas_object_text_max_ascent_get (Evas_Object *obj);
305 double evas_object_text_max_descent_get (Evas_Object *obj);
306 double evas_object_text_horiz_advance_get(Evas_Object *obj);
307 double evas_object_text_vert_advance_get (Evas_Object *obj);
308 double evas_object_text_inset_get (Evas_Object *obj);
309 double evas_object_text_horiz_advance_get(Evas_Object *obj);
310 double evas_object_text_vert_advance_get (Evas_Object *obj);
311 int evas_object_text_char_pos_get (Evas_Object *obj, int pos, double *cx, double *cy, double *cw, double *ch);
312 int evas_object_text_char_coords_get (Evas_Object *obj, double x, double y, double *cx, double *cy, double *cw, double *ch);
313
314 /* FIXME: add:
315 * text outline & shadowing code
316 */
317
318 void evas_object_font_path_clear (Evas *e);
319 void evas_object_font_path_append (Evas *e, char *path);
320 void evas_object_font_path_prepend (Evas *e, char *path);
321 Evas_List *evas_object_font_path_list (Evas *e);
322
323 void evas_object_font_cache_flush (Evas *e);
324 void evas_object_font_cache_set (Evas *e, int size);
325 int evas_object_font_cache_get (Evas *e);
326
327 void evas_object_del (Evas_Object *obj);
328
329 const char *evas_object_type_get (Evas_Object *obj);
330
331 void evas_object_layer_set (Evas_Object *obj, int l);
332 int evas_object_layer_get (Evas_Object *obj);
333
334 void evas_object_raise (Evas_Object *obj);
335 void evas_object_lower (Evas_Object *obj);
336 void evas_object_stack_above (Evas_Object *obj, Evas_Object *above);
337 void evas_object_stack_below (Evas_Object *obj, Evas_Object *below);
338 Evas_Object *evas_object_above_get (Evas_Object *obj);
339 Evas_Object *evas_object_below_get (Evas_Object *obj);
340 Evas_Object *evas_object_bottom_get (Evas *e);
341 Evas_Object *evas_object_top_get (Evas *e);
342
343 void evas_object_move (Evas_Object *obj, double x, double y);
344 void evas_object_resize (Evas_Object *obj, double w, double h);
345 void evas_object_geometry_get (Evas_Object *obj, double *x, double *y, double *w, double *h);
346
347 void evas_object_show (Evas_Object *obj);
348 void evas_object_hide (Evas_Object *obj);
349 int evas_object_visible_get (Evas_Object *obj);
350
351 void evas_object_color_set (Evas_Object *obj, int r, int g, int b, int a);
352 void evas_object_color_get (Evas_Object *obj, int *r, int *g, int *b, int *a);
353
354 void evas_object_clip_set (Evas_Object *obj, Evas_Object *clip);
355 Evas_Object *evas_object_clip_get (Evas_Object *obj);
356 void evas_object_clip_unset (Evas_Object *obj);
357 Evas_List *evas_object_clipees_get (Evas_Object *obj);
358
359 void evas_object_data_set (Evas_Object *obj, const char *key, void *data);
360 void *evas_object_data_get (Evas_Object *obj, const char *key);
361 void *evas_object_data_del (Evas_Object *obj, const char *key);
362
363 void evas_object_name_set (Evas_Object *obj, const char *name);
364 char *evas_object_name_get (Evas_Object *obj);
365 Evas_Object *evas_object_name_find (Evas *e, const char *name);
366
367 Evas *evas_object_evas_get (Evas_Object *obj);
368
369 Evas_Object *evas_object_top_at_xy_get (Evas *e, double x, double y, int include_pass_events_objects, int include_hidden_objects);
370 Evas_Object *evas_object_top_at_pointer_get (Evas *e);
371 Evas_Object *evas_object_top_in_rectangle_get (Evas *e, double x, double y, double w, double h, int include_pass_events_objects, int include_hidden_objects);
372
373 Evas_List *evas_objects_at_xy_get (Evas *e, double x, double y, int include_pass_events_objects, int include_hidden_objects);
374 Evas_List *evas_objects_in_rectangle_get (Evas *e, double x, double y, double w, double h, int include_pass_events_objects, int include_hidden_objects);
375
376 Evas_Smart *evas_smart_new (char *name, void (*func_add) (Evas_Object *o), void (*func_del) (Evas_Object *o), void (*func_layer_set) (Evas_Object *o, int l), void (*func_raise) (Evas_Object *o), void (*func_lower) (Evas_Object *o), void (*func_stack_above) (Evas_Object *o, Evas_Object *above), void (*func_stack_below) (Evas_Object *o, Evas_Object *below), void (*func_move) (Evas_Object *o, double x, double y), void (*func_resize) (Evas_Object *o, double w, double h), void (*func_show) (Evas_Object *o), void (*func_hide) (Evas_Object *o), void (*func_color_set) (Evas_Object *o, int r, int g, int b, int a), void (*func_clip_set) (Evas_Object *o, Evas_Object *clip), void (*func_clip_unset) (Evas_Object *o), void *data);
377 void evas_smart_free (Evas_Smart *s);
378 void *evas_smart_data_get (Evas_Smart *s);
379
380 Evas_Object *evas_object_smart_add (Evas *e, Evas_Smart *s);
381 void evas_object_smart_member_add (Evas_Object *obj, Evas_Object *smart_obj);
382 void evas_object_smart_member_del (Evas_Object *obj);
383 Evas_Smart *evas_object_smart_smart_get (Evas_Object *obj);
384 void *evas_object_smart_data_get (Evas_Object *obj);
385 void evas_object_smart_data_set (Evas_Object *obj, void *data);
386 void evas_object_smart_callback_add (Evas_Object *obj, char *event, void (*func) (void *data, Evas_Object *obj, void *event_info), void *data);
387 void *evas_object_smart_callback_del (Evas_Object *obj, char *event, void (*func) (void *data, Evas_Object *obj, void *event_info));
388 void evas_object_smart_callback_call (Evas_Object *obj, char *event, void *event_info);
389
390 void evas_pointer_output_xy_get (Evas *e, int *x, int *y);
391 void evas_pointer_canvas_xy_get (Evas *e, double *x, double *y);
392 int evas_pointer_button_down_mask_get (Evas *e);
393 int evas_pointer_inside_get (Evas *e);
394
395 void evas_event_freeze (Evas *e);
396 void evas_event_thaw (Evas *e);
397 int evas_event_freeze_get (Evas *e);
398 void evas_event_feed_mouse_down_data (Evas *e, int b, void *data);
399 void evas_event_feed_mouse_up_data (Evas *e, int b, void *data);
400 void evas_event_feed_mouse_move_data (Evas *e, int x, int y, void *data);
401 void evas_event_feed_mouse_in_data (Evas *e, void *data);
402 void evas_event_feed_mouse_out_data (Evas *e, void *data);
403/* FIXME: implement...
404 void evas_event_feed_key_down_data (Evas *e, char *keyname, void *data);
405 void evas_event_feed_key_up_data (Evas *e, char *keyname, void *data);
406...end implement */
407 void evas_event_feed_mouse_down (Evas *e, int b);
408 void evas_event_feed_mouse_up (Evas *e, int b);
409 void evas_event_feed_mouse_move (Evas *e, int x, int y);
410 void evas_event_feed_mouse_in (Evas *e);
411 void evas_event_feed_mouse_out (Evas *e);
412/* FIXME: implement...
413 void evas_event_feed_key_down (Evas *e, char *keyname);
414 void evas_event_feed_key_up (Evas *e, char *keyname);
415
416 void evas_object_focus (Evas_Object *o);
417
418 char *evas_key_name_get (Evas_Key *k);
419
420 int evas_key_modifier_is_set_get (Evas_Modifier *m, char *keyname);
421
422 int evas_key_lock_is_set_get (Evas_Lock *l, char *keyname);
423
424 void evas_key_modifier_add (Evas *e, char *keyname);
425 void evas_key_modifier_del (Evas *e, char *keyname);
426 void evas_key_lock_add (Evas *e, char *keyname);
427 void evas_key_lock_del (Evas *e, char *keyname);
428
429 void evas_key_modifier_on (Evas *e, char *keyname);
430 void evas_key_modifier_off (Evas *e, char *keyname);
431 void evas_key_lock_on (Evas *e, char *keyname);
432 void evas_key_lock_off (Evas *e, char *keyname);
433...end implement */
434
435 void evas_object_pass_events_set (Evas_Object *obj, int pass);
436 int evas_object_pass_events_get (Evas_Object *obj);
437 void evas_object_repeat_events_set (Evas_Object *obj, int repeat);
438 int evas_object_repeat_events_get (Evas_Object *obj);
439
440 void evas_object_event_callback_add (Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info), void *data);
441 void *evas_object_event_callback_del (Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info));
442
443#ifdef __cplusplus
444}
445#endif
446
447#endif
448
449
diff --git a/legacy/evas/src/lib/Evas_Engine_DirectFB.h b/legacy/evas/src/lib/Evas_Engine_DirectFB.h
new file mode 100644
index 0000000000..faa54f951b
--- /dev/null
+++ b/legacy/evas/src/lib/Evas_Engine_DirectFB.h
@@ -0,0 +1,23 @@
1#ifndef _EVAS_ENGINE_DIRECTFB_H
2#define _EVAS_ENGINE_DIRECTFB_H
3#include <Evas.h>
4
5#include <directfb.h>
6
7typedef struct _Evas_Engine_Info_DirectFB Evas_Engine_Info_DirectFB;
8
9struct _Evas_Engine_Info_DirectFB
10{
11 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
12 /* at you and make nasty noises */
13 Evas_Engine_Info magic;
14
15 struct {
16 IDirectFB *dfb;
17 IDirectFBSurface *surface;
18 DFBSurfaceDrawingFlags flags;
19 } info;
20};
21#endif
22
23
diff --git a/legacy/evas/src/lib/Evas_Engine_FB.h b/legacy/evas/src/lib/Evas_Engine_FB.h
new file mode 100644
index 0000000000..c8a51229d7
--- /dev/null
+++ b/legacy/evas/src/lib/Evas_Engine_FB.h
@@ -0,0 +1,22 @@
1#ifndef _EVAS_ENGINE_FB_H
2#define _EVAS_ENGINE_FB_H
3
4typedef struct _Evas_Engine_Info_FB Evas_Engine_Info_FB;
5
6struct _Evas_Engine_Info_FB
7{
8 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
9 /* at you and make nasty noises */
10 Evas_Engine_Info magic;
11
12 struct {
13
14 int virtual_terminal;
15 int device_number;
16 int refresh;
17 int rotation;
18 } info;
19};
20#endif
21
22
diff --git a/legacy/evas/src/lib/Evas_Engine_GL_X11.h b/legacy/evas/src/lib/Evas_Engine_GL_X11.h
new file mode 100644
index 0000000000..3f83cfbfd3
--- /dev/null
+++ b/legacy/evas/src/lib/Evas_Engine_GL_X11.h
@@ -0,0 +1,35 @@
1#ifndef _EVAS_ENGINE_GL_X11_H
2#define _EVAS_ENGINE_GL_X11_H
3
4#include <X11/Xlib.h>
5#include <GL/gl.h>
6#include <GL/glu.h>
7#include <GL/glx.h>
8
9typedef struct _Evas_Engine_Info_GL_X11 Evas_Engine_Info_GL_X11;
10
11struct _Evas_Engine_Info_GL_X11
12{
13 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
14 /* at you and make nasty noises */
15 Evas_Engine_Info magic;
16
17 /* engine specific data & parameters it needs to set up */
18 struct {
19 Display *display;
20 Drawable drawable;
21 Visual *visual;
22 Colormap colormap;
23 int depth;
24 } info;
25 /* engine specific function calls to query stuff about the destination */
26 /* engine (what visual & colormap & depth to use, performance info etc. */
27 struct {
28 Visual * (*best_visual_get) (Display *disp, int screen);
29 Colormap (*best_colormap_get) (Display *disp, int screen);
30 int (*best_depth_get) (Display *disp, int screen);
31 } func;
32};
33#endif
34
35
diff --git a/legacy/evas/src/lib/Evas_Engine_Software_Qtopia.h b/legacy/evas/src/lib/Evas_Engine_Software_Qtopia.h
new file mode 100644
index 0000000000..76aafa63f6
--- /dev/null
+++ b/legacy/evas/src/lib/Evas_Engine_Software_Qtopia.h
@@ -0,0 +1,31 @@
1#ifndef _EVAS_ENGINE_SOFTWARE_QTOPIA_H
2#define _EVAS_ENGINE_SOFTWARE_QTOPIA_H
3
4#ifdef EVAS_COMMON_H
5#ifdef EVAS_PRIVATE_H
6typedef void QWidget;
7#endif
8#endif
9
10#ifndef EVAS_COMMON_H
11#ifndef EVAS_PRIVATE_H
12#include <qwidget.h>
13#endif
14#endif
15
16typedef struct _Evas_Engine_Info_Software_Qtopia Evas_Engine_Info_Software_Qtopia;
17
18struct _Evas_Engine_Info_Software_Qtopia
19{
20 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
21 /* at you and make nasty noises */
22 Evas_Engine_Info magic;
23
24 struct {
25 QWidget *target;
26 int rotation;
27 } info;
28};
29#endif
30
31
diff --git a/legacy/evas/src/lib/Evas_Engine_Software_Win32_GDI.h b/legacy/evas/src/lib/Evas_Engine_Software_Win32_GDI.h
new file mode 100644
index 0000000000..e538f8f98a
--- /dev/null
+++ b/legacy/evas/src/lib/Evas_Engine_Software_Win32_GDI.h
@@ -0,0 +1,29 @@
1#ifndef _EVAS_ENGINE_SOFTWARE_WIN32_GDI_H
2#define _EVAS_ENGINE_SOFTWARE_WIN32_GDI_H
3
4
5typedef struct _Evas_Engine_Info_Software_Win32_GDI Evas_Engine_Info_Software_Win32_GDI;
6
7struct _Evas_Engine_Info_Software_Win32_GDI
8{
9 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
10 /* at you and make nasty noises */
11 Evas_Engine_Info magic;
12
13 /* engine specific data & parameters it needs to set up */
14 struct {
15 HWND hwnd;
16/*
17 Colormap colormap;
18*/
19
20 int depth;
21 int rotation;
22
23 } info;
24 /* engine specific function calls to query stuff about the destination */
25 /* engine (what visual & colormap & depth to use, performance info etc. */
26};
27#endif
28
29
diff --git a/legacy/evas/src/lib/Evas_Engine_Software_X11.h b/legacy/evas/src/lib/Evas_Engine_Software_X11.h
new file mode 100644
index 0000000000..ca2ff9b1de
--- /dev/null
+++ b/legacy/evas/src/lib/Evas_Engine_Software_X11.h
@@ -0,0 +1,48 @@
1#ifndef _EVAS_ENGINE_SOFTWARE_X11_H
2#define _EVAS_ENGINE_SOFTWARE_X11_H
3
4#include <X11/Xlib.h>
5
6typedef struct _Evas_Engine_Info_Software_X11 Evas_Engine_Info_Software_X11;
7
8struct _Evas_Engine_Info_Software_X11
9{
10 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
11 /* at you and make nasty noises */
12 Evas_Engine_Info magic;
13
14 /* engine specific data & parameters it needs to set up */
15 struct {
16 Display *display;
17 Drawable drawable;
18 Pixmap mask;
19 Visual *visual;
20 Colormap colormap;
21 int depth;
22 int rotation;
23
24 int alloc_grayscale : 1;
25 int debug : 1;
26 int shape_dither : 1;
27
28 int alloc_colors_max;
29 } info;
30 /* engine specific function calls to query stuff about the destination */
31 /* engine (what visual & colormap & depth to use, performance info etc. */
32 struct {
33 Visual * (*best_visual_get) (Display *disp, int screen);
34 Colormap (*best_colormap_get) (Display *disp, int screen);
35 int (*best_depth_get) (Display *disp, int screen);
36
37 Evas_Performance *(*performance_test) (Evas *e, Display *disp, Visual *vis, Colormap cmap, Drawable draw, int depth);
38 void (*performance_free) (Evas_Performance *perf);
39 char * (*performance_data_get) (Evas_Performance *perf);
40 char * (*performance_key_get) (Evas_Performance *perf);
41 Evas_Performance *(*performance_new) (Evas *e, Display *disp, Visual *vis, Colormap cmap, Drawable draw, int depth);
42 void (*performance_build) (Evas_Performance *perf, const char *data);
43 void (*performance_device_store) (Evas_Performance *perf);
44 } func;
45};
46#endif
47
48
diff --git a/legacy/evas/src/lib/Makefile.am b/legacy/evas/src/lib/Makefile.am
new file mode 100644
index 0000000000..1b0fe2259c
--- /dev/null
+++ b/legacy/evas/src/lib/Makefile.am
@@ -0,0 +1,104 @@
1## Process this file with automake to produce Makefile.in
2
3SUBDIRS = canvas data file engines include
4
5AUTOMAKE_OPTIONS = 1.4 foreign
6
7# A list of all the files in the current directory which can be regenerated
8MAINTAINERCLEANFILES = Makefile.in
9
10LDFLAGS = -L/usr/local/lib
11INCLUDES = -I/usr/local/include \
12 -I$(top_srcdir)/src/lib/include \
13 -I$(includedir) \
14 -I/usr/local/include \
15 @freetype_cflags@ @x_cflags@ @qt_cflags@ @DIRECTFB_CFLAGS@ @gl_cflags@
16
17lib_LTLIBRARIES = libevas.la
18
19EXTRA_DIST = \
20Evas_Engine_Software_X11.h \
21Evas_Engine_DirectFB.h \
22Evas_Engine_FB.h \
23Evas_Engine_Software_Win32_GDI.h \
24Evas_Engine_Software_Qtopia.h \
25Evas_Engine_GL_X11.h
26
27if BUILD_ENGINE_SOFTWARE_X11
28ENGINE_SOFTWARE_X11 = engines/software_x11/libevas_engine_software_x11.la
29ENGINE_SOFTWARE_X11_INC = Evas_Engine_Software_X11.h
30else
31ENGINE_SOFTWARE_X11 =
32ENGINE_SOFTWARE_X11_INC =
33endif
34
35if BUILD_ENGINE_DIRECTFB
36ENGINE_DIRECTFB = engines/directfb/libevas_engine_directfb.la
37ENGINE_DIRECTFB_INC = Evas_Engine_DirectFB.h
38else
39ENGINE_DIRECTFB =
40ENGINE_DIRECTFB_INC =
41endif
42
43if BUILD_ENGINE_FB
44ENGINE_FB = engines/fb/libevas_engine_fb.la
45ENGINE_FB_INC = Evas_Engine_FB.h
46else
47ENGINE_FB =
48ENGINE_FB_INC =
49endif
50
51if BUILD_ENGINE_SOFTWARE_QTOPIA
52ENGINE_SOFTWARE_QTOPIA = engines/software_qtopia/libevas_engine_software_qtopia.la
53ENGINE_SOFTWARE_QTOPIA_INC = Evas_Engine_Software_Qtopia.h
54else
55ENGINE_SOFTWARE_QTOPIA =
56ENGINE_SOFTWARE_QTOPIA_INC =
57endif
58
59if BUILD_ENGINE_GL_X11
60ENGINE_GL_X11 = engines/gl_x11/libevas_engine_gl_x11.la
61ENGINE_GL_X11_INC = Evas_Engine_GL_X11.h
62else
63ENGINE_GL_X11 =
64ENGINE_GL_X11_INC =
65endif
66
67include_HEADERS = \
68Evas.h \
69$(ENGINE_SOFTWARE_X11_INC) \
70$(ENGINE_DIRECTFB_INC) \
71$(ENGINE_FB_INC) \
72$(ENGINE_SOFTWARE_QTOPIA_INC) \
73$(ENGINE_GL_X11_INC)
74
75libevas_la_SOURCES = \
76main.c
77
78libevas_la_LIBADD = $(LDFLAGS) \
79 canvas/libevas_canvas.la \
80 data/libevas_data.la \
81 file/libevas_file.la \
82 engines/common/libevas_engine_common.la \
83 @freetype_libs@ \
84 @png_libs@ @jpeg_libs@ @eet_libs@ @edb_libs@ \
85 $(ENGINE_SOFTWARE_X11) \
86 $(ENGINE_DIRECTFB) \
87 $(ENGINE_FB) \
88 $(ENGINE_SOFTWARE_QTOPIA) \
89 $(ENGINE_GL_X11)
90
91
92libevas_la_DEPENDENCIES = \
93 $(top_builddir)/config.h \
94 canvas/libevas_canvas.la \
95 data/libevas_data.la \
96 file/libevas_file.la \
97 engines/common/libevas_engine_common.la \
98 $(ENGINE_SOFTWARE_X11) \
99 $(ENGINE_DIRECTFB) \
100 $(ENGINE_FB) \
101 $(ENGINE_SOFTWARE_QTOPIA) \
102 $(ENGINE_GL_X11)
103
104libevas_la_LDFLAGS = -version-info 1:0:0
diff --git a/legacy/evas/src/lib/canvas/Makefile.am b/legacy/evas/src/lib/canvas/Makefile.am
new file mode 100644
index 0000000000..89a70f5d60
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/Makefile.am
@@ -0,0 +1,40 @@
1## Process this file with automake to produce Makefile.in
2
3AUTOMAKE_OPTIONS = 1.4 foreign
4
5# A list of all the files in the current directory which can be regenerated
6MAINTAINERCLEANFILES = Makefile.in
7
8LDFLAGS = -L/usr/local/lib
9INCLUDES = \
10 -I. \
11 -I$(top_srcdir)/src/lib \
12 -I$(top_srcdir)/src/lib/include \
13 -I$(includedir) \
14 -I/usr/local/include \
15 @freetype_cflags@ @x_cflags@ @DIRECTFB_CFLAGS@
16
17noinst_LTLIBRARIES = libevas_canvas.la
18libevas_canvas_la_SOURCES = \
19evas_callbacks.c \
20evas_clip.c \
21evas_data.c \
22evas_events.c \
23evas_layer.c \
24evas_main.c \
25evas_name.c \
26evas_object_gradient.c \
27evas_object_image.c \
28evas_object_main.c \
29evas_object_line.c \
30evas_object_polygon.c \
31evas_object_rectangle.c \
32evas_object_smart.c \
33evas_object_text.c \
34evas_rectangle.c \
35evas_render.c \
36evas_smart.c \
37evas_stack.c
38
39libevas_canvas_la_LIBADD = $(LDFLAGS)
40libevas_canvas_la_DEPENDENCIES = $(top_builddir)/config.h
diff --git a/legacy/evas/src/lib/canvas/evas_callbacks.c b/legacy/evas/src/lib/canvas/evas_callbacks.c
new file mode 100644
index 0000000000..f0d1ced057
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_callbacks.c
@@ -0,0 +1,139 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5void
6evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void *event_info)
7{
8 Evas_Object_List **l_mod, *l;
9
10 switch (type)
11 {
12 case EVAS_CALLBACK_MOUSE_IN:
13 l_mod = &(obj->callbacks.in);
14 break;
15 case EVAS_CALLBACK_MOUSE_OUT:
16 l_mod = &(obj->callbacks.out);
17 break;
18 case EVAS_CALLBACK_MOUSE_DOWN:
19 l_mod = &(obj->callbacks.down);
20 break;
21 case EVAS_CALLBACK_MOUSE_UP:
22 l_mod = &(obj->callbacks.up);
23 break;
24 case EVAS_CALLBACK_MOUSE_MOVE:
25 l_mod = &(obj->callbacks.move);
26 break;
27 case EVAS_CALLBACK_FREE:
28 l_mod = &(obj->callbacks.free);
29 break;
30 default:
31 return;
32 break;
33 }
34 for (l = *l_mod; l; l = l->next)
35 {
36 Evas_Func_Node *fn;
37
38 fn = (Evas_Func_Node *)l;
39 fn->func(fn->data, obj->layer->evas, obj, event_info);
40 }
41}
42
43/* public functions */
44
45void
46evas_object_event_callback_add(Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info), void *data)
47{
48 Evas_Func_Node *fn;
49
50 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
51 return;
52 MAGIC_CHECK_END();
53
54 if (!func) return;
55 if (obj->smart.smart) return;
56
57 fn = calloc(1, sizeof(Evas_Func_Node));
58 if (!fn) return;
59 fn->func = func;
60 fn->data = data;
61 switch (type)
62 {
63 case EVAS_CALLBACK_MOUSE_IN:
64 obj->callbacks.in = evas_object_list_prepend(obj->callbacks.in, fn);
65 break;
66 case EVAS_CALLBACK_MOUSE_OUT:
67 obj->callbacks.out = evas_object_list_prepend(obj->callbacks.out, fn);
68 break;
69 case EVAS_CALLBACK_MOUSE_DOWN:
70 obj->callbacks.down = evas_object_list_prepend(obj->callbacks.down, fn);
71 break;
72 case EVAS_CALLBACK_MOUSE_UP:
73 obj->callbacks.up = evas_object_list_prepend(obj->callbacks.up, fn);
74 break;
75 case EVAS_CALLBACK_MOUSE_MOVE:
76 obj->callbacks.move = evas_object_list_prepend(obj->callbacks.move, fn);
77 break;
78 case EVAS_CALLBACK_FREE:
79 obj->callbacks.free = evas_object_list_prepend(obj->callbacks.free, fn);
80 break;
81 default:
82 return;
83 break;
84 }
85}
86
87void *
88evas_object_event_callback_del(Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info))
89{
90 Evas_Object_List **l_mod, *l;
91
92 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
93 return NULL;
94 MAGIC_CHECK_END();
95
96 if (!func) return NULL;
97 if (obj->smart.smart) return NULL;
98
99 switch (type)
100 {
101 case EVAS_CALLBACK_MOUSE_IN:
102 l_mod = &(obj->callbacks.in);
103 break;
104 case EVAS_CALLBACK_MOUSE_OUT:
105 l_mod = &(obj->callbacks.out);
106 break;
107 case EVAS_CALLBACK_MOUSE_DOWN:
108 l_mod = &(obj->callbacks.down);
109 break;
110 case EVAS_CALLBACK_MOUSE_UP:
111 l_mod = &(obj->callbacks.up);
112 break;
113 case EVAS_CALLBACK_MOUSE_MOVE:
114 l_mod = &(obj->callbacks.move);
115 break;
116 case EVAS_CALLBACK_FREE:
117 l_mod = &(obj->callbacks.free);
118 break;
119 default:
120 return NULL;
121 break;
122 }
123 for (l = *l_mod; l; l = l->next)
124 {
125 Evas_Func_Node *fn;
126
127 fn = (Evas_Func_Node *)l;
128 if (fn->func == func)
129 {
130 void *data;
131
132 data = fn->data;
133 *l_mod = evas_object_list_remove(*l_mod, fn);
134 free(fn);
135 return data;
136 }
137 }
138 return NULL;
139}
diff --git a/legacy/evas/src/lib/canvas/evas_clip.c b/legacy/evas/src/lib/canvas/evas_clip.c
new file mode 100644
index 0000000000..5a53820307
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_clip.c
@@ -0,0 +1,174 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5void
6evas_object_clip_recalc(Evas_Object *obj)
7{
8 int cx, cy, cw, ch, cvis, cr, cg, cb, ca;
9 int nx, ny, nw, nh, nvis, nr, ng, nb, na;
10
11 evas_object_coords_recalc(obj);
12 cx = obj->cur.cache.geometry.x; cy = obj->cur.cache.geometry.y;
13 cw = obj->cur.cache.geometry.w; ch = obj->cur.cache.geometry.h;
14 if (obj->cur.color.a == 0) cvis = 0;
15 else cvis = obj->cur.visible;
16 cr = obj->cur.color.r; cg = obj->cur.color.g;
17 cb = obj->cur.color.b; ca = obj->cur.color.a;
18 if (obj->cur.clipper)
19 {
20 evas_object_clip_recalc(obj->cur.clipper);
21 nx = obj->cur.clipper->cur.cache.clip.x;
22 ny = obj->cur.clipper->cur.cache.clip.y;
23 nw = obj->cur.clipper->cur.cache.clip.w;
24 nh = obj->cur.clipper->cur.cache.clip.h;
25 nvis = obj->cur.clipper->cur.cache.clip.visible;
26 nr = obj->cur.clipper->cur.cache.clip.r;
27 ng = obj->cur.clipper->cur.cache.clip.g;
28 nb = obj->cur.clipper->cur.cache.clip.b;
29 na = obj->cur.clipper->cur.cache.clip.a;
30 RECTS_CLIP_TO_RECT(cx, cy, cw, ch, nx, ny, nw, nh);
31 cvis = cvis * nvis;
32 cr = (cr * (nr + 1)) >> 8;
33 cg = (cg * (ng + 1)) >> 8;
34 cb = (cb * (nb + 1)) >> 8;
35 ca = (ca * (na + 1)) >> 8;
36 }
37 if ((ca == 0) || (cw <= 0) || (ch <= 0)) cvis = 0;
38 obj->cur.cache.clip.x = cx;
39 obj->cur.cache.clip.y = cy;
40 obj->cur.cache.clip.w = cw;
41 obj->cur.cache.clip.h = ch;
42 obj->cur.cache.clip.visible = cvis;
43 obj->cur.cache.clip.r = cr;
44 obj->cur.cache.clip.g = cg;
45 obj->cur.cache.clip.b = cb;
46 obj->cur.cache.clip.a = ca;
47}
48
49void
50evas_object_recalc_clippees(Evas_Object *obj)
51{
52 Evas_List *l;
53
54 evas_object_clip_recalc(obj);
55 for (l = obj->clip.clipees; l; l = l->next)
56 {
57 evas_object_recalc_clippees(l->data);
58 }
59}
60
61int
62evas_object_clippers_is_visible(Evas_Object *obj)
63{
64 if (obj->cur.visible)
65 {
66 if (obj->cur.clipper)
67 return evas_object_clippers_is_visible(obj->cur.clipper);
68 return 1;
69 }
70 return 0;
71}
72
73int
74evas_object_clippers_was_visible(Evas_Object *obj)
75{
76 if (obj->prev.visible)
77 {
78 if (obj->prev.clipper)
79 return evas_object_clippers_is_visible(obj->prev.clipper);
80 return 1;
81 }
82 return 0;
83}
84
85/* public functions */
86
87void
88evas_object_clip_set(Evas_Object *obj, Evas_Object *clip)
89{
90 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
91 return;
92 MAGIC_CHECK_END();
93 if (!clip)
94 {
95 evas_object_clip_unset(obj);
96 return;
97 }
98 MAGIC_CHECK(clip, Evas_Object, MAGIC_OBJ);
99 return;
100 MAGIC_CHECK_END();
101 if (obj->cur.clipper == clip) return;
102 if (obj->smart.smart)
103 {
104 if (obj->smart.smart->func_clip_set)
105 obj->smart.smart->func_clip_set(obj, clip);
106 }
107 if (obj->cur.clipper)
108 {
109 /* unclip */
110 obj->cur.clipper->clip.clipees = evas_list_remove(obj->cur.clipper->clip.clipees, obj);
111 evas_object_change(obj);
112 obj->cur.clipper = NULL;
113 }
114 /* clip me */
115 obj->cur.clipper = clip;
116 clip->clip.clipees = evas_list_append(clip->clip.clipees, obj);
117 evas_object_change(obj);
118 evas_object_recalc_clippees(obj);
119 if (!obj->smart.smart)
120 {
121 if (evas_object_is_in_output_rect(obj,
122 obj->layer->evas->pointer.x,
123 obj->layer->evas->pointer.y, 1, 1))
124 evas_event_feed_mouse_move(obj->layer->evas,
125 obj->layer->evas->pointer.x,
126 obj->layer->evas->pointer.y);
127 }
128}
129
130Evas_Object *
131evas_object_clip_get(Evas_Object *obj)
132{
133 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
134 return NULL;
135 MAGIC_CHECK_END();
136 return obj->cur.clipper;
137}
138
139void
140evas_object_clip_unset(Evas_Object *obj)
141{
142 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
143 return;
144 MAGIC_CHECK_END();
145 if (!obj->cur.clipper) return;
146 /* unclip */
147 if (obj->smart.smart)
148 {
149 if (obj->smart.smart->func_clip_unset)
150 obj->smart.smart->func_clip_unset(obj);
151 }
152 obj->cur.clipper->clip.clipees = evas_list_remove(obj->cur.clipper->clip.clipees, obj);
153 obj->cur.clipper = NULL;
154 evas_object_change(obj);
155 evas_object_recalc_clippees(obj);
156 if (!obj->smart.smart)
157 {
158 if (evas_object_is_in_output_rect(obj,
159 obj->layer->evas->pointer.x,
160 obj->layer->evas->pointer.y, 1, 1))
161 evas_event_feed_mouse_move(obj->layer->evas,
162 obj->layer->evas->pointer.x,
163 obj->layer->evas->pointer.y);
164 }
165}
166
167Evas_List *
168evas_object_clipees_get(Evas_Object *obj)
169{
170 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
171 return NULL;
172 MAGIC_CHECK_END();
173 return obj->clip.clipees;
174}
diff --git a/legacy/evas/src/lib/canvas/evas_data.c b/legacy/evas/src/lib/canvas/evas_data.c
new file mode 100644
index 0000000000..815d1f45e6
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_data.c
@@ -0,0 +1,74 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5void
6evas_object_data_set(Evas_Object *obj, const char *key, void *data)
7{
8 Evas_Data_Node *node;
9
10 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
11 return;
12 MAGIC_CHECK_END();
13 if (!key) return;
14
15 evas_object_data_del(obj, key);
16
17 node = malloc(sizeof(Evas_Data_Node));
18 node->key = strdup(key);
19 node->data = data;
20 obj->data.elements = evas_list_prepend(obj->data.elements, node);
21}
22
23void *
24evas_object_data_get(Evas_Object *obj, const char *key)
25{
26 Evas_List *l;
27
28 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
29 return NULL;
30 MAGIC_CHECK_END();
31 if (!key) return NULL;
32
33 for (l = obj->data.elements; l; l = l->next)
34 {
35 Evas_Data_Node *node;
36
37 node = l->data;
38 if (!strcmp(node->key, key))
39 {
40 obj->data.elements = evas_list_remove(obj->data.elements, node);
41 obj->data.elements = evas_list_prepend(obj->data.elements, node);
42 return node->data;
43 }
44 }
45 return NULL;
46}
47
48void *
49evas_object_data_del(Evas_Object *obj, const char *key)
50{
51 Evas_List *l;
52
53 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
54 return NULL;
55 MAGIC_CHECK_END();
56 if (!key) return NULL;
57 for (l = obj->data.elements; l; l = l->next)
58 {
59 Evas_Data_Node *node;
60
61 node = l->data;
62 if (!strcmp(node->key, key))
63 {
64 void *data;
65
66 data = node->data;
67 obj->data.elements = evas_list_remove(obj->data.elements, node);
68 free(node->key);
69 free(node);
70 return data;
71 }
72 }
73 return NULL;
74}
diff --git a/legacy/evas/src/lib/canvas/evas_events.c b/legacy/evas/src/lib/canvas/evas_events.c
new file mode 100644
index 0000000000..d67dd51e3b
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_events.c
@@ -0,0 +1,470 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5Evas_List *
6evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y)
7{
8 Evas_Object_List *l;
9 Evas_List *in = NULL;
10
11 if (!e->layers) return NULL;
12 for (l = ((Evas_Object_List *)(e->layers))->last; l; l = l->prev)
13 {
14 Evas_Object_List *l2;
15 Evas_Layer *lay;
16
17 lay = (Evas_Layer *)l;
18 for (l2 = ((Evas_Object_List *)(lay->objects))->last; l2; l2 = l2->prev)
19 {
20 Evas_Object *obj;
21
22 obj = (Evas_Object *)l2;
23 if (obj == stop) goto done;
24 if ((!obj->pass_events) && (!obj->smart.smart))
25 {
26 evas_object_clip_recalc(obj);
27 if ((evas_object_is_in_output_rect(obj, x, y, 1, 1)) &&
28 (obj->cur.visible) &&
29 (obj->delete_me == 0) &&
30 (evas_object_clippers_is_visible(obj)) &&
31 (!obj->clip.clipees))
32 {
33 in = evas_list_append(in, obj);
34 if (!obj->repeat_events) goto done;
35 }
36 }
37 }
38 }
39 done:
40 return in;
41}
42
43static Evas_List *evas_event_list_copy(Evas_List *list);
44static Evas_List *
45evas_event_list_copy(Evas_List *list)
46{
47 Evas_List *l, *new_l = NULL;
48
49 for (l = list; l; l = l->next)
50 new_l = evas_list_append(new_l, l->data);
51 return new_l;
52}
53/* public functions */
54
55void
56evas_event_freeze(Evas *e)
57{
58 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
59 return;
60 MAGIC_CHECK_END();
61 e->events_frozen++;
62}
63
64void
65evas_event_thaw(Evas *e)
66{
67 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
68 return;
69 MAGIC_CHECK_END();
70 e->events_frozen--;
71}
72
73int
74evas_event_freeze_get(Evas *e)
75{
76 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
77 return 0;
78 MAGIC_CHECK_END();
79 return e->events_frozen;
80}
81
82void
83evas_event_feed_mouse_down_data(Evas *e, int b, void *data)
84{
85 Evas_List *l, *copy;
86
87 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
88 return;
89 MAGIC_CHECK_END();
90
91 if ((b < 1) || (b > 32)) return;
92
93 e->pointer.button |= (1 << (b - 1));
94
95 if (e->events_frozen > 0) return;
96
97 copy = evas_event_list_copy(e->pointer.object.in);
98 for (l = copy; l; l = l->next)
99 {
100 Evas_Object *obj;
101 Evas_Event_Mouse_Down ev;
102
103 obj = l->data;
104 obj->mouse_grabbed = 1;
105 e->pointer.mouse_grabbed = 1;
106
107 ev.button = b;
108 ev.output.x = e->pointer.x;
109 ev.output.y = e->pointer.y;
110 ev.canvas.x = e->pointer.canvas_x;
111 ev.canvas.y = e->pointer.canvas_y;
112 ev.data = data;
113 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_DOWN, &ev);
114 }
115 if (copy) copy = evas_list_free(copy);
116}
117
118void
119evas_event_feed_mouse_up_data(Evas *e, int b, void *data)
120{
121 Evas_List *l, *copy;
122
123 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
124 return;
125 MAGIC_CHECK_END();
126
127 if ((b < 1) || (b > 32)) return;
128
129 e->pointer.button &= ~(1 << (b - 1));
130
131 if (e->events_frozen > 0) return;
132
133 copy = evas_event_list_copy(e->pointer.object.in);
134 for (l = copy; l; l = l->next)
135 {
136 Evas_Object *obj;
137 Evas_Event_Mouse_Up ev;
138
139 obj = l->data;
140 if (!e->pointer.button) obj->mouse_grabbed = 0;
141 ev.button = b;
142 ev.output.x = e->pointer.x;
143 ev.output.y = e->pointer.y;
144 ev.canvas.x = e->pointer.canvas_x;
145 ev.canvas.y = e->pointer.canvas_y;
146 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_UP, &ev);
147 }
148 if (copy) copy = evas_list_free(copy);
149 if (!e->pointer.button)
150 {
151 Evas_List *ins;
152 Evas_List *l;
153
154 e->pointer.mouse_grabbed = 0;
155 /* get new list of ins */
156 ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y);
157 /* go thru old list of in objects */
158 copy = evas_event_list_copy(e->pointer.object.in);
159 for (l = copy; l; l = l->next)
160 {
161 Evas_Object *obj;
162
163 obj = l->data;
164 obj->mouse_grabbed = 0;
165 if (!evas_list_find(ins, obj))
166 {
167 Evas_Event_Mouse_Out ev;
168
169 obj->mouse_in = 0;
170 ev.buttons = e->pointer.button;
171 ev.output.x = e->pointer.x;
172 ev.output.y = e->pointer.y;
173 ev.canvas.x = e->pointer.canvas_x;
174 ev.canvas.y = e->pointer.canvas_y;
175 ev.data = data;
176 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
177 }
178 }
179 if (copy) copy = evas_list_free(copy);
180 for (l = ins; l; l = l->next)
181 {
182 Evas_Object *obj;
183
184 obj = l->data;
185
186 if (!evas_list_find(e->pointer.object.in, obj))
187 {
188 Evas_Event_Mouse_In ev;
189
190 obj->mouse_in = 1;
191 ev.buttons = e->pointer.button;
192 ev.output.x = e->pointer.x;
193 ev.output.y = e->pointer.y;
194 ev.canvas.x = e->pointer.canvas_x;
195 ev.canvas.y = e->pointer.canvas_y;
196 ev.data = data;
197 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
198 }
199 }
200 /* free our old list of ins */
201 e->pointer.object.in = evas_list_free(e->pointer.object.in);
202 /* and set up the new one */
203 e->pointer.object.in = ins;
204 evas_event_feed_mouse_move_data(e, e->pointer.x, e->pointer.y, data);
205 }
206}
207
208void
209evas_event_feed_mouse_move_data(Evas *e, int x, int y, void *data)
210{
211 int px, py;
212 double pcx, pcy;
213
214 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
215 return;
216 MAGIC_CHECK_END();
217
218 px = e->pointer.x;
219 py = e->pointer.y;
220 pcx = e->pointer.canvas_x;
221 pcy = e->pointer.canvas_y;
222
223 if (e->events_frozen > 0) return;
224
225 e->pointer.x = x;
226 e->pointer.y = y;
227 e->pointer.canvas_x = evas_coord_screen_x_to_world(e, x);
228 e->pointer.canvas_y = evas_coord_screen_x_to_world(e, y);
229 /* if our mouse button is grabbed to any objects */
230 if (e->pointer.mouse_grabbed)
231 {
232 /* go thru old list of in objects */
233 Evas_List *outs = NULL;
234 Evas_List *l, *copy;
235
236 copy = evas_event_list_copy(e->pointer.object.in);
237 for (l = copy; l; l = l->next)
238 {
239 Evas_Object *obj;
240
241 obj = l->data;
242 if ((obj->cur.visible) &&
243 (evas_object_clippers_is_visible(obj)) &&
244 (!obj->pass_events) &&
245 (!obj->smart.smart) &&
246 (!obj->clip.clipees))
247 {
248 if ((px != x) || (py != y))
249 {
250 Evas_Event_Mouse_Move ev;
251
252 ev.buttons = e->pointer.button;
253 ev.cur.output.x = e->pointer.x;
254 ev.cur.output.y = e->pointer.y;
255 ev.cur.canvas.x = e->pointer.canvas_x;
256 ev.cur.canvas.y = e->pointer.canvas_y;
257 ev.prev.output.x = px;
258 ev.prev.output.y = py;
259 ev.prev.canvas.x = pcx;
260 ev.prev.canvas.y = pcy;
261 ev.data = data;
262 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev);
263 }
264 }
265 else
266 outs = evas_list_append(outs, obj);
267 }
268 if (copy) copy = evas_list_free(copy);
269 while (outs)
270 {
271 Evas_Object *obj;
272
273 obj = outs->data;
274 outs = evas_list_remove(outs, obj);
275 e->pointer.object.in = evas_list_remove(e->pointer.object.in, obj);
276 {
277 Evas_Event_Mouse_Out ev;
278
279 obj->mouse_in = 0;
280 ev.buttons = e->pointer.button;
281 ev.output.x = e->pointer.x;
282 ev.output.y = e->pointer.y;
283 ev.canvas.x = e->pointer.canvas_x;
284 ev.canvas.y = e->pointer.canvas_y;
285 ev.data = data;
286 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
287 }
288 }
289 }
290 else
291 {
292 Evas_List *ins;
293 Evas_List *l, *copy;
294
295 /* get all new in objects */
296 ins = evas_event_objects_event_list(e, NULL, x, y);
297 /* go thru old list of in objects */
298 copy = evas_event_list_copy(e->pointer.object.in);
299 for (l = copy; l; l = l->next)
300 {
301 Evas_Object *obj;
302
303 obj = l->data;
304 /* if its under the pointer and its visible and its in the new */
305 /* in list */
306 evas_object_clip_recalc(obj);
307 if (evas_object_is_in_output_rect(obj, x, y, 1, 1) &&
308 (obj->cur.visible) &&
309 (evas_object_clippers_is_visible(obj)) &&
310 (evas_list_find(ins, obj)) &&
311 (!obj->pass_events) &&
312 (!obj->smart.smart) &&
313 (!obj->clip.clipees))
314 {
315 if ((px != x) || (py != y))
316 {
317 Evas_Event_Mouse_Move ev;
318
319 ev.buttons = e->pointer.button;
320 ev.cur.output.x = e->pointer.x;
321 ev.cur.output.y = e->pointer.y;
322 ev.cur.canvas.x = e->pointer.canvas_x;
323 ev.cur.canvas.y = e->pointer.canvas_y;
324 ev.prev.output.x = px;
325 ev.prev.output.y = py;
326 ev.prev.canvas.x = pcx;
327 ev.prev.canvas.y = pcy;
328 ev.data = data;
329 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev);
330 }
331 }
332 /* otherwise it has left the object */
333 else
334 {
335 Evas_Event_Mouse_Out ev;
336
337 obj->mouse_in = 0;
338 ev.buttons = e->pointer.button;
339 ev.output.x = e->pointer.x;
340 ev.output.y = e->pointer.y;
341 ev.canvas.x = e->pointer.canvas_x;
342 ev.canvas.y = e->pointer.canvas_y;
343 ev.data = data;
344 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
345 }
346 }
347 if (copy) copy = evas_list_free(copy);
348 /* go thru out current list of ins */
349 for (l = ins; l; l = l->next)
350 {
351 Evas_Object *obj;
352
353 obj = l->data;
354 /* if its not in the old list of ins send an enter event */
355 if (!evas_list_find(e->pointer.object.in, obj))
356 {
357 Evas_Event_Mouse_In ev;
358
359 obj->mouse_in = 1;
360 ev.buttons = e->pointer.button;
361 ev.output.x = e->pointer.x;
362 ev.output.y = e->pointer.y;
363 ev.canvas.x = e->pointer.canvas_x;
364 ev.canvas.y = e->pointer.canvas_y;
365 ev.data = data;
366 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
367 }
368 }
369 /* free our old list of ins */
370 e->pointer.object.in = evas_list_free(e->pointer.object.in);
371 /* and set up the new one */
372 e->pointer.object.in = ins;
373 }
374}
375
376void
377evas_event_feed_mouse_in_data(Evas *e, void *data)
378{
379 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
380 return;
381 MAGIC_CHECK_END();
382 e->pointer.inside = 1;
383}
384
385void
386evas_event_feed_mouse_out_data(Evas *e, void *data)
387{
388 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
389 return;
390 MAGIC_CHECK_END();
391 e->pointer.inside = 0;
392}
393
394void
395evas_event_feed_mouse_down(Evas *e, int b)
396{
397 evas_event_feed_mouse_down_data(e, b, NULL);
398}
399
400void
401evas_event_feed_mouse_up(Evas *e, int b)
402{
403 evas_event_feed_mouse_up_data(e, b, NULL);
404}
405
406void
407evas_event_feed_mouse_move(Evas *e, int x, int y)
408{
409 evas_event_feed_mouse_move_data(e, x, y, NULL);
410}
411
412void
413evas_event_feed_mouse_in(Evas *e)
414{
415 evas_event_feed_mouse_in_data(e, NULL);
416}
417
418void
419evas_event_feed_mouse_out(Evas *e)
420{
421 evas_event_feed_mouse_out_data(e, NULL);
422}
423
424void
425evas_object_pass_events_set(Evas_Object *obj, int pass)
426{
427 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
428 return;
429 MAGIC_CHECK_END();
430 obj->pass_events = pass;
431 if (evas_object_is_in_output_rect(obj,
432 obj->layer->evas->pointer.x,
433 obj->layer->evas->pointer.y, 1, 1))
434 evas_event_feed_mouse_move(obj->layer->evas,
435 obj->layer->evas->pointer.x,
436 obj->layer->evas->pointer.y);
437}
438
439int
440evas_object_pass_events_get(Evas_Object *obj)
441{
442 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
443 return 0;
444 MAGIC_CHECK_END();
445 return obj->pass_events;
446}
447
448void
449evas_object_repeat_events_set(Evas_Object *obj, int repeat)
450{
451 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
452 return;
453 MAGIC_CHECK_END();
454 obj->repeat_events = repeat;
455 if (evas_object_is_in_output_rect(obj,
456 obj->layer->evas->pointer.x,
457 obj->layer->evas->pointer.y, 1, 1))
458 evas_event_feed_mouse_move(obj->layer->evas,
459 obj->layer->evas->pointer.x,
460 obj->layer->evas->pointer.y);
461}
462
463int
464evas_object_repeat_events_get(Evas_Object *obj)
465{
466 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
467 return 0;
468 MAGIC_CHECK_END();
469 return obj->repeat_events;
470}
diff --git a/legacy/evas/src/lib/canvas/evas_layer.c b/legacy/evas/src/lib/canvas/evas_layer.c
new file mode 100644
index 0000000000..3064b844f2
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_layer.c
@@ -0,0 +1,151 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5void
6evas_object_inject(Evas_Object *obj, Evas *e)
7{
8 Evas_Layer *lay;
9
10 lay = evas_layer_find(e, obj->cur.layer);
11 if (!lay)
12 {
13 lay = evas_layer_new(e);
14 lay->layer = obj->cur.layer;
15 evas_layer_add(lay);
16 }
17 lay->objects = evas_object_list_append(lay->objects, obj);
18 obj->layer = lay;
19}
20
21void
22evas_object_release(Evas_Object *obj, int clean_layer)
23{
24 obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj);
25 if (clean_layer)
26 {
27 if (!obj->layer->objects)
28 {
29 evas_layer_del(obj->layer);
30 evas_layer_free(obj->layer);
31 }
32 }
33 obj->layer = NULL;
34}
35
36Evas_Layer *
37evas_layer_new(Evas *e)
38{
39 Evas_Layer *lay;
40
41 lay = calloc(1, sizeof(Evas_Layer));
42 if (!lay) return NULL;
43 lay->evas = e;
44 return lay;
45}
46
47void
48evas_layer_free(Evas_Layer *lay)
49{
50 while (lay->objects)
51 {
52 Evas_Object *obj;
53
54 obj = (Evas_Object *)lay->objects;
55 if (obj->smart.smart) evas_object_smart_del(obj);
56 evas_object_free(obj, 0);
57 }
58 free(lay);
59}
60
61Evas_Layer *
62evas_layer_find(Evas *e, int layer_num)
63{
64 Evas_Object_List *list;
65
66 for (list = (Evas_Object_List *)e->layers; list; list = list->next)
67 {
68 Evas_Layer *layer;
69
70 layer = (Evas_Layer *)list;
71 if (layer->layer == layer_num) return layer;
72 }
73 return NULL;
74}
75
76void
77evas_layer_add(Evas_Layer *lay)
78{
79 Evas_Object_List *list;
80
81 for (list = (Evas_Object_List *)lay->evas->layers; list; list = list->next)
82 {
83 Evas_Layer *layer;
84
85 layer = (Evas_Layer *)list;
86 if (layer->layer > lay->layer)
87 {
88 lay->evas->layers = evas_object_list_prepend_relative(lay->evas->layers, lay, layer);
89 return;
90 }
91 }
92 lay->evas->layers = evas_object_list_append(lay->evas->layers, lay);
93}
94
95void
96evas_layer_del(Evas_Layer *lay)
97{
98 Evas_Object_List *ol;
99 Evas *e;
100
101 ol = (Evas_Object_List *)lay;
102 e = lay->evas;
103 e->layers = evas_object_list_remove(e->layers, lay);
104}
105
106/* public functions */
107
108void
109evas_object_layer_set(Evas_Object *obj, int l)
110{
111 Evas *e;
112
113 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
114 return;
115 MAGIC_CHECK_END();
116 if (obj->cur.layer == l)
117 {
118 evas_object_raise(obj);
119 return;
120 }
121 if (obj->smart.smart)
122 {
123 if (obj->smart.smart->func_layer_set)
124 obj->smart.smart->func_layer_set(obj, l);
125 }
126 e = obj->layer->evas;
127 evas_object_release(obj, 1);
128 obj->cur.layer = l;
129 evas_object_inject(obj, e);
130 obj->restack = 1;
131 if (obj->clip.clipees) return;
132 if (!obj->smart.smart)
133 {
134 evas_object_change(obj);
135 if (evas_object_is_in_output_rect(obj,
136 obj->layer->evas->pointer.x,
137 obj->layer->evas->pointer.y, 1, 1) &&
138 obj->cur.visible)
139 if (evas_list_find(obj->layer->evas->pointer.object.in, obj))
140 evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y);
141 }
142}
143
144int
145evas_object_layer_get(Evas_Object *obj)
146{
147 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
148 return 0;
149 MAGIC_CHECK_END();
150 return obj->cur.layer;
151}
diff --git a/legacy/evas/src/lib/canvas/evas_main.c b/legacy/evas/src/lib/canvas/evas_main.c
new file mode 100644
index 0000000000..df02be89e3
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_main.c
@@ -0,0 +1,897 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#ifdef BUILD_ENGINE_SOFTWARE_X11
4#include "evas_engine_api_software_x11.h"
5#endif
6#ifdef BUILD_ENGINE_DIRECTFB
7#include "evas_engine_api_directfb.h"
8#endif
9#ifdef BUILD_ENGINE_FB
10#include "evas_engine_api_fb.h"
11#endif
12#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
13#include "evas_engine_api_software_win32_gdi.h"
14#endif
15#ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
16#include "evas_engine_api_software_qtopia.h"
17#endif
18#ifdef BUILD_ENGINE_GL_X11
19#include "evas_engine_api_gl_x11.h"
20#endif
21
22#include "Evas.h"
23
24/**
25 * Allocate and new Evas empty canvas.
26 * @return A zeroed out Evas, or NULL on failure
27 *
28 * This function creates a new Evas Canvas object that is completely
29 * uninitialised. You cannot sensibly use this until it has been initialised.
30 * You need to set up the rendering engine first for the canvas before you can
31 * add any objects to the canvas or render it.
32 *
33 * This function will always succeed and return a valid canvas pointer unless
34 * the memory allocation fails, in which case NULL will be returned.
35 *
36 * Example:
37 * @code
38 * Evas *evas;
39 *
40 * evas = evas_new();
41 * @endcode
42 */
43Evas *
44evas_new(void)
45{
46 Evas *e;
47
48 e = calloc(1, sizeof(Evas));
49 if (!e) return NULL;
50
51 e->magic = MAGIC_EVAS;
52 e->output.render_method = RENDER_METHOD_INVALID;
53
54 return e;
55}
56
57/**
58 * Free an Evas.
59 * @param e The Pointer to the Evas to be freed
60 *
61 * When called this function frees the Evas Canvas @p e and All Evas Objects
62 * created on this canvas. As the objects are freed if they have free callbacks
63 * set, they will be called during the execution of this function.
64 *
65 * Example:
66 * @code
67 * extern Evas *evas;
68 *
69 * evas_free(evas);
70 * @endcode
71 */
72void
73evas_free(Evas *e)
74{
75 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
76 return;
77 MAGIC_CHECK_END();
78
79 evas_object_font_path_clear(e);
80
81 e->pointer.object.in = evas_list_free(e->pointer.object.in);
82 while (e->layers)
83 {
84 Evas_Layer *lay;
85
86 lay = e->layers;
87 evas_layer_del(lay);
88 evas_layer_free(lay);
89 }
90
91 if (e->name_hash) evas_hash_free(e->name_hash);
92
93 while (e->damages)
94 {
95 free(e->damages->data);
96 e->damages = evas_list_remove(e->damages, e->damages->data);
97 }
98 while (e->obscures)
99 {
100 free(e->obscures->data);
101 e->obscures = evas_list_remove(e->obscures, e->obscures->data);
102 }
103
104 e->engine.func->info_free(e, e->engine.info);
105 e->engine.func->context_free(e->engine.data.output, e->engine.data.context);
106 e->engine.func->output_free(e->engine.data.output);
107
108 e->magic = 0;
109 free(e);
110}
111
112/**
113 * Set the output method (engine) for the Evas.
114 * @param e The pointer to the Evas Canvas have its engine set
115 * @param render_method The numeric engine value to use.
116 *
117 * This call sets up which engine an Evas Canvas is to use from then on. This
118 * can only be done once and following calls of this function once called once
119 * will do nothing. The render method numeric value can be obtained using the
120 * evas_render_method_lookup() call.
121 *
122 * Example:
123 * @code
124 * int engine_id;
125 * Evas *evas;
126 *
127 * evas = evas_new();
128 * engine_id = evas_render_method_lookup("software_x11");
129 * evas_output_method_set(evas, engine_id);
130 * @endcode
131 */
132void
133evas_output_method_set(Evas *e, int render_method)
134{
135 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
136 return;
137 MAGIC_CHECK_END();
138
139 /* if our engine to set it to is invalid - abort */
140 if (render_method == RENDER_METHOD_INVALID) return;
141 /* if the engine is alreayd set up - abort */
142 if (e->output.render_method != RENDER_METHOD_INVALID) return;
143 /* set the render method */
144 e->output.render_method = render_method;
145#ifdef BUILD_ENGINE_SOFTWARE_X11
146 if (e->output.render_method == RENDER_METHOD_SOFTWARE_X11)
147 e->engine.func = &evas_engine_software_x11_func;
148 else
149#endif
150#ifdef BUILD_ENGINE_GL_X11
151 if (e->output.render_method == RENDER_METHOD_GL_X11)
152 e->engine.func = &evas_engine_gl_x11_func;
153 else
154#endif
155#ifdef BUILD_ENGINE_DIRECTFB
156 if (e->output.render_method == RENDER_METHOD_DIRECTFB)
157 e->engine.func = &evas_engine_directfb_func;
158 else
159#endif
160#ifdef BUILD_ENGINE_FB
161 if (e->output.render_method == RENDER_METHOD_FB)
162 e->engine.func = &evas_engine_fb_func;
163 else
164#endif
165#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
166 if (e->output.render_method == RENDER_METHOD_SOFTWARE_WIN32_GDI)
167 e->engine.func = &evas_engine_software_win32_gdi_func;
168 else
169#endif
170#ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
171 if (e->output.render_method == RENDER_METHOD_SOFTWARE_QTOPIA)
172 e->engine.func = &evas_engine_software_qtopia_func;
173 else
174#endif
175 return;
176 /* get the engine info struct */
177 if (e->output.render_method != RENDER_METHOD_INVALID)
178 {
179 if (e->engine.func->info) e->engine.info = e->engine.func->info(e);
180 }
181}
182
183/**
184 * Get the output method (engine) for the Evas.
185 * @param e The pointer to the Evas Canvas
186 * @return A numeric engine value
187 *
188 * This function returns the rendering engine currently used bu the given Evas
189 * Canvas passed in. On success the rendering engine used by the Canvas is
190 * returned. On failue 0 is returned.
191 *
192 * Example:
193 * @code
194 * extern Evas *evas;
195 * int engine_id;
196 *
197 * engine_id = evas_output_method_get(evas);
198 *
199 * @endcode
200 */
201int
202evas_output_method_get(Evas *e)
203{
204 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
205 return RENDER_METHOD_INVALID;
206 MAGIC_CHECK_END();
207
208 return e->output.render_method;
209}
210
211/**
212 * Get the render engine info struct from the canvas.
213 * @param e The pointer to the Evas Canvas
214 * @return A pointer to the Engine Info structure
215 *
216 * Calling this function returns a pointer to a publicly modifyable structure
217 * that the rendering engine for the given canvas has set up. Callin this
218 * function before the rendering engine has been set will result in NULL being
219 * returned, as will calling this function on an invalid canvas. The caller
220 * does no need to free this structure and shoudl only assume that the pointer
221 * tois is valid until evas_engine_info_set() is called or until evas_render()
222 * is called. After these calls the contents of this structure and the pointer
223 * to it are not guaranteed to be valid.
224 *
225 * With some engines calling this call and modifying structure parameters,
226 * then calling evas_engine_info_set() is used to modify engine parameters
227 * whilst the canvas is alive.
228 *
229 * Example:
230 * @code
231 * Evas *evas;
232 * Evas_Engine_Info_Software_X11 *einfo;
233 * extern Display *display;
234 * extern Window win;
235 *
236 * evas = evas_new();
237 * evas_output_method_set(evas, evas_render_method_lookup("software_x11"));
238 * evas_output_size_set(evas, 640, 480);
239 * evas_output_viewport_set(evas, 0, 0, 640, 480);
240 * einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas);
241 * einfo->info.display = display;
242 * einfo->info.visual = DefaultVisual(display, DefaultScreen(display));
243 * einfo->info.colormap = DefaultColormap(display, DefaultScreen(display));
244 * einfo->info.drawable = win;
245 * einfo->info.depth = DefaultDepth(display, DefaultScreen(display));
246 * evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
247 * @endcode
248 */
249Evas_Engine_Info *
250evas_engine_info_get(Evas *e)
251{
252 Evas_Engine_Info *info;
253
254 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
255 return NULL;
256 MAGIC_CHECK_END();
257
258 info = e->engine.info;
259 e->engine.info_magic = info->magic;
260
261 return info;
262}
263
264/**
265 * Set up the Engine Info from the info structure.
266 * @param e The pointer to the Evas Canvas
267 * @param info The pointer to the Engine Info to use
268 *
269 * This function takes any parameters set in the provided info structure and
270 * applies them to the rendering engine. You need to use the Engine Info
271 * structure pointer provided by evas_engine_info_get() and not anything else.
272 *
273 * You need to set up the Engine Info at least once before doing any rendering
274 * or creating any objects on the Evas Canvas. Some engines support the
275 * changing of engine parameters during runtime and so the application
276 * should call evas_engine_info_get(), modify parameters that need to be
277 * modified, and then call evas_engine_info_set() again to have those changes
278 * take effect.
279 *
280 * Once evas_engine_info_set() is called the Engine Info structure pointer
281 * should be considered invalid and should not be used again. Use
282 * evas_engine_info_get(0 to fetch it again if needed.
283 *
284 * Example:
285 * @code
286 * Evas *evas;
287 * Evas_Engine_Info_Software_X11 *einfo;
288 * extern Display *display;
289 * extern Window win;
290 *
291 * evas = evas_new();
292 * evas_output_method_set(evas, evas_render_method_lookup("software_x11"));
293 * evas_output_size_set(evas, 640, 480);
294 * evas_output_viewport_set(evas, 0, 0, 640, 480);
295 * einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas);
296 * einfo->info.display = display;
297 * einfo->info.visual = DefaultVisual(display, DefaultScreen(display));
298 * einfo->info.colormap = DefaultColormap(display, DefaultScreen(display));
299 * einfo->info.drawable = win;
300 * einfo->info.depth = DefaultDepth(display, DefaultScreen(display));
301 * evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
302 * @endcode
303 */
304void
305evas_engine_info_set(Evas *e, Evas_Engine_Info *info)
306{
307 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
308 return;
309 MAGIC_CHECK_END();
310 if (!info) return;
311 if (info != e->engine.info) return;
312 if (info->magic != e->engine.info_magic) return;
313 e->engine.func->setup(e, info);
314}
315
316/**
317 * Set the render engine's output size in output units.
318 * @param e The pointer to the Evas Canvas
319 * @param w The width in output units
320 * @param h The height in output units
321 *
322 * This function sets the output display size for the Evas Canvas indicated to
323 * be the size (for most engines in pixels). The Canvas will render to a
324 * rectangle of this size on the output target once this call is called. This
325 * is independant of the viewport (view into the canvas world) and will simply
326 * stretch the viewport to fill the rectangle indicated by this call.
327 *
328 * Example:
329 * @code
330 * extern Evas *evas;
331 *
332 * evas_output_size_set(evas, 640, 480);
333 * @endcode
334 */
335void
336evas_output_size_set(Evas *e, int w, int h)
337{
338 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
339 return;
340 MAGIC_CHECK_END();
341
342 if ((w == e->output.w) && (h == e->output.h)) return;
343 if (w < 1) w = 1;
344 if (h < 1) h = 1;
345 e->output.w = w;
346 e->output.h = h;
347 e->output.changed = 1;
348 e->output_validity++;
349 e->changed = 1;
350}
351
352/**
353 * Get the render engine's output size in output units.
354 * @param e The pointer to the Evas Canvas
355 * @param w The pointer to a width variable to be filled in
356 * @param h The pointer to a height variable to be filled in
357 *
358 * Calling this function writes the current canvas output size values into the
359 * variables pointed to by @p w and @p h. On success the variables have the
360 * output size values written to them in output units. If either @p w or @p h
361 * is NULL, it will not be written to. If @p e is invalid, the results are
362 * undefined.
363 *
364 * Example:
365 * @code
366 * extern Evas *evas;
367 * int width, height;
368 *
369 * evas_output_size_get(evas, &width, &height);
370 * @endcode
371 */
372void
373evas_output_size_get(Evas *e, int *w, int *h)
374{
375 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
376 if (w) *w = 0;
377 if (h) *h = 0;
378 return;
379 MAGIC_CHECK_END();
380
381 if (w) *w = e->output.w;
382 if (h) *h = e->output.h;
383}
384
385/**
386 * Set the render engine's output viewport in canvas units.
387 * @param e The pointer to the Evas Canvas
388 * @param x The top-left corner x value of the viewport
389 * @param y The top-left corner y value of the viewport
390 * @param w The width of the viewport
391 * @param h The height of the viewport
392 *
393 * This function sets the viewport (in canvas co-ordinate space) that will
394 * be visible in the canvas ouput. The width and height of the viewport must
395 * both be greater than 0. The rectangle described by the co-ordinates is the
396 * rectangular region of the canvas co-ordinate space that is visibly mapped
397 * and stretched to fill the output target of the canvas when rendering is
398 * performed.
399 *
400 * Co-ordinates do not have to map 1 to 1, but it is generally advised for
401 * ease of use that canvas co-ordinates to match output target units for
402 * better control, but this is not required.
403 *
404 * Example:
405 * @code
406 * extern Evas *evas;
407 *
408 * evas_output_viewport_set(evas, 0, 0, 640, 480);
409 * @endcode
410 */
411void
412evas_output_viewport_set(Evas *e, double x, double y, double w, double h)
413{
414 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
415 return;
416 MAGIC_CHECK_END();
417
418 if ((x == e->viewport.x) && (y == e->viewport.y) &&
419 (w == e->viewport.w) && (h == e->viewport.h)) return;
420 if (w <= 0) return;
421 if (h <= 0) return;
422 e->viewport.x = x;
423 e->viewport.y = y;
424 e->viewport.w = w;
425 e->viewport.h = h;
426 e->viewport.changed = 1;
427 e->output_validity++;
428 e->changed = 1;
429}
430
431/**
432 * Get the render engine's output viewport co-ordinates in canvas units.
433 * @param e The pointer to the Evas Canvas
434 * @param x The pointer to a x variable to be filled in
435 * @param y The pointer to a y variable to be filled in
436 * @param w The pointer to a width variable to be filled in
437 * @param h The pointer to a height variable to be filled in
438 *
439 * Calling this function writes the current canvas output viewport size and
440 * location values into the variables pointed to by @p x, @p y, @p w and @p h.
441 * On success the variables have the output location and size values written
442 * to them in canvas units. If either @p x, @p y, @p w or @p h are NULL, it
443 * they will not be written to. If @p e is invalid, the results are
444 * undefined.
445 *
446 * Example:
447 * @code
448 * extern Evas *evas;
449 * double x, y, width, height;
450 *
451 * evas_output_viewport_get(evas, &x, &y, &w, &h);
452 * @endcode
453 */
454void
455evas_output_viewport_get(Evas *e, double *x, double *y, double *w, double *h)
456{
457 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
458 if (x) *x = 0;
459 if (y) *y = 0;
460 if (w) *w = 0;
461 if (h) *h = 0;
462 return;
463 MAGIC_CHECK_END();
464
465 if (x) *x = e->viewport.x;
466 if (y) *y = e->viewport.y;
467 if (w) *w = e->viewport.w;
468 if (h) *h = e->viewport.h;
469}
470
471/**
472 * Convert/scale an ouput screen co-ordinate into canvas co-ordinates
473 *
474 * @param e The pointer to the Evas Canvas
475 * @param x The screen/output x co-ordinate
476 * @return The screen co-ordinate translated to canvas unit co-ordinates
477 *
478 * This function takes in a horizontal co-ordinate as the @p x parameter and
479 * converts it into canvas units, accounting for output size, viewport size
480 * and location, returning it as the function return value. If @p e is
481 * invalid, the results are undefined.
482 *
483 * Example:
484 * @code
485 * extern Evas *evas;
486 * extern int screen_x;
487 * double canvas_x;
488 *
489 * canvas_x = evas_coord_screen_x_to_world(evas, screen_x);
490 * @endcode
491 */
492double
493evas_coord_screen_x_to_world(Evas *e, int x)
494{
495 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
496 return 0;
497 MAGIC_CHECK_END();
498 return e->viewport.x + (((double)x * e->viewport.w) / (double)e->output.w);
499}
500
501/**
502 * Convert/scale an ouput screen co-ordinate into canvas co-ordinates
503 *
504 * @param e The pointer to the Evas Canvas
505 * @param y The screen/output y co-ordinate
506 * @return The screen co-ordinate translated to canvas unit co-ordinates
507 *
508 * This function takes in a vertical co-ordinate as the @p y parameter and
509 * converts it into canvas units, accounting for output size, viewport size
510 * and location, returning it as the function return value. If @p e is
511 * invalid, the results are undefined.
512 *
513 * Example:
514 * @code
515 * extern Evas *evas;
516 * extern int screen_y;
517 * double canvas_y;
518 *
519 * canvas_y = evas_coord_screen_y_to_world(evas, screen_y);
520 * @endcode
521 */
522double
523evas_coord_screen_y_to_world(Evas *e, int y)
524{
525 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
526 return 0;
527 MAGIC_CHECK_END();
528 return e->viewport.y + (((double)y * e->viewport.h) / (double)e->output.h);
529}
530
531/**
532 * Convert/scale a canvas co-ordinate into output screen co-ordinates
533 *
534 * @param e The pointer to the Evas Canvas
535 * @param x The canvas x co-ordinate
536 * @return The output/screen co-ordinate translated to output co-ordinates
537 *
538 * This function takes in a horizontal co-ordinate as the @p x parameter and
539 * converts it into output units, accounting for output size, viewport size
540 * and location, returning it as the function return value. If @p e is
541 * invalid, the results are undefined.
542 *
543 * Example:
544 * @code
545 * extern Evas *evas;
546 * int screen_x;
547 * extern double canvas_x;
548 *
549 * screen_x = evas_coord_world_x_to_screen(evas, canvas_x);
550 * @endcode
551 */
552int
553evas_coord_world_x_to_screen(Evas *e, double x)
554{
555 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
556 return 0;
557 MAGIC_CHECK_END();
558 return (int)(((x - e->viewport.x) * (double)e->output.w) / e->viewport.w);
559}
560
561/**
562 * Convert/scale a canvas co-ordinate into output screen co-ordinates
563 *
564 * @param e The pointer to the Evas Canvas
565 * @param y The canvas y co-ordinate
566 * @return The output/screen co-ordinate translated to output co-ordinates
567 *
568 * This function takes in a vertical co-ordinate as the @p x parameter and
569 * converts it into output units, accounting for output size, viewport size
570 * and location, returning it as the function return value. If @p e is
571 * invalid, the results are undefined.
572 *
573 * Example:
574 * @code
575 * extern Evas *evas;
576 * int screen_y;
577 * extern double canvas_y;
578 *
579 * screen_y = evas_coord_world_y_to_screen(evas, canvas_y);
580 * @endcode
581 */
582int
583evas_coord_world_y_to_screen(Evas *e, double y)
584{
585 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
586 return 0;
587 MAGIC_CHECK_END();
588 return (int)(((y - e->viewport.y) * (double)e->output.h) / e->viewport.h);
589}
590
591/**
592 * Look up a numeric ID from a string name of a rendering engine.
593 *
594 * @param name The string name of an engine
595 * @return A numeric (opaque) ID for the rendering engine
596 *
597 * This function looks up a numeric return value for the named engine in the
598 * string @p name. This is a normal C string, NUL byte terminated. The name
599 * is case sensitive. If the rendering engine is available, a numeric ID for
600 * that engine is returned that is no 0, if the engine is not available, 0
601 * is returned, indicating an invalid engine.
602 *
603 * The programmer should NEVER rely on the numeric ID an engine unless it is
604 * returned by this function. Programs should NOT be written accessing render
605 * method ID's directly, without first obtaining it from this function.
606 *
607 * Example:
608 * @code
609 * int engine_id;
610 * Evas *evas;
611 *
612 * evas = evas_new();
613 * if (!evas)
614 * {
615 * fprintf(stderr, "ERROR: Canvas creation failed. Fatal error.\n");
616 * exit(-1);
617 * }
618 * engine_id = evas_render_method_lookup("software_x11");
619 * if (!engine_id)
620 * {
621 * fprintf(stderr, "ERROR: Requested rendering engine is absent.\n");
622 * exit(-1);
623 * }
624 * evas_output_method_set(evas, engine_id);
625 * @endcode
626 */
627int
628evas_render_method_lookup(const char *name)
629{
630 if (!name) return RENDER_METHOD_INVALID;
631
632#ifdef BUILD_ENGINE_SOFTWARE_X11
633 if (!strcmp(name, "software_x11")) return RENDER_METHOD_SOFTWARE_X11;
634#endif
635#ifdef BUILD_ENGINE_GL_X11
636 if (!strcmp(name, "gl_x11")) return RENDER_METHOD_GL_X11;
637#endif
638#ifdef BUILD_ENGINE_DIRECTFB
639 if (!strcmp(name, "directfb")) return RENDER_METHOD_DIRECTFB;
640#endif
641#ifdef BUILD_ENGINE_FB
642 if (!strcmp(name, "fb")) return RENDER_METHOD_FB;
643#endif
644#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
645 if (!strcmp(name, "software_win32_gdi")) return RENDER_METHOD_SOFTWARE_WIN32_GDI;
646#endif
647#ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
648 if (!strcmp(name, "software_qtopia")) return RENDER_METHOD_SOFTWARE_QTOPIA;
649#endif
650 return RENDER_METHOD_INVALID;
651}
652
653/**
654 * List all the rendering engines compiled into the copy of the Evas library
655 *
656 * @return A linked lst whose data members are C strings of engine names
657 *
658 * Calling this will return the program a handle (pointer) to an Evas linked
659 * list. Each node in the linked lists will have the data pointer be a char *
660 * pointer to the string name of the rendering engine available. The strings
661 * should never be modified, neither should the list be modified. This list
662 * should be cleaned up as soon as the program no longer needs it using
663 * evas_render_method_list_free(). If no engines are available from Evas, NULL
664 * will be returned.
665 *
666 * Example:
667 * @code
668 * Evas_List *engine_list, *l;
669 *
670 * engine_list = evas_render_method_list();
671 * if (!engine_list)
672 * {
673 * fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
674 * exit(-1);
675 * }
676 * printf("Availible Evas Engines:\n");
677 * for (l = engine_list; l; l = l->next)
678 * {
679 * char *engine_name;
680 *
681 * engine_name = l->data;
682 * printf("%s\n", engine_name);
683 * }
684 * evas_render_method_list_free(engine_list);
685 * @endcode
686 */
687Evas_List *
688evas_render_method_list(void)
689{
690 Evas_List *methods = NULL;
691
692#ifdef BUILD_ENGINE_SOFTWARE_X11
693 methods = evas_list_append(methods, strdup("software_x11"));
694#endif
695#ifdef BUILD_ENGINE_GL_X11
696 methods = evas_list_append(methods, strdup("gl_x11"));
697#endif
698#ifdef BUILD_ENGINE_DIRECTFB
699 methods = evas_list_append(methods, strdup("directfb"));
700#endif
701#ifdef BUILD_ENGINE_FB
702 methods = evas_list_append(methods, strdup("fb"));
703#endif
704#ifdef BBUILD_ENGINE_SOFTWARE_WIN32_GDI
705 methods = evas_list_append(methods, strdup("software_win32_gdi"));
706#endif
707#ifdef BBUILD_ENGINE_SOFTWARE_QTOPIA
708 methods = evas_list_append(methods, strdup("software_qtopia"));
709#endif
710
711 return NULL;
712}
713
714/**
715 * This function should be called to free a list of engine names
716 *
717 * @param list The Evas_List base pointer for the engine list to be freed
718 *
719 * When this function is called it will free the engine list passed in as
720 * @p list. The list should only be a list of engines generated by calling
721 * evas_render_method_list(). If @p list is NULL, nothing will happen.
722 *
723 * Example:
724 * @code
725 * Evas_List *engine_list, *l;
726 *
727 * engine_list = evas_render_method_list();
728 * if (!engine_list)
729 * {
730 * fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
731 * exit(-1);
732 * }
733 * printf("Availible Evas Engines:\n");
734 * for (l = engine_list; l; l = l->next)
735 * {
736 * char *engine_name;
737 *
738 * engine_name = l->data;
739 * printf("%s\n", engine_name);
740 * }
741 * evas_render_method_list_free(engine_list);
742 * @endcode
743 */
744void
745evas_render_method_list_free(Evas_List *list)
746{
747 while (list)
748 {
749 free(list->data);
750 list = evas_list_remove(list, list->data);
751 }
752}
753
754/**
755 * This function returns the current known pointer co-ordinates
756 *
757 * @param e The pointer to the Evas Canvas
758 * @param x The pointer to an integer to be filled in
759 * @param y The pointer to an integer to be filled in
760 *
761 * This function returns the current known screen/output co-ordinates of the
762 * mouse pointer and sets the contents of the integers pointed to by @p x
763 * and @p y to contain these co-ordinates. If @p e is not a valid canvas the
764 * results of this function are undefined.
765 *
766 * Example:
767 * @code
768 * extern Evas *evas;
769 * int mouse_x, mouse_y;
770 *
771 * evas_pointer_output_xy_get(evas, &mouse_x, &mouse_y);
772 * printf("Mouse is at screen position %i, %i\n", mouse_x, mouse_y);
773 * @endcode
774 */
775void
776evas_pointer_output_xy_get(Evas *e, int *x, int *y)
777{
778 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
779 if (x) *x = 0;
780 if (y) *y = 0;
781 return;
782 MAGIC_CHECK_END();
783 if (x) *x = e->pointer.x;
784 if (y) *y = e->pointer.y;
785}
786
787/**
788 * This function returns the current known pointer co-ordinates
789 *
790 * @param e The pointer to the Evas Canvas
791 * @param x The pointer to a double to be filled in
792 * @param y The pointer to a double to be filled in
793 *
794 * This function returns the current known canvas unit co-ordinates of the
795 * mouse pointer and sets the contents of the doubles pointed to by @p x
796 * and @p y to contain these co-ordinates. If @p e is not a valid canvas the
797 * results of this function are undefined.
798 *
799 * Example:
800 * @code
801 * extern Evas *evas;
802 * double mouse_x, mouse_y;
803 *
804 * evas_pointer_output_xy_get(evas, &mouse_x, &mouse_y);
805 * printf("Mouse is at canvas position %f, %f\n", mouse_x, mouse_y);
806 * @endcode
807 */
808void
809evas_pointer_canvas_xy_get(Evas *e, double *x, double *y)
810{
811 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
812 if (x) *x = 0;
813 if (y) *y = 0;
814 return;
815 MAGIC_CHECK_END();
816 if (x) *x = e->pointer.x;
817 if (y) *y = e->pointer.y;
818}
819
820/**
821 * Returns a bitmask with the mouse buttons currently pressed, set to 1
822 *
823 * @param e The pointer to the Evas Canvas
824 * @return A bitmask of the currently depressed buttons on the cavas
825 *
826 * Calling this function will retunr a 32-bit integer with the appropriate bits
827 * set to 1 that correspond to a mouse button being depressed. This limits
828 * Evas to a mouse devices with a maximum of 32 buttons, but that is generally
829 * in excess of any host systems pointing device abilities.
830 *
831 * A canvas by default begins with no mouse buttons being pressed and only
832 * calls to evas_event_feed_mouse_down(), evas_event_feed_mouse_down_data(),
833 * evas_event_feed_mouse_up() and evas_event_feed_mouse_up_data() will alter
834 * that.
835 *
836 * The least significant bit corresponds to the first mouse button (button 1)
837 * and the most significant bit corresponds to the last mouse button
838 * (button 32).
839 *
840 * If @p e is not a valid canvas, the return value is undefined.
841 *
842 * Example:
843 * @code
844 * extern Evas *evas;
845 * int button_mask, i;
846 *
847 * button_mask = evas_pointer_button_down_mask_get(evas);
848 * printf("Buttons currently pressed:\n");
849 * for (i = 0; i < 32; i++)
850 * {
851 * if ((button_mask & (1 << i)) != 0) printf("Button %i\n", i + 1);
852 * }
853 * @endcode
854 */
855int
856evas_pointer_button_down_mask_get(Evas *e)
857{
858 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
859 return 0;
860 MAGIC_CHECK_END();
861 return (int)e->pointer.button;
862}
863
864/**
865 * Returns if the mouse pointer is logically inside the canvas
866 *
867 * @param e The pointer to the Evas Canvas
868 * @return An integer (0 or 1) corresponding to the outside/inside pointer
869 *
870 * When this function is called it will return a value of either 0 or 1,
871 * depending on if evas_event_feed_mouse_in(), evas_event_feed_mouse_in_data(),
872 * or evas_event_feed_mouse_out(), evas_event_feed_mouse_out_data() have been
873 * called to feed in a mouse enter event into the canvas.
874 *
875 * A return value of 1 indicates the mouse is logically inside the canvas, and
876 * 0 implies it is logically outside the canvas.
877 *
878 * A canvas begins with the mouse being assumed outside (0).
879 *
880 * If @p e is not a valid canvas, the return value is undefined.
881 *
882 * Example:
883 * @code
884 * extern Evas *evas;
885 *
886 * if (evas_pointer_inside_get(evas)) printf("Mouse is in!\n");
887 * else printf("Mouse is out\n");
888 * @endcode
889 */
890int
891evas_pointer_inside_get(Evas *e)
892{
893 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
894 return 0;
895 MAGIC_CHECK_END();
896 return (int)e->pointer.inside;
897}
diff --git a/legacy/evas/src/lib/canvas/evas_name.c b/legacy/evas/src/lib/canvas/evas_name.c
new file mode 100644
index 0000000000..e9cee3913b
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_name.c
@@ -0,0 +1,41 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5void
6evas_object_name_set(Evas_Object *obj, const char *name)
7{
8 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
9 return;
10 MAGIC_CHECK_END();
11 if (obj->name)
12 {
13 obj->layer->evas->name_hash = evas_hash_del(obj->layer->evas->name_hash, obj->name, obj);
14 free(obj->name);
15 }
16 if (!name) obj->name = NULL;
17 else
18 {
19 obj->name = strdup(name);
20 obj->layer->evas->name_hash = evas_hash_add(obj->layer->evas->name_hash, obj->name, obj);
21 }
22}
23
24char *
25evas_object_name_get(Evas_Object *obj)
26{
27 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
28 return NULL;
29 MAGIC_CHECK_END();
30 return obj->name;
31}
32
33Evas_Object *
34evas_object_name_find(Evas *e, const char *name)
35{
36 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
37 return NULL;
38 MAGIC_CHECK_END();
39 if (!name) return NULL;
40 return (Evas_Object *)evas_hash_find(e->name_hash, name);
41}
diff --git a/legacy/evas/src/lib/canvas/evas_object_gradient.c b/legacy/evas/src/lib/canvas/evas_object_gradient.c
new file mode 100644
index 0000000000..aa3aabb80d
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_object_gradient.c
@@ -0,0 +1,373 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5/* private magic number for gradient objects */
6static const char o_type[] = "gradient";
7
8/* private struct for gradient object internal data */
9typedef struct _Evas_Object_Gradient Evas_Object_Gradient;
10
11struct _Evas_Object_Gradient
12{
13 DATA32 magic;
14
15 struct {
16 double angle;
17 } cur, prev;
18 int changed : 1;
19 int gradient_changed : 1;
20 int gradient_opaque : 1;
21
22 void *engine_data;
23};
24
25/* private methods for gradient objects */
26static void evas_object_gradient_init(Evas_Object *obj);
27static void *evas_object_gradient_new(void);
28static void evas_object_gradient_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y);
29static void evas_object_gradient_free(Evas_Object *obj);
30static void evas_object_gradient_render_pre(Evas_Object *obj);
31static void evas_object_gradient_render_post(Evas_Object *obj);
32
33static int evas_object_gradient_is_opaque(Evas_Object *obj);
34static int evas_object_gradient_was_opaque(Evas_Object *obj);
35
36static Evas_Object_Func object_func =
37{
38 /* methods (compulsory) */
39 evas_object_gradient_free,
40 evas_object_gradient_render,
41 evas_object_gradient_render_pre,
42 evas_object_gradient_render_post,
43 /* these are optional. NULL = nothing */
44 NULL,
45 NULL,
46 NULL,
47 NULL,
48 evas_object_gradient_is_opaque,
49 evas_object_gradient_was_opaque,
50 NULL,
51 NULL,
52 NULL
53};
54
55/* the actual api call to add a rect */
56/* it has no other api calls as all properties are standard */
57Evas_Object *
58evas_object_gradient_add(Evas *e)
59{
60 Evas_Object *obj;
61
62 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
63 return NULL;
64 MAGIC_CHECK_END();
65 obj = evas_object_new();
66 evas_object_gradient_init(obj);
67 evas_object_inject(obj, e);
68 return obj;
69}
70
71void
72evas_object_gradient_color_add(Evas_Object *obj, int r, int g, int b, int a, int distance)
73{
74 Evas_Object_Gradient *o;
75
76 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
77 return;
78 MAGIC_CHECK_END();
79 o = (Evas_Object_Gradient *)(obj->object_data);
80 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
81 return;
82 MAGIC_CHECK_END();
83 o->engine_data = obj->layer->evas->engine.func->gradient_color_add(obj->layer->evas->engine.data.output,
84 obj->layer->evas->engine.data.context,
85 o->engine_data,
86 r, g, b, a,
87 distance);
88 o->gradient_changed = 1;
89 if (a != 255) o->gradient_opaque = 0;
90 evas_object_change(obj);
91}
92
93void
94evas_object_gradient_colors_clear(Evas_Object *obj)
95{
96 Evas_Object_Gradient *o;
97
98 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
99 return;
100 MAGIC_CHECK_END();
101 o = (Evas_Object_Gradient *)(obj->object_data);
102 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
103 return;
104 MAGIC_CHECK_END();
105 o->engine_data = obj->layer->evas->engine.func->gradient_colors_clear(obj->layer->evas->engine.data.output,
106 obj->layer->evas->engine.data.context,
107 o->engine_data);
108 o->gradient_changed = 1;
109 o->gradient_opaque = 1;
110 evas_object_change(obj);
111}
112
113void
114evas_object_gradient_angle_set(Evas_Object *obj, double angle)
115{
116 Evas_Object_Gradient *o;
117
118 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
119 return;
120 MAGIC_CHECK_END();
121 o = (Evas_Object_Gradient *)(obj->object_data);
122 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
123 return;
124 MAGIC_CHECK_END();
125 if (angle == o->cur.angle) return;
126 o->cur.angle = angle;
127 o->changed = 1;
128 evas_object_change(obj);
129}
130
131double
132evas_object_gradient_angle_get(Evas_Object *obj)
133{
134 Evas_Object_Gradient *o;
135
136 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
137 return 0.0;
138 MAGIC_CHECK_END();
139 o = (Evas_Object_Gradient *)(obj->object_data);
140 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
141 return 0.0;
142 MAGIC_CHECK_END();
143 return o->cur.angle;
144 evas_object_change(obj);
145}
146
147
148
149
150
151/* all nice and private */
152static void
153evas_object_gradient_init(Evas_Object *obj)
154{
155 /* alloc image ob, setup methods and default values */
156 obj->object_data = evas_object_gradient_new();
157 /* set up default settings for this kind of object */
158 obj->cur.color.r = 255;
159 obj->cur.color.g = 255;
160 obj->cur.color.b = 255;
161 obj->cur.color.a = 255;
162 obj->cur.geometry.x = 0.0;
163 obj->cur.geometry.y = 0.0;
164 obj->cur.geometry.w = 32.0;
165 obj->cur.geometry.h = 32.0;
166 obj->cur.layer = 0;
167 /* set up object-specific settings */
168 obj->prev = obj->cur;
169 /* set up methods (compulsory) */
170 obj->func = &object_func;
171 obj->type = o_type;
172}
173
174static void *
175evas_object_gradient_new(void)
176{
177 Evas_Object_Gradient *o;
178
179 /* alloc obj private data */
180 o = calloc(1, sizeof(Evas_Object_Gradient));
181 o->magic = MAGIC_OBJ_GRADIENT;
182 o->cur.angle = 0.0;
183 o->prev = o->cur;
184 o->gradient_opaque = 1;
185 return o;
186}
187
188static void
189evas_object_gradient_free(Evas_Object *obj)
190{
191 Evas_Object_Gradient *o;
192
193 /* frees private object data. very simple here */
194 o = (Evas_Object_Gradient *)(obj->object_data);
195 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
196 return;
197 MAGIC_CHECK_END();
198 /* free obj */
199 o->engine_data = obj->layer->evas->engine.func->gradient_colors_clear(obj->layer->evas->engine.data.output,
200 obj->layer->evas->engine.data.context,
201 o->engine_data);
202 o->magic = 0;
203 free(o);
204}
205
206static void
207evas_object_gradient_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y)
208{
209 Evas_Object_Gradient *o;
210
211 /* render object to surface with context, and offxet by x,y */
212 o = (Evas_Object_Gradient *)(obj->object_data);
213 obj->layer->evas->engine.func->context_color_set(output,
214 context,
215 255, 255, 255, 255);
216 if ((obj->cur.cache.clip.r == 255) &&
217 (obj->cur.cache.clip.g == 255) &&
218 (obj->cur.cache.clip.b == 255) &&
219 (obj->cur.cache.clip.a == 255))
220 obj->layer->evas->engine.func->context_multiplier_unset(output,
221 context);
222 else
223 obj->layer->evas->engine.func->context_multiplier_set(output,
224 context,
225 obj->cur.cache.clip.r,
226 obj->cur.cache.clip.g,
227 obj->cur.cache.clip.b,
228 obj->cur.cache.clip.a);
229 if (o->engine_data)
230 obj->layer->evas->engine.func->gradient_draw(output,
231 context,
232 surface,
233 o->engine_data,
234 obj->cur.cache.geometry.x + x,
235 obj->cur.cache.geometry.y + y,
236 obj->cur.cache.geometry.w,
237 obj->cur.cache.geometry.h,
238 o->cur.angle);
239}
240
241static void
242evas_object_gradient_render_pre(Evas_Object *obj)
243{
244 Evas_List *updates = NULL;
245 Evas_Object_Gradient *o;
246 int is_v, was_v;
247
248 /* dont pre-render the obj twice! */
249 if (obj->pre_render_done) return;
250 obj->pre_render_done = 1;
251 /* pre-render phase. this does anything an object needs to do just before */
252 /* rendering. this could mean loading the image data, retrieving it from */
253 /* elsewhere, decoding video etc. */
254 /* then when this is done the object needs to figure if it changed and */
255 /* if so what and where and add thr appropriate redraw rectangles */
256 o = (Evas_Object_Gradient *)(obj->object_data);
257 /* if someone is clipping this obj - go calculate the clipper */
258 if (obj->cur.clipper)
259 {
260 evas_object_clip_recalc(obj->cur.clipper);
261 obj->cur.clipper->func->render_pre(obj->cur.clipper);
262 }
263 /* now figure what changed and add draw rects */
264 /* if it just became visible or invisible */
265 is_v = evas_object_is_visible(obj);
266 was_v = evas_object_was_visible(obj);
267 if (is_v != was_v)
268 {
269 updates = evas_object_render_pre_visible_change(updates, obj, is_v, was_v);
270 goto done;
271 }
272 /* its not visible - we accounted for it appearing or not so just abort */
273 if (!is_v) goto done;
274 /* clipper changed this is in addition to anything else for obj */
275 updates = evas_object_render_pre_clipper_change(updates, obj);
276 /* if we restacked (layer or just within a layer) and dont clip anyone */
277 if (obj->restack)
278 {
279 updates = evas_object_render_pre_prev_cur_add(updates, obj);
280 goto done;
281 }
282 /* if it changed color */
283 if ((obj->cur.color.r != obj->prev.color.r) ||
284 (obj->cur.color.g != obj->prev.color.g) ||
285 (obj->cur.color.b != obj->prev.color.b) ||
286 (obj->cur.color.a != obj->prev.color.a))
287 {
288 updates = evas_object_render_pre_prev_cur_add(updates, obj);
289 goto done;
290 }
291 /* if it changed geometry - and obviously not visibility or color */
292 /* caluclate differences since we have a constant color fill */
293 /* we really only need to update the differences */
294 if ((obj->cur.geometry.x != obj->prev.geometry.x) ||
295 (obj->cur.geometry.y != obj->prev.geometry.y) ||
296 (obj->cur.geometry.w != obj->prev.geometry.w) ||
297 (obj->cur.geometry.h != obj->prev.geometry.h))
298 {
299 updates = evas_object_render_pre_prev_cur_add(updates, obj);
300 goto done;
301 }
302 /* angle changed */
303 if ((o->changed) && (o->cur.angle != o->prev.angle))
304 {
305 updates = evas_object_render_pre_prev_cur_add(updates, obj);
306 goto done;
307 }
308 /* angle changed */
309 if (o->gradient_changed)
310 {
311 updates = evas_object_render_pre_prev_cur_add(updates, obj);
312 goto done;
313 }
314 /* it obviously didn't change - add a NO obscure - this "unupdates" this */
315 /* area so if there were updates for it they get wiped. don't do it if we */
316 /* arent fully opaque and we are visible */
317 if (evas_object_is_visible(obj) &&
318 evas_object_is_opaque(obj))
319 obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output,
320 obj->cur.cache.clip.x,
321 obj->cur.cache.clip.y,
322 obj->cur.cache.clip.w,
323 obj->cur.cache.clip.h);
324 done:
325 evas_object_render_pre_effect_updates(updates, obj, is_v, was_v);
326}
327
328static void
329evas_object_gradient_render_post(Evas_Object *obj)
330{
331 Evas_Object_Gradient *o;
332
333 /* this moves the current data to the previous state parts of the object */
334 /* in whatever way is safest for the object. also if we don't need object */
335 /* data anymore we can free it if the object deems this is a good idea */
336 o = (Evas_Object_Gradient *)(obj->object_data);
337 /* remove those pesky changes */
338 while (obj->clip.changes)
339 {
340 Evas_Rectangle *r;
341
342 r = (Evas_Rectangle *)obj->clip.changes->data;
343 obj->clip.changes = evas_list_remove(obj->clip.changes, r);
344 free(r);
345 }
346 /* move cur to prev safely for object data */
347 obj->prev = obj->cur;
348 o->prev = o->cur;
349 o->changed = 0;
350 o->gradient_changed = 0;
351}
352
353static int
354evas_object_gradient_is_opaque(Evas_Object *obj)
355{
356 Evas_Object_Gradient *o;
357
358 /* this returns 1 if the internal object data implies that the object is */
359 /* currently fulyl opque over the entire gradient it occupies */
360 o = (Evas_Object_Gradient *)(obj->object_data);
361 return o->gradient_opaque;
362}
363
364static int
365evas_object_gradient_was_opaque(Evas_Object *obj)
366{
367 Evas_Object_Gradient *o;
368
369 /* this returns 1 if the internal object data implies that the object was */
370 /* currently fulyl opque over the entire gradient it occupies */
371 o = (Evas_Object_Gradient *)(obj->object_data);
372 return o->gradient_opaque;
373}
diff --git a/legacy/evas/src/lib/canvas/evas_object_image.c b/legacy/evas/src/lib/canvas/evas_object_image.c
new file mode 100644
index 0000000000..303a8c368b
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_object_image.c
@@ -0,0 +1,1234 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "Evas.h"
4
5/* private magic number for image objects */
6static const char o_type[] = "image";
7
8/* private struct for rectangle object internal data */
9typedef struct _Evas_Object_Image Evas_Object_Image;
10
11struct _Evas_Object_Image
12{
13 DATA32 magic;
14
15 struct {
16 struct {
17 double x, y, w, h;
18 } fill;
19
20 struct {
21 int w, h;
22 } image;
23
24 struct {
25 int l, r, t, b;
26 } border;
27
28 char *file;
29 char *key;
30
31 int smooth_scale : 1;
32 int has_alpha :1;
33 } cur, prev;
34
35 int changed : 1;
36
37 int load_error;
38 Evas_List *pixel_updates;
39
40 void *engine_data;
41};
42
43/* private methods for image objects */
44static void evas_object_image_unload(Evas_Object *obj);
45static void evas_object_image_load(Evas_Object *obj);
46static double evas_object_image_figure_x_fill(Evas_Object *obj, double start, double size, double *size_ret);
47static double evas_object_image_figure_y_fill(Evas_Object *obj, double start, double size, double *size_ret);
48
49static void evas_object_image_init(Evas_Object *obj);
50static void *evas_object_image_new(void);
51static void evas_object_image_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y);
52static void evas_object_image_free(Evas_Object *obj);
53static void evas_object_image_render_pre(Evas_Object *obj);
54static void evas_object_image_render_post(Evas_Object *obj);
55
56static int evas_object_image_is_opaque(Evas_Object *obj);
57static int evas_object_image_was_opaque(Evas_Object *obj);
58
59static Evas_Object_Func object_func =
60{
61 /* methods (compulsory) */
62 evas_object_image_free,
63 evas_object_image_render,
64 evas_object_image_render_pre,
65 evas_object_image_render_post,
66 /* these are optional. NULL = nothing */
67 NULL,
68 NULL,
69 NULL,
70 NULL,
71 evas_object_image_is_opaque,
72 evas_object_image_was_opaque,
73 NULL,
74 NULL,
75 NULL
76};
77
78
79Evas_Object *
80evas_object_image_add(Evas *e)
81{
82 Evas_Object *obj;
83
84 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
85 return NULL;
86 MAGIC_CHECK_END();
87 obj = evas_object_new();
88 evas_object_image_init(obj);
89 evas_object_inject(obj, e);
90 return obj;
91}
92
93void
94evas_object_image_file_set(Evas_Object *obj, char *file, char *key)
95{
96 Evas_Object_Image *o;
97
98 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
99 return;
100 MAGIC_CHECK_END();
101 o = (Evas_Object_Image *)(obj->object_data);
102 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
103 return;
104 MAGIC_CHECK_END();
105 if ((o->cur.file) && (file) && (!strcmp(o->cur.file, file)))
106 {
107 if ((o->cur.key) && (key) && (!strcmp(o->cur.key, key)))
108 return;
109 if ((!o->cur.key) && (!key))
110 return;
111 }
112 if (o->cur.file) free(o->cur.file);
113 if (o->cur.key) free(o->cur.key);
114 if (file) o->cur.file = strdup(file);
115 else o->cur.file = NULL;
116 if (key) o->cur.key = strdup(key);
117 else o->cur.key = NULL;
118 o->prev.file = NULL;
119 o->prev.key = NULL;
120 if (o->engine_data)
121 obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
122 o->engine_data);
123 o->load_error = EVAS_LOAD_ERROR_NONE;
124 o->cur.has_alpha = 1;
125 o->cur.image.w = 0;
126 o->cur.image.h = 0;
127 o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
128 o->cur.file,
129 o->cur.key,
130 &o->load_error);
131 if (o->engine_data)
132 {
133 obj->layer->evas->engine.func->image_size_get(obj->layer->evas->engine.data.output,
134 o->engine_data,
135 &(o->cur.image.w),
136 &(o->cur.image.h));
137 o->cur.has_alpha = obj->layer->evas->engine.func->image_alpha_get(obj->layer->evas->engine.data.output,
138 o->engine_data);
139 }
140 else
141 {
142 o->load_error = EVAS_LOAD_ERROR_GENERIC;
143 }
144 o->changed = 1;
145 evas_object_change(obj);
146}
147
148void
149evas_object_image_file_get(Evas_Object *obj, char **file, char **key)
150{
151 Evas_Object_Image *o;
152
153 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
154 if (file) *file = NULL;
155 if (key) *key = NULL;
156 return;
157 MAGIC_CHECK_END();
158 o = (Evas_Object_Image *)(obj->object_data);
159 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
160 if (file) *file = NULL;
161 if (key) *key = NULL;
162 return;
163 MAGIC_CHECK_END();
164 if (file) *file = o->cur.file;
165 if (key) *key = o->cur.key;
166}
167
168void
169evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b)
170{
171 Evas_Object_Image *o;
172
173 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
174 return;
175 MAGIC_CHECK_END();
176 o = (Evas_Object_Image *)(obj->object_data);
177 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
178 return;
179 MAGIC_CHECK_END();
180 if (l < 0) l = 0;
181 if (r < 0) r = 0;
182 if (t < 0) t = 0;
183 if (b < 0) b = 0;
184 if ((o->cur.border.l == l) &&
185 (o->cur.border.r == r) &&
186 (o->cur.border.t == t) &&
187 (o->cur.border.b == b)) return;
188 o->cur.border.l = l;
189 o->cur.border.r = r;
190 o->cur.border.t = t;
191 o->cur.border.b = b;
192 o->changed = 1;
193 evas_object_change(obj);
194}
195
196void
197evas_object_image_border_get(Evas_Object *obj, int *l, int *r, int *t, int *b)
198{
199 Evas_Object_Image *o;
200
201 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
202 if (l) *l = 0;
203 if (r) *r = 0;
204 if (t) *t = 0;
205 if (b) *b = 0;
206 return;
207 MAGIC_CHECK_END();
208 o = (Evas_Object_Image *)(obj->object_data);
209 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
210 if (l) *l = 0;
211 if (r) *r = 0;
212 if (t) *t = 0;
213 if (b) *b = 0;
214 return;
215 MAGIC_CHECK_END();
216 if (l) *l = o->cur.border.l;
217 if (r) *r = o->cur.border.r;
218 if (t) *t = o->cur.border.t;
219 if (b) *b = o->cur.border.b;
220}
221
222void
223evas_object_image_fill_set(Evas_Object *obj, double x, double y, double w, double h)
224{
225 Evas_Object_Image *o;
226
227 if (w < 0) w = -w;
228 if (h < 0) h = -h;
229 if (w == 0.0) return;
230 if (h == 0.0) return;
231 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
232 return;
233 MAGIC_CHECK_END();
234 o = (Evas_Object_Image *)(obj->object_data);
235 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
236 return;
237 MAGIC_CHECK_END();
238 if ((o->cur.fill.x == x) &&
239 (o->cur.fill.y == y) &&
240 (o->cur.fill.w == w) &&
241 (o->cur.fill.h == h)) return;
242 o->cur.fill.x = x;
243 o->cur.fill.y = y;
244 o->cur.fill.w = w;
245 o->cur.fill.h = h;
246 o->changed = 1;
247 evas_object_change(obj);
248}
249
250void
251evas_object_image_fill_get(Evas_Object *obj, double *x, double *y, double *w, double *h)
252{
253 Evas_Object_Image *o;
254
255 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
256 if (x) *x = 0;
257 if (y) *y = 0;
258 if (w) *w = 0;
259 if (h) *h = 0;
260 return;
261 MAGIC_CHECK_END();
262 o = (Evas_Object_Image *)(obj->object_data);
263 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
264 if (x) *x = 0;
265 if (y) *y = 0;
266 if (w) *w = 0;
267 if (h) *h = 0;
268 return;
269 MAGIC_CHECK_END();
270 if (x) *x = o->cur.fill.x;
271 if (y) *y = o->cur.fill.y;
272 if (w) *w = o->cur.fill.w;
273 if (h) *h = o->cur.fill.h;
274}
275
276void
277evas_object_image_size_set(Evas_Object *obj, int w, int h)
278{
279 Evas_Object_Image *o;
280
281 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
282 return;
283 MAGIC_CHECK_END();
284 o = (Evas_Object_Image *)(obj->object_data);
285 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
286 return;
287 MAGIC_CHECK_END();
288 if (w < 1) w = 1;
289 if (h < 1) h = 1;
290 if (w > 32768) return;
291 if (h > 32768) return;
292 if ((w == o->cur.image.w) &&
293 (h == o->cur.image.h)) return;
294 o->cur.image.w = w;
295 o->cur.image.h = h;
296 if (o->engine_data)
297 o->engine_data = obj->layer->evas->engine.func->image_size_set(obj->layer->evas->engine.data.output,
298 o->engine_data,
299 w, h);
300 else
301 o->engine_data = obj->layer->evas->engine.func->image_new_from_copied_data(obj->layer->evas->engine.data.output,
302 w, h, NULL);
303 if (o->engine_data)
304 o->engine_data = obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
305 o->engine_data,
306 o->cur.has_alpha);
307 if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
308 if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
309 if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
310 if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
311 o->changed = 1;
312 evas_object_change(obj);
313}
314
315void
316evas_object_image_size_get(Evas_Object *obj, int *w, int *h)
317{
318 Evas_Object_Image *o;
319
320 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
321 if (w) *w = 0;
322 if (h) *h = 0;
323 return;
324 MAGIC_CHECK_END();
325 o = (Evas_Object_Image *)(obj->object_data);
326 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
327 if (w) *w = 0;
328 if (h) *h = 0;
329 return;
330 MAGIC_CHECK_END();
331 if (w) *w = o->cur.image.w;
332 if (h) *h = o->cur.image.h;
333}
334
335int
336evas_object_image_load_error_get(Evas_Object *obj)
337{
338 Evas_Object_Image *o;
339
340 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
341 return 0;
342 MAGIC_CHECK_END();
343 o = (Evas_Object_Image *)(obj->object_data);
344 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
345 return 0;
346 MAGIC_CHECK_END();
347 return o->load_error;
348}
349
350void
351evas_object_image_data_set(Evas_Object *obj, int *data)
352{
353 Evas_Object_Image *o;
354 void *p_data;
355
356 if (!data) return;
357 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
358 return;
359 MAGIC_CHECK_END();
360 o = (Evas_Object_Image *)(obj->object_data);
361 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
362 return;
363 MAGIC_CHECK_END();
364 p_data = o->engine_data;
365 if (o->engine_data)
366 o->engine_data = obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
367 o->engine_data,
368 data);
369 if (o->engine_data)
370 o->engine_data = obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
371 o->engine_data,
372 o->cur.has_alpha);
373 if (p_data != o->engine_data)
374 {
375 if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
376 if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
377 if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
378 if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
379 }
380 o->changed = 1;
381 evas_object_change(obj);
382}
383
384int *
385evas_object_image_data_get(Evas_Object *obj, int for_writing)
386{
387 Evas_Object_Image *o;
388 DATA32 *data;
389
390 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
391 return NULL;
392 MAGIC_CHECK_END();
393 o = (Evas_Object_Image *)(obj->object_data);
394 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
395 return NULL;
396 MAGIC_CHECK_END();
397 if (!o->engine_data) return NULL;
398 data = NULL;
399 o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
400 o->engine_data,
401 for_writing,
402 &data);
403 if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
404 if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
405 if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
406 if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
407
408 return data;
409}
410
411void
412evas_object_image_data_copy_set(Evas_Object *obj, int *data)
413{
414 Evas_Object_Image *o;
415
416 if (!data) return;
417 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
418 return;
419 MAGIC_CHECK_END();
420 o = (Evas_Object_Image *)(obj->object_data);
421 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
422 return;
423 MAGIC_CHECK_END();
424 if ((o->cur.image.w <= 0) ||
425 (o->cur.image.h <= 0)) return;
426 if (o->engine_data)
427 obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
428 o->engine_data);
429 o->engine_data = obj->layer->evas->engine.func->image_new_from_copied_data(obj->layer->evas->engine.data.output,
430 o->cur.image.w,
431 o->cur.image.h,
432 data);
433 if (o->engine_data)
434 o->engine_data = obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
435 o->engine_data,
436 o->cur.has_alpha);
437 if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
438 if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
439 if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
440 if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
441}
442
443void
444evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h)
445{
446 Evas_Object_Image *o;
447 Evas_Rectangle *r;
448
449 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
450 return;
451 MAGIC_CHECK_END();
452 o = (Evas_Object_Image *)(obj->object_data);
453 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
454 return;
455 MAGIC_CHECK_END();
456 RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, o->cur.image.w, o->cur.image.h);
457 if ((w <= 0) || (h <= 0)) return;
458 NEW_RECT(r, x, y, w, h);
459 if (r) o->pixel_updates = evas_list_append(o->pixel_updates, r);
460 o->changed = 1;
461 evas_object_change(obj);
462}
463
464void
465evas_object_image_alpha_set(Evas_Object *obj, int has_alpha)
466{
467 Evas_Object_Image *o;
468
469 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
470 return;
471 MAGIC_CHECK_END();
472 o = (Evas_Object_Image *)(obj->object_data);
473 MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
474 return;