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