Revert "Rollback to previous package. evas_1.0.0.001+svn.62695slp2+build31"
[framework/uifw/evas.git] / src / lib / include / evas_private.h
1 #ifndef EVAS_PRIVATE_H
2 #define EVAS_PRIVATE_H
3
4 #ifdef HAVE_CONFIG_H
5 # include <config.h>
6 #endif
7
8 #include <Eina.h>
9 #include <eina_safety_checks.h>
10 #include "Evas.h"
11
12 #include "../file/evas_module.h"
13 #include "../file/evas_path.h"
14 #include "../engines/common/evas_text_utils.h"
15 #include "../engines/common/language/evas_bidi_utils.h"
16 #include "../engines/common/language/evas_language_utils.h"
17
18 #ifdef EVAS_MAGIC_DEBUG
19 /* complain when peole pass in wrong object types etc. */
20 # define MAGIC_DEBUG
21 #endif
22
23 #define RENDER_METHOD_INVALID            0x00000000
24
25 typedef struct _Evas_Layer                  Evas_Layer;
26 typedef struct _Evas_Size                   Evas_Size;
27 typedef struct _Evas_Aspect                 Evas_Aspect;
28 typedef struct _Evas_Border                 Evas_Border;
29 typedef struct _Evas_Double_Pair            Evas_Double_Pair;
30 typedef struct _Evas_Size_Hints             Evas_Size_Hints;
31 typedef struct _Evas_Font_Dir               Evas_Font_Dir;
32 typedef struct _Evas_Font                   Evas_Font;
33 typedef struct _Evas_Font_Alias             Evas_Font_Alias;
34 typedef struct _Evas_Font_Description       Evas_Font_Description;
35 typedef struct _Evas_Data_Node              Evas_Data_Node;
36 typedef struct _Evas_Func_Node              Evas_Func_Node;
37 typedef RGBA_Image_Loadopts                 Evas_Image_Load_Opts;
38 typedef struct _Evas_Func                   Evas_Func;
39 typedef struct _Evas_Image_Load_Func        Evas_Image_Load_Func;
40 typedef struct _Evas_Image_Save_Func        Evas_Image_Save_Func;
41 typedef struct _Evas_Object_Func            Evas_Object_Func;
42 typedef struct _Evas_Intercept_Func         Evas_Intercept_Func;
43 typedef struct _Evas_Key_Grab               Evas_Key_Grab;
44 typedef struct _Evas_Callbacks              Evas_Callbacks;
45 typedef struct _Evas_Format                 Evas_Format;
46 typedef struct _Evas_Map_Point              Evas_Map_Point;
47 typedef struct _Evas_Smart_Cb_Description_Array Evas_Smart_Cb_Description_Array;
48 typedef struct _Evas_Post_Callback          Evas_Post_Callback;
49
50 enum _Evas_Font_Style
51 {
52    EVAS_FONT_STYLE_SLANT,
53    EVAS_FONT_STYLE_WEIGHT,
54    EVAS_FONT_STYLE_WIDTH
55 };
56
57 enum _Evas_Font_Slant
58 {
59    EVAS_FONT_SLANT_NORMAL,
60    EVAS_FONT_SLANT_OBLIQUE,
61    EVAS_FONT_SLANT_ITALIC
62 };
63
64 enum _Evas_Font_Weight
65 {
66    EVAS_FONT_WEIGHT_NORMAL,
67    EVAS_FONT_WEIGHT_THIN,
68    EVAS_FONT_WEIGHT_ULTRALIGHT,
69    EVAS_FONT_WEIGHT_LIGHT,
70    EVAS_FONT_WEIGHT_BOOK,
71    EVAS_FONT_WEIGHT_MEDIUM,
72    EVAS_FONT_WEIGHT_SEMIBOLD,
73    EVAS_FONT_WEIGHT_BOLD,
74    EVAS_FONT_WEIGHT_ULTRABOLD,
75    EVAS_FONT_WEIGHT_BLACK,
76    EVAS_FONT_WEIGHT_EXTRABLACK
77 };
78
79 enum _Evas_Font_Width
80 {
81    EVAS_FONT_WIDTH_NORMAL,
82    EVAS_FONT_WIDTH_ULTRACONDENSED,
83    EVAS_FONT_WIDTH_EXTRACONDENSED,
84    EVAS_FONT_WIDTH_CONDENSED,
85    EVAS_FONT_WIDTH_SEMICONDENSED,
86    EVAS_FONT_WIDTH_SEMIEXPANDED,
87    EVAS_FONT_WIDTH_EXPANDED,
88    EVAS_FONT_WIDTH_EXTRAEXPANDED,
89    EVAS_FONT_WIDTH_ULTRAEXPANDED
90 };
91
92 typedef enum _Evas_Font_Style               Evas_Font_Style;
93 typedef enum _Evas_Font_Slant               Evas_Font_Slant;
94 typedef enum _Evas_Font_Weight              Evas_Font_Weight;
95 typedef enum _Evas_Font_Width               Evas_Font_Width;
96
97 /* General types - used for script type chceking */
98 #define OPAQUE_TYPE(type) struct __##type { int a; }; \
99    typedef struct __##type type
100
101 OPAQUE_TYPE(Evas_Font_Set); /* General type for RGBA_Font */
102 OPAQUE_TYPE(Evas_Font_Instance); /* General type for RGBA_Font_Int */
103 /* End of general types */
104
105 #define MAGIC_EVAS                 0x70777770
106 #define MAGIC_OBJ                  0x71777770
107 #define MAGIC_OBJ_RECTANGLE        0x71777771
108 #define MAGIC_OBJ_LINE             0x71777772
109 #define MAGIC_OBJ_POLYGON          0x71777774
110 #define MAGIC_OBJ_IMAGE            0x71777775
111 #define MAGIC_OBJ_TEXT             0x71777776
112 #define MAGIC_OBJ_SMART            0x71777777
113 #define MAGIC_OBJ_TEXTBLOCK        0x71777778
114 #define MAGIC_SMART                0x72777770
115 #define MAGIC_OBJ_SHAPE            0x72777773
116 #define MAGIC_OBJ_CONTAINER        0x72777774
117 #define MAGIC_OBJ_CUSTOM           0x72777775
118 #define MAGIC_EVAS_GL              0x72777776
119 #define MAGIC_MAP                  0x72777777
120
121 #ifdef MAGIC_DEBUG
122 # define MAGIC_CHECK_FAILED(o, t, m) \
123 {evas_debug_error(); \
124  if (!o) evas_debug_input_null(); \
125  else if (((t *)o)->magic == 0) evas_debug_magic_null(); \
126  else evas_debug_magic_wrong((m), ((t *)o)->magic); \
127 }
128 # define MAGIC_CHECK(o, t, m) \
129 {if ((!o) || (!(((t *)o)->magic == (m)))) { \
130 MAGIC_CHECK_FAILED(o, t, m)
131 # define MAGIC_CHECK_END() }}
132 #else
133 # define MAGIC_CHECK_FAILED(o, t, m)
134 # define MAGIC_CHECK(o, t, m)  { if (!o) {
135 # define MAGIC_CHECK_END() }}
136 #endif
137
138 #define NEW_RECT(_r, _x, _y, _w, _h) (_r) = eina_rectangle_new(_x, _y, _w, _h);
139
140 #define MERR_NONE() _evas_alloc_error = EVAS_ALLOC_ERROR_NONE
141 #define MERR_FATAL() _evas_alloc_error = EVAS_ALLOC_ERROR_FATAL
142 #define MERR_BAD() _evas_alloc_error = EVAS_ALLOC_ERROR_RECOVERED
143
144 #define EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o)                              \
145    if ((o)->cur.file)                                                       \
146      {                                                                      \
147         eina_stringshare_del((o)->cur.file);                                \
148         if ((o)->prev.file == (o)->cur.file)                                \
149           (o)->prev.file = NULL;                                            \
150         (o)->cur.file = NULL;                                               \
151      }                                                                      \
152    if ((o)->cur.key)                                                        \
153      {                                                                      \
154         eina_stringshare_del((o)->cur.key);                                 \
155         if ((o)->prev.key == (o)->cur.key)                                  \
156           (o)->prev.key = NULL;                                             \
157         (o)->cur.key = NULL;                                                \
158      }                                                                      \
159    if ((o)->prev.file)                                                      \
160      {                                                                      \
161         eina_stringshare_del((o)->prev.file);                               \
162         (o)->prev.file = NULL;                                              \
163      }                                                                      \
164    if ((o)->prev.key)                                                       \
165      {                                                                      \
166         eina_stringshare_del((o)->prev.key);                                \
167         (o)->prev.key = NULL;                                               \
168      }
169
170 struct _Evas_Key_Grab
171 {
172    char               *keyname;
173    Evas_Modifier_Mask  modifiers;
174    Evas_Modifier_Mask  not_modifiers;
175    Evas_Object        *object;
176    unsigned char       exclusive : 1;
177    unsigned char       just_added : 1;
178    unsigned char       delete_me : 1;
179 };
180
181 struct _Evas_Intercept_Func
182 {
183    struct {
184       Evas_Object_Intercept_Show_Cb func;
185       void *data;
186    } show;
187    struct {
188       Evas_Object_Intercept_Hide_Cb func;
189       void *data;
190    } hide;
191    struct {
192       Evas_Object_Intercept_Move_Cb func;
193       void *data;
194    } move;
195    struct {
196       Evas_Object_Intercept_Resize_Cb func;
197       void *data;
198    } resize;
199    struct {
200       Evas_Object_Intercept_Raise_Cb func;
201       void *data;
202    } raise;
203    struct {
204       Evas_Object_Intercept_Lower_Cb func;
205       void *data;
206    } lower;
207    struct {
208       Evas_Object_Intercept_Stack_Above_Cb func;
209       void *data;
210    } stack_above;
211    struct {
212       Evas_Object_Intercept_Stack_Below_Cb func;
213       void *data;
214    } stack_below;
215    struct {
216       Evas_Object_Intercept_Layer_Set_Cb func;
217       void *data;
218    } layer_set;
219    struct {
220       Evas_Object_Intercept_Color_Set_Cb func;
221       void *data;
222    } color_set;
223    struct {
224       Evas_Object_Intercept_Clip_Set_Cb func;
225       void *data;
226    } clip_set;
227    struct {
228       Evas_Object_Intercept_Clip_Unset_Cb func;
229       void *data;
230    } clip_unset;
231 };
232
233 struct _Evas_Smart_Cb_Description_Array
234 {
235    unsigned int                      size;
236    const Evas_Smart_Cb_Description **array;
237 };
238
239 struct _Evas_Smart
240 {
241    DATA32            magic;
242
243    int               usage;
244
245    const Evas_Smart_Class *smart_class;
246
247    Evas_Smart_Cb_Description_Array callbacks;
248
249    unsigned char     delete_me : 1;
250    unsigned char     class_allocated : 1;
251
252 };
253
254 struct _Evas_Modifier
255 {
256    struct {
257       int       count;
258       char    **list;
259    } mod;
260    Evas_Modifier_Mask mask; /* ok we have a max of 64 modifiers */
261 };
262
263 struct _Evas_Lock
264 {
265    struct {
266       int       count;
267       char    **list;
268    } lock;
269    Evas_Modifier_Mask mask; /* we have a max of 64 locks */
270 };
271
272 struct _Evas_Post_Callback
273 {
274    Evas_Object               *obj;
275    Evas_Object_Event_Post_Cb  func;
276    const void                *data;
277    unsigned char              delete_me : 1;
278 };
279
280 struct _Evas_Callbacks
281 {
282    Eina_Inlist *callbacks;
283    int               walking_list;
284    unsigned char     deletions_waiting : 1;
285 };
286
287 struct _Evas
288 {
289    EINA_INLIST;
290
291    DATA32            magic;
292
293    struct {
294       unsigned char  inside : 1;
295       int            mouse_grabbed;
296       DATA32         button;
297       Evas_Coord     x, y;
298       struct {
299           Eina_List *in;
300       } object;
301
302    } pointer;
303
304    struct  {
305       Evas_Coord     x, y, w, h;
306       unsigned char  changed : 1;
307    } viewport;
308
309    struct {
310       int            w, h;
311       DATA32         render_method;
312       unsigned char  changed : 1;
313    } output;
314
315    Eina_List        *damages;
316    Eina_List        *obscures;
317
318    Evas_Layer       *layers;
319
320    Eina_Hash        *name_hash;
321
322    int               output_validity;
323
324    int               walking_list;
325    int               events_frozen;
326
327    struct {
328       Evas_Module *module;
329       Evas_Func *func;
330       struct {
331          void *output;
332
333          void *context;
334       } data;
335
336       void *info;
337       int   info_magic;
338    } engine;
339
340    Eina_Array     delete_objects;
341    Eina_Array     active_objects;
342    Eina_Array     restack_objects;
343    Eina_Array     render_objects;
344    Eina_Array     pending_objects;
345    Eina_Array     obscuring_objects;
346    Eina_Array     temporary_objects;
347    Eina_Array     calculate_objects;
348    Eina_Array     clip_changes;
349
350    Eina_List     *calc_list;
351    Eina_List     *calc_list_current;
352    Eina_List     *video_objects;
353
354    Eina_List     *post_events; // free me on evas_free
355
356    Evas_Callbacks *callbacks;
357
358    int            delete_grabs;
359    int            walking_grabs;
360    Eina_List     *grabs;
361
362    Eina_List     *font_path;
363
364    int            in_smart_calc;
365    int            smart_calc_count;
366
367    Evas_Object   *focused;
368    void          *attach_data;
369    Evas_Modifier  modifiers;
370    Evas_Lock      locks;
371    unsigned int   last_timestamp;
372    int            last_mouse_down_counter;
373    int            last_mouse_up_counter;
374    int            nochange;
375    Evas_Font_Hinting_Flags hinting;
376    unsigned char  changed : 1;
377    unsigned char  delete_me : 1;
378    unsigned char  invalidate : 1;
379    unsigned char  cleanup : 1;
380    unsigned char  focus : 1;
381
382    Eina_List     *touch_points;
383 };
384
385 struct _Evas_Layer
386 {
387    EINA_INLIST;
388
389    short             layer;
390    Evas_Object      *objects;
391
392    Evas             *evas;
393
394    void             *engine_data;
395    int               usage;
396    unsigned char     delete_me : 1;
397 };
398
399 struct _Evas_Size
400 {
401    Evas_Coord w, h;
402 };
403
404 struct _Evas_Aspect
405 {
406    Evas_Aspect_Control mode;
407    Evas_Size size;
408 };
409
410 struct _Evas_Border
411 {
412    Evas_Coord l, r, t, b;
413 };
414
415 struct _Evas_Double_Pair
416 {
417    double x, y;
418 };
419
420 struct _Evas_Size_Hints
421 {
422    Evas_Size min, max, request;
423    Evas_Aspect aspect;
424    Evas_Double_Pair align, weight;
425    Evas_Border padding;
426 };
427
428 struct _Evas_Map_Point
429 {
430    double x, y, z, px, py;
431    double u, v;
432    unsigned char r, g, b, a;
433 };
434
435 struct _Evas_Map
436 {
437    DATA32                magic;
438    int                   count; // num of points
439    Evas_Coord_Rectangle  normal_geometry; // bounding box of map geom actually
440    void                 *surface; // surface holding map if needed
441    int                   surface_w, surface_h; // current surface w & h alloc
442    Evas_Coord            mx, my; // mouse x, y after conversion to map space
443    struct {
444       Evas_Coord         px, py, z0, foc;
445    } persp;
446    Eina_Bool             alpha : 1;
447    Eina_Bool             smooth : 1;
448    Evas_Map_Point        points[]; // actual points
449 };
450
451 #if 0 // filtering disabled
452 /* nash: Split into two bits */
453 typedef struct Evas_Filter_Info
454 {
455    Evas_Filter filter;
456    Evas_Filter_Mode mode;
457
458    Eina_Bool dirty : 1;
459
460    int datalen;
461    void *data;
462    void (*data_free)(void *);
463
464    uint8_t *key;
465    uint32_t len;
466    Filtered_Image *cached;
467 } Evas_Filter_Info;
468
469 typedef Eina_Bool (*Evas_Software_Filter_Fn)(Evas_Filter_Info *, RGBA_Image *, RGBA_Image *);
470
471 int evas_filter_get_size(Evas_Filter_Info *info, int inw, int inh,
472                      int *outw, int *outh, Eina_Bool inv);
473 Eina_Bool evas_filter_always_alpha(Evas_Filter_Info *info);
474 uint8_t *evas_filter_key_get(const Evas_Filter_Info *info, uint32_t *lenp);
475 // expose for use in engines
476 EAPI Evas_Software_Filter_Fn evas_filter_software_get(Evas_Filter_Info *info);
477 void evas_filter_free(Evas_Object *o);
478 #endif
479
480 struct _Evas_Object
481 {
482    EINA_INLIST;
483
484    DATA32                   magic;
485
486    const char              *type;
487    Evas_Layer              *layer;
488
489    struct {
490       Evas_Map             *map;
491       Evas_Object          *clipper;
492       Evas_Object          *mask;
493       Evas_Object          *map_parent;
494       double                scale;
495       Evas_Coord_Rectangle  geometry;
496       struct {
497          struct {
498             Evas_Coord      x, y, w, h;
499             unsigned char   r, g, b, a;
500             Eina_Bool       visible : 1;
501             Eina_Bool       dirty : 1;
502          } clip;
503       } cache;
504       short                 layer;
505       struct {
506          unsigned char      r, g, b, a;
507       } color;
508       Eina_Bool             usemap : 1;
509       Eina_Bool             visible : 1;
510       Eina_Bool             have_clipees : 1;
511       Eina_Bool             anti_alias : 1;
512       Evas_Render_Op        render_op : 4;
513    } cur, prev;
514
515    char                       *name;
516
517    Evas_Intercept_Func        *interceptors;
518
519    struct {
520       Eina_List               *elements;
521    } data;
522
523    Eina_List                  *grabs;
524
525    Evas_Callbacks             *callbacks;
526
527    struct {
528       Eina_List               *clipees;
529       Eina_List               *changes;
530    } clip;
531
532    const Evas_Object_Func     *func;
533
534    void                       *object_data;
535
536    struct {
537       Evas_Smart              *smart;
538       Evas_Object             *parent;
539    } smart;
540
541    struct {
542       Eina_List               *proxies;
543       void                    *surface;
544       int                      w,h;
545       Eina_Bool                redraw;
546    } proxy;
547
548 #if 0 // filtering disabled
549    Evas_Filter_Info           *filter;
550 #endif
551
552    Evas_Size_Hints            *size_hints;
553
554    int                         last_mouse_down_counter;
555    int                         last_mouse_up_counter;
556    int                         mouse_grabbed;
557
558    int                         last_event;
559    Evas_Callback_Type          last_event_type;
560
561    struct {
562         int                      in_move, in_resize;
563    } doing;
564
565    unsigned int                ref;
566
567    unsigned char               delete_me;
568
569    unsigned char               recalculate_cycle;
570
571    Evas_Object_Pointer_Mode    pointer_mode : 1;
572
573    Eina_Bool                   store : 1;
574    Eina_Bool                   pass_events : 1;
575    Eina_Bool                   parent_pass_events : 1;
576    Eina_Bool                   parent_cache_valid : 1;
577    Eina_Bool                   repeat_events : 1;
578    Eina_Bool                   restack : 1;
579    Eina_Bool                   is_active : 1;
580    Eina_Bool                   precise_is_inside : 1;
581    Eina_Bool                   is_static_clip : 1;
582
583    Eina_Bool                   render_pre : 1;
584    Eina_Bool                   rect_del : 1;
585    Eina_Bool                   mouse_in : 1;
586    Eina_Bool                   pre_render_done : 1;
587    Eina_Bool                   intercepted : 1;
588    Eina_Bool                   focused : 1;
589    Eina_Bool                   in_layer : 1;
590    Eina_Bool                   no_propagate : 1;
591
592    Eina_Bool                   changed : 1;
593    Eina_Bool                   changed_move : 1;
594    Eina_Bool                   changed_move_only : 1;
595    Eina_Bool                   changed_nomove : 1;
596    Eina_Bool                   del_ref : 1;
597 };
598
599 struct _Evas_Func_Node
600 {
601    EINA_INLIST;
602    void (*func) ();
603    void *data;
604    Evas_Callback_Type type;
605    Evas_Callback_Priority priority;
606    unsigned char delete_me : 1;
607 };
608
609 struct _Evas_Data_Node
610 {
611    char *key;
612    void *data;
613 };
614
615 struct _Evas_Font_Dir
616 {
617    Eina_Hash *lookup;
618    Eina_List *fonts;
619    Eina_List *aliases;
620    DATA64     dir_mod_time;
621    DATA64     fonts_dir_mod_time;
622    DATA64     fonts_alias_mod_time;
623 };
624
625 struct _Evas_Font
626 {
627    struct {
628       const char *prop[14];
629    } x;
630    struct {
631       const char *name;
632    } simple;
633    const char *path;
634    char     type;
635 };
636
637 struct _Evas_Font_Alias
638 {
639    const char *alias;
640    Evas_Font  *fn;
641 };
642
643 struct _Evas_Font_Description
644 {
645    int ref;
646    /* We assume everywhere this is stringshared */
647    const char *name;
648    const char *fallbacks;
649    const char *lang;
650
651    Evas_Font_Slant slant;
652    Evas_Font_Weight weight;
653    Evas_Font_Width width;
654
655    Eina_Bool is_new : 1;
656 };
657
658 struct _Evas_Object_Func
659 {
660    void (*free) (Evas_Object *obj);
661    void (*render) (Evas_Object *obj, void *output, void *context, void *surface, int x, int y);
662    void (*render_pre) (Evas_Object *obj);
663    void (*render_post) (Evas_Object *obj);
664
665    unsigned int  (*type_id_get) (Evas_Object *obj);
666    unsigned int  (*visual_id_get) (Evas_Object *obj);
667    void *(*engine_data_get) (Evas_Object *obj);
668
669    void (*store) (Evas_Object *obj);
670    void (*unstore) (Evas_Object *obj);
671
672    int  (*is_visible) (Evas_Object *obj);
673    int  (*was_visible) (Evas_Object *obj);
674
675    int  (*is_opaque) (Evas_Object *obj);
676    int  (*was_opaque) (Evas_Object *obj);
677
678    int  (*is_inside) (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
679    int  (*was_inside) (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
680
681    void (*coords_recalc) (Evas_Object *obj);
682
683    void (*scale_update) (Evas_Object *obj);
684
685    int (*has_opaque_rect) (Evas_Object *obj);
686    int (*get_opaque_rect) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
687
688    int (*can_map) (Evas_Object *obj);
689 };
690
691 struct _Evas_Func
692 {
693    void *(*info)                           (Evas *e);
694    void (*info_free)                       (Evas *e, void *info);
695    int  (*setup)                           (Evas *e, void *info);
696
697    void (*output_free)                     (void *data);
698    void (*output_resize)                   (void *data, int w, int h);
699    void (*output_tile_size_set)            (void *data, int w, int h);
700    void (*output_redraws_rect_add)         (void *data, int x, int y, int w, int h);
701    void (*output_redraws_rect_del)         (void *data, int x, int y, int w, int h);
702    void (*output_redraws_clear)            (void *data);
703    void *(*output_redraws_next_update_get) (void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch);
704    void (*output_redraws_next_update_push) (void *data, void *surface, int x, int y, int w, int h);
705    void (*output_flush)                    (void *data);
706    void (*output_idle_flush)               (void *data);
707    void (*output_dump)                     (void *data);
708
709    void *(*context_new)                    (void *data);
710    Eina_Bool (*canvas_alpha_get)           (void *data, void *context);
711    void (*context_free)                    (void *data, void *context);
712    void (*context_clip_set)                (void *data, void *context, int x, int y, int w, int h);
713    void (*context_clip_clip)               (void *data, void *context, int x, int y, int w, int h);
714    void (*context_clip_unset)              (void *data, void *context);
715    int  (*context_clip_get)                (void *data, void *context, int *x, int *y, int *w, int *h);
716    void (*context_mask_set)                (void *data, void *context, void *mask, int x, int y, int w, int h);
717    void (*context_mask_unset)              (void *data, void *context);
718    void (*context_color_set)               (void *data, void *context, int r, int g, int b, int a);
719    int  (*context_color_get)               (void *data, void *context, int *r, int *g, int *b, int *a);
720    void (*context_multiplier_set)          (void *data, void *context, int r, int g, int b, int a);
721    void (*context_multiplier_unset)        (void *data, void *context);
722    int  (*context_multiplier_get)          (void *data, void *context, int *r, int *g, int *b, int *a);
723    void (*context_cutout_add)              (void *data, void *context, int x, int y, int w, int h);
724    void (*context_cutout_clear)            (void *data, void *context);
725    void (*context_anti_alias_set)          (void *data, void *context, unsigned char aa);
726    unsigned char (*context_anti_alias_get) (void *data, void *context);
727    void (*context_color_interpolation_set) (void *data, void *context, int color_space);
728    int  (*context_color_interpolation_get) (void *data, void *context);
729    void (*context_render_op_set)           (void *data, void *context, int render_op);
730    int  (*context_render_op_get)           (void *data, void *context);
731
732    void (*rectangle_draw)                  (void *data, void *context, void *surface, int x, int y, int w, int h);
733
734    void (*line_draw)                       (void *data, void *context, void *surface, int x1, int y1, int x2, int y2);
735
736    void *(*polygon_point_add)              (void *data, void *context, void *polygon, int x, int y);
737    void *(*polygon_points_clear)           (void *data, void *context, void *polygon);
738    void (*polygon_draw)                    (void *data, void *context, void *surface, void *polygon, int x, int y);
739
740    void *(*image_load)                     (void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo);
741    void *(*image_new_from_data)            (void *data, int w, int h, DATA32 *image_data, int alpha, int cspace);
742    void *(*image_new_from_copied_data)     (void *data, int w, int h, DATA32 *image_data, int alpha, int cspace);
743    void (*image_free)                      (void *data, void *image);
744    void (*image_size_get)                  (void *data, void *image, int *w, int *h);
745    void *(*image_size_set)                 (void *data, void *image, int w, int h);
746    void (*image_stride_get)                (void *data, void *image, int *stride);
747    void *(*image_dirty_region)             (void *data, void *image, int x, int y, int w, int h);
748    void *(*image_data_get)                 (void *data, void *image, int to_write, DATA32 **image_data, int *err);
749    void *(*image_data_put)                 (void *data, void *image, DATA32 *image_data);
750    void  (*image_data_preload_request)     (void *data, void *image, const void *target);
751    void  (*image_data_preload_cancel)      (void *data, void *image, const void *target);
752    void *(*image_alpha_set)                (void *data, void *image, int has_alpha);
753    int  (*image_alpha_get)                 (void *data, void *image);
754    void *(*image_border_set)               (void *data, void *image, int l, int r, int t, int b);
755    void  (*image_border_get)               (void *data, void *image, int *l, int *r, int *t, int *b);
756    void (*image_draw)                      (void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth);
757    char *(*image_comment_get)              (void *data, void *image, char *key);
758    char *(*image_format_get)               (void *data, void *image);
759    void (*image_colorspace_set)            (void *data, void *image, int cspace);
760    int  (*image_colorspace_get)            (void *data, void *image);
761    void (*image_mask_create)               (void *data, void *image);
762    void *(*image_native_set)               (void *data, void *image, void *native);
763    void *(*image_native_get)               (void *data, void *image);
764
765    void (*image_cache_flush)               (void *data);
766    void (*image_cache_set)                 (void *data, int bytes);
767    int  (*image_cache_get)                 (void *data);
768
769    Evas_Font_Set *(*font_load)             (void *data, const char *name, int size, Font_Rend_Flags wanted_rend);
770    Evas_Font_Set *(*font_memory_load)      (void *data, char *name, int size, const void *fdata, int fdata_size, Font_Rend_Flags wanted_rend);
771    Evas_Font_Set *(*font_add)              (void *data, Evas_Font_Set *font, const char *name, int size, Font_Rend_Flags wanted_rend);
772    Evas_Font_Set *(*font_memory_add)       (void *data, Evas_Font_Set *font, char *name, int size, const void *fdata, int fdata_size, Font_Rend_Flags wanted_rend);
773    void (*font_free)                       (void *data, Evas_Font_Set *font);
774    int  (*font_ascent_get)                 (void *data, Evas_Font_Set *font);
775    int  (*font_descent_get)                (void *data, Evas_Font_Set *font);
776    int  (*font_max_ascent_get)             (void *data, Evas_Font_Set *font);
777    int  (*font_max_descent_get)            (void *data, Evas_Font_Set *font);
778    void (*font_string_size_get)            (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int *w, int *h);
779    int  (*font_inset_get)                  (void *data, Evas_Font_Set *font, const Evas_Text_Props *text_props);
780    int  (*font_h_advance_get)              (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props);
781    int  (*font_v_advance_get)              (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props);
782    int  (*font_char_coords_get)            (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch);
783    int  (*font_char_at_coords_get)         (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int x, int y, int *cx, int *cy, int *cw, int *ch);
784    void (*font_draw)                       (void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w, int h, int ow, int oh, const Evas_Text_Props *intl_props);
785
786    void (*font_cache_flush)                (void *data);
787    void (*font_cache_set)                  (void *data, int bytes);
788    int  (*font_cache_get)                  (void *data);
789
790    /* Engine functions will over time expand from here */
791
792    void (*font_hinting_set)                (void *data, Evas_Font_Set *font, int hinting);
793    int  (*font_hinting_can_hint)           (void *data, int hinting);
794
795 /*    void (*image_rotation_set)              (void *data, void *image); */
796
797    void (*image_scale_hint_set)            (void *data, void *image, int hint);
798    int  (*image_scale_hint_get)            (void *data, void *image);
799    int  (*font_last_up_to_pos)             (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int x, int y);
800
801    void (*image_map_draw)                  (void *data, void *context, void *surface, void *image, int npoints, RGBA_Map_Point *p, int smooth, int level);
802    void *(*image_map_surface_new)          (void *data, int w, int h, int alpha);
803    void (*image_map_surface_free)          (void *data, void *surface);
804
805    void (*image_content_hint_set)          (void *data, void *surface, int hint);
806    int  (*image_content_hint_get)          (void *data, void *surface);
807    int  (*font_pen_coords_get)             (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch);
808    Eina_Bool (*font_text_props_info_create) (void *data __UNUSED__, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *intl_props, const Evas_BiDi_Paragraph_Props *par_props, size_t pos, size_t len);
809    int  (*font_right_inset_get)            (void *data, Evas_Font_Set *font, const Evas_Text_Props *text_props);
810
811 #if 0 // filtering disabled
812    void (*image_draw_filtered)             (void *data, void *context, void *surface, void *image, Evas_Filter_Info *filter);
813    Filtered_Image *(*image_filtered_get)   (void *image, uint8_t *key, size_t len);
814    Filtered_Image *(*image_filtered_save)  (void *image, void *filtered, uint8_t *key, size_t len);
815    void (*image_filtered_free)             (void *image, Filtered_Image *);
816 #endif
817
818    /* EFL-GL Glue Layer */
819    void *(*gl_surface_create)            (void *data, void *config, int w, int h);
820    int  (*gl_surface_destroy)            (void *data, void *surface);
821    void *(*gl_context_create)            (void *data, void *share_context);
822    int  (*gl_context_destroy)            (void *data, void *context);
823    int  (*gl_make_current)               (void *data, void *surface, void *context);
824    void *(*gl_proc_address_get)          (void *data, const char *name);
825    int  (*gl_native_surface_get)         (void *data, void *surface, void *native_surface);
826    void *(*gl_api_get)                   (void *data);
827    int  (*image_load_error_get)          (void *data, void *image);
828    int  (*font_run_end_get)              (void *data, Evas_Font_Set *font, Evas_Font_Instance **script_fi, Evas_Font_Instance **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len);
829
830    /* animated feature */
831    Eina_Bool (*image_animated_get)       (void *data, void *image);
832    int (*image_animated_frame_count_get) (void *data, void *image);
833    Evas_Image_Animated_Loop_Hint  (*image_animated_loop_type_get) (void *data, void *image);
834    int (*image_animated_loop_count_get)  (void *data, void *image);
835    double (*image_animated_frame_duration_get) (void *data, void *image, int start_frame, int frame_num);
836    Eina_Bool (*image_animated_frame_set) (void *data, void *image, int frame_index);
837 };
838
839 struct _Evas_Image_Load_Func
840 {
841   Eina_Bool threadable;
842   Eina_Bool (*file_head) (Image_Entry *ie, const char *file, const char *key, int *error);
843   Eina_Bool (*file_data) (Image_Entry *ie, const char *file, const char *key, int *error);
844   double    (*frame_duration) (Image_Entry *ie, const char *file, const int start, const int frame_num);
845 };
846
847 struct _Evas_Image_Save_Func
848 {
849   int (*image_save) (RGBA_Image *im, const char *file, const char *key, int quality, int compress);
850 };
851
852 #ifdef __cplusplus
853 extern "C" {
854 #endif
855
856 Evas_Object *evas_object_new(Evas *e);
857 void evas_object_free(Evas_Object *obj, int clean_layer);
858 void evas_object_inject(Evas_Object *obj, Evas *e);
859 void evas_object_release(Evas_Object *obj, int clean_layer);
860 void evas_object_change(Evas_Object *obj);
861 void evas_object_clip_changes_clean(Evas_Object *obj);
862 void evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v);
863 void evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj);
864 void evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj);
865 void evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v);
866 void evas_rects_return_difference_rects(Eina_Array *rects, int x, int y, int w, int h, int xx, int yy, int ww, int hh);
867
868 void evas_object_clip_dirty(Evas_Object *obj);
869 void evas_object_recalc_clippees(Evas_Object *obj);
870 Evas_Layer *evas_layer_new(Evas *e);
871 void evas_layer_pre_free(Evas_Layer *lay);
872 void evas_layer_free_objects(Evas_Layer *lay);
873 void evas_layer_clean(Evas *e);
874 Evas_Layer *evas_layer_find(Evas *e, short layer_num);
875 void evas_layer_add(Evas_Layer *lay);
876 void evas_layer_del(Evas_Layer *lay);
877
878 int evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h);
879
880 int evas_object_was_opaque(Evas_Object *obj);
881 int evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
882 int evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
883 int evas_object_clippers_was_visible(Evas_Object *obj);
884 void evas_object_clip_across_check(Evas_Object *obj);
885 void evas_object_clip_across_clippees_check(Evas_Object *obj);
886 void evas_object_mapped_clip_across_mark(Evas_Object *obj);
887 void evas_event_callback_call(Evas *e, Evas_Callback_Type type, void *event_info);
888 void evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void *event_info);
889 Eina_List *evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y);
890 int evas_mem_free(int mem_required);
891 int evas_mem_degrade(int mem_required);
892 void evas_debug_error(void);
893 void evas_debug_input_null(void);
894 void evas_debug_magic_null(void);
895 void evas_debug_magic_wrong(DATA32 expected, DATA32 supplied);
896 void evas_debug_generic(const char *str);
897 const char *evas_debug_magic_string_get(DATA32 magic);
898 void evas_object_smart_use(Evas_Smart *s);
899 void evas_object_smart_unuse(Evas_Smart *s);
900 void evas_smart_cb_descriptions_fix(Evas_Smart_Cb_Description_Array *a) EINA_ARG_NONNULL(1);
901 Eina_Bool evas_smart_cb_descriptions_resize(Evas_Smart_Cb_Description_Array *a, unsigned int size) EINA_ARG_NONNULL(1);
902 const Evas_Smart_Cb_Description *evas_smart_cb_description_find(const Evas_Smart_Cb_Description_Array *a, const char *name) EINA_ARG_NONNULL(1, 2) EINA_PURE;
903
904 Eina_Bool _evas_object_image_preloading_get(const Evas_Object *obj);
905 void _evas_object_image_preloading_set(Evas_Object *obj, Eina_Bool preloading);
906 void _evas_object_image_preloading_check(Evas_Object *obj);
907 Evas_Object *_evas_object_image_video_parent_get(Evas_Object *obj);
908 void _evas_object_image_video_overlay_show(Evas_Object *obj);
909 void _evas_object_image_video_overlay_hide(Evas_Object *obj);
910 void evas_object_smart_del(Evas_Object *obj);
911 void evas_object_smart_cleanup(Evas_Object *obj);
912 void evas_object_smart_member_raise(Evas_Object *member);
913 void evas_object_smart_member_lower(Evas_Object *member);
914 void evas_object_smart_member_stack_above(Evas_Object *member, Evas_Object *other);
915 void evas_object_smart_member_stack_below(Evas_Object *member, Evas_Object *other);
916 const Eina_Inlist *evas_object_smart_members_get_direct(const Evas_Object *obj);
917 void _evas_object_smart_members_all_del(Evas_Object *obj);
918 void evas_call_smarts_calculate(Evas *e);
919 void *evas_mem_calloc(int size);
920 void _evas_post_event_callback_call(Evas *e);
921 void _evas_post_event_callback_free(Evas *e);
922 void evas_event_callback_list_post_free(Eina_Inlist **list);
923 void evas_object_event_callback_all_del(Evas_Object *obj);
924 void evas_object_event_callback_cleanup(Evas_Object *obj);
925 void evas_event_callback_all_del(Evas *e);
926 void evas_event_callback_cleanup(Evas *e);
927 void evas_object_inform_call_show(Evas_Object *obj);
928 void evas_object_inform_call_hide(Evas_Object *obj);
929 void evas_object_inform_call_move(Evas_Object *obj);
930 void evas_object_inform_call_resize(Evas_Object *obj);
931 void evas_object_inform_call_restack(Evas_Object *obj);
932 void evas_object_inform_call_changed_size_hints(Evas_Object *obj);
933 void evas_object_inform_call_image_preloaded(Evas_Object *obj);
934 void evas_object_inform_call_image_unloaded(Evas_Object *obj);
935 void evas_object_intercept_cleanup(Evas_Object *obj);
936 int evas_object_intercept_call_show(Evas_Object *obj);
937 int evas_object_intercept_call_hide(Evas_Object *obj);
938 int evas_object_intercept_call_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
939 int evas_object_intercept_call_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
940 int evas_object_intercept_call_raise(Evas_Object *obj);
941 int evas_object_intercept_call_lower(Evas_Object *obj);
942 int evas_object_intercept_call_stack_above(Evas_Object *obj, Evas_Object *above);
943 int evas_object_intercept_call_stack_below(Evas_Object *obj, Evas_Object *below);
944 int evas_object_intercept_call_layer_set(Evas_Object *obj, int l);
945 int evas_object_intercept_call_color_set(Evas_Object *obj, int r, int g, int b, int a);
946 int evas_object_intercept_call_clip_set(Evas_Object *obj, Evas_Object *clip);
947 int evas_object_intercept_call_clip_unset(Evas_Object *obj);
948 void evas_object_grabs_cleanup(Evas_Object *obj);
949 void evas_key_grab_free(Evas_Object *obj, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers);
950 void evas_font_dir_cache_free(void);
951 const char *evas_font_dir_cache_find(char *dir, char *font);
952 Eina_List *evas_font_dir_available_list(const Evas* evas);
953 void evas_font_dir_available_list_free(Eina_List *available);
954 void evas_font_free(Evas *evas, void *font);
955 void evas_fonts_zero_free(Evas *evas);
956 void evas_fonts_zero_presure(Evas *evas);
957 void evas_font_name_parse(Evas_Font_Description *fdesc, const char *name);
958 int evas_font_style_find(const char *start, const char *end, Evas_Font_Style style);
959 Evas_Font_Description *evas_font_desc_new(void);
960 Evas_Font_Description *evas_font_desc_dup(const Evas_Font_Description *fdesc);
961 void evas_font_desc_unref(Evas_Font_Description *fdesc);
962 int evas_font_desc_cmp(const Evas_Font_Description *a, const Evas_Font_Description *b);
963 Evas_Font_Description *evas_font_desc_ref(Evas_Font_Description *fdesc);
964 void * evas_font_load(Evas *evas, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size);
965 void evas_font_load_hinting_set(Evas *evas, void *font, int hinting);
966 void evas_object_smart_member_cache_invalidate(Evas_Object *obj);
967 void evas_text_style_pad_get(Evas_Text_Style_Type style, int *l, int *r, int *t, int *b);
968 void _evas_object_text_rehint(Evas_Object *obj);
969 void _evas_object_textblock_rehint(Evas_Object *obj);
970
971 extern int _evas_alloc_error;
972 extern int _evas_event_counter;
973
974 struct _Evas_Imaging_Image
975 {
976    RGBA_Image *image;
977 };
978
979 struct _Evas_Imaging_Font
980 {
981    RGBA_Font *font;
982 };
983
984 int evas_async_events_init(void);
985 int evas_async_events_shutdown(void);
986 int evas_async_target_del(const void *target);
987
988 void _evas_preload_thread_init(void);
989 void _evas_preload_thread_shutdown(void);
990 Evas_Preload_Pthread *evas_preload_thread_run(void (*func_heavy)(void *data),
991                                               void (*func_end)(void *data),
992                                               void (*func_cancel)(void *data),
993                                               const void *data);
994 Eina_Bool evas_preload_thread_cancel(Evas_Preload_Pthread *thread);
995
996 void _evas_walk(Evas *e);
997 void _evas_unwalk(Evas *e);
998
999 // expose for use in engines
1000 EAPI int _evas_module_engine_inherit(Evas_Func *funcs, char *name);
1001 EAPI const char *_evas_module_libdir_get(void);
1002          
1003 Eina_Bool evas_render_mapped(Evas *e, Evas_Object *obj, 
1004                              void *context, void *surface,
1005                              int off_x, int off_y, int mapped,
1006                              int ecx, int ecy, int ecw, int ech);
1007 void evas_render_invalidate(Evas *e);
1008 void evas_render_object_recalc(Evas_Object *obj);
1009
1010 Eina_Bool evas_map_inside_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y);
1011 Eina_Bool evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, Evas_Coord *mx, Evas_Coord *my, int grab);
1012
1013 Eina_List *evas_module_engine_list(void);
1014
1015 /* for touch event */
1016 void _evas_event_touch_down(Evas *e, Evas_Coord x, Evas_Coord y, int id, unsigned int timestamp);
1017 void _evas_event_touch_up(Evas *e, Evas_Coord x, Evas_Coord y, int id, unsigned int timestamp);
1018 void _evas_event_touch_move(Evas *e, Evas_Coord x, Evas_Coord y, int id, unsigned int timestamp);
1019
1020 /****************************************************************************/
1021 /*****************************************/
1022 /********************/
1023 #define MPOOL 1
1024
1025 #ifdef MPOOL 
1026 typedef struct _Evas_Mempool Evas_Mempool;
1027
1028 struct _Evas_Mempool
1029 {
1030   int           count;
1031   int           num_allocs;
1032   int           num_frees;
1033   Eina_Mempool *mp;
1034 };
1035 # define EVAS_MEMPOOL(x) \
1036    static Evas_Mempool x = {0, 0, 0, NULL}
1037 # define EVAS_MEMPOOL_INIT(x, nam, siz, cnt, ret) \
1038    do { \
1039      if (!x.mp) { \
1040        x.mp = eina_mempool_add("chained_mempool", nam, NULL, sizeof(siz), cnt); \
1041        if (!x.mp) { \
1042          return ret; \
1043        } \
1044      } \
1045    } while (0)
1046 # define EVAS_MEMPOOL_ALLOC(x, siz) \
1047    eina_mempool_malloc(x.mp, sizeof(siz))
1048 # define EVAS_MEMPOOL_PREP(x, p, siz) \
1049    do { \
1050      x.count++; \
1051      x.num_allocs++; \
1052      memset(p, 0, sizeof(siz)); \
1053    } while (0)
1054 # define EVAS_MEMPOOL_FREE(x, p) \
1055    do { \
1056      eina_mempool_free(x.mp, p); \
1057      x.count--; \
1058      x.num_frees++; \
1059      if (x.count <= 0) { \
1060        eina_mempool_del(x.mp); \
1061        x.mp = NULL; \
1062        x.count = 0; \
1063      } \
1064    } while (0)
1065 #else
1066 # define EVAS_MEMPOOL(x)
1067 # define EVAS_MEMPOOL_INIT(x, nam, siz, cnt, ret)
1068 # define EVAS_MEMPOOL_PREP(x, p, siz)
1069 # define EVAS_MEMPOOL_ALLOC(x, siz) \
1070    calloc(1, sizeof(siz))
1071 # define EVAS_MEMPOOL_FREE(x, p) \
1072    free(p)
1073 #endif
1074 /********************/
1075 /*****************************************/
1076 /****************************************************************************/
1077
1078 #define EVAS_API_OVERRIDE(func, api, prefix) \
1079      (api)->func = prefix##func
1080 #define EVAS_API_RESET(func, api) \
1081      (api)->func = NULL
1082
1083 #include "evas_inline.x"
1084
1085 #ifdef __cplusplus
1086 }
1087 #endif
1088 #endif