summaryrefslogtreecommitdiff
path: root/src/lib/efx_private.h
blob: 9ab13f5ce55f345b9a4af8797874c133030e71f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef EFX_PRIVATE_H
#define EFX_PRIVATE_H

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <math.h>

#include <Evas.h>
#include <Ecore.h>

#include "Efx.h"

#define DBG(...)            EINA_LOG_DOM_DBG(_efx_log_dom, __VA_ARGS__)
#define INF(...)            EINA_LOG_DOM_INFO(_efx_log_dom, __VA_ARGS__)
#define WRN(...)            EINA_LOG_DOM_WARN(_efx_log_dom, __VA_ARGS__)
#define ERR(...)            EINA_LOG_DOM_ERR(_efx_log_dom, __VA_ARGS__)
#define CRI(...)            EINA_LOG_DOM_CRIT(_efx_log_dom, __VA_ARGS__)

#ifdef EAPI
# undef EAPI
#endif /* ifdef EAPI */

#ifdef _WIN32
# ifdef EFL_EFX_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else /* ifdef DLL_EXPORT */
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else /* ifdef EFL_BUILD */
#  define EAPI __declspec(dllimport)
# endif /* ! EFL_BUILD */
#else /* ifdef _WIN32 */
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI __attribute__ ((visibility("default")))
#  else /* if __GNUC__ >= 4 */
#   define EAPI
#  endif /* if __GNUC__ >= 4 */
# else /* ifdef __GNUC__ */
#  define EAPI
# endif /* ifdef __GNUC__ */
#endif /* ! _WIN32 */
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif

static const char *efx_speed_str[] =
{
   "LINEAR", "ACCELERATE", "DECELERATE", "SINUSOIDAL"
};

extern int _efx_log_dom;

typedef struct EFX EFX;

struct EFX
{
   Evas_Object *obj;
   EFX *owner;
   void *spin_data;
   void *rotate_data;
   void *zoom_data;
   void *move_data;
   void *bumpmap_data;
   void *pan_data;
   void *fade_data;
   void *resize_data;
   Efx_Map_Data map_data;
   Eina_List *followers;
   Eina_List *queue;
};

void _efx_zoom_calc(void *, void *, Evas_Object *obj, Evas_Map *map);
void _efx_rotate_calc(void *, void *, Evas_Object *obj, Evas_Map *map);
void _efx_spin_calc(void *, void *, Evas_Object *obj, Evas_Map *map);
void _efx_resize_adjust(EFX *e, int *x, int *y);

#define EFX_MAPS_APPLY_ALL EINA_TRUE, EINA_TRUE, EINA_TRUE
#define EFX_MAPS_APPLY_ROTATE EINA_TRUE, EINA_FALSE, EINA_FALSE
#define EFX_MAPS_APPLY_SPIN EINA_FALSE, EINA_TRUE, EINA_FALSE
#define EFX_MAPS_APPLY_ZOOM EINA_FALSE, EINA_FALSE, EINA_TRUE
#define EFX_MAPS_APPLY_ROTATE_SPIN EINA_TRUE, EINA_TRUE, EINA_FALSE
void efx_maps_apply(EFX *e, Evas_Object *obj, Evas_Map *map, Eina_Bool rotate, Eina_Bool spin, Eina_Bool zoom);

EFX *efx_new(Evas_Object *obj);
void efx_free(EFX *e);
Evas_Map *efx_map_new(Evas_Object *obj);
void efx_map_set(Evas_Object *obj, Evas_Map *map);
Eina_Bool efx_rotate_center_init(EFX *e, const Evas_Point *center);
Eina_Bool efx_zoom_center_init(EFX *e, const Evas_Point *center);
Eina_Bool efx_move_center_init(EFX *e, const Evas_Point *center);
void efx_rotate_helper(EFX *e, Evas_Object *obj, Evas_Map *map, double degrees);
void efx_clip_setup(Evas_Object *obj, Evas_Object *clip);
void efx_fade_reclip(void *efd);

#define EFX_QUEUE_CHECK(X) do \
   { \
      Eina_Bool run; \
      EFX *ee = (X)->e; \
      run = efx_queue_complete((X)->e, (X)); \
      if ((X)->cb) (X)->cb((X)->data, &(X)->e->map_data, (X)->e->obj); \
      if (run) efx_queue_process(ee); \
   } while (0)
Eina_Bool efx_queue_complete(EFX *e, void *effect_data);
void efx_queue_process(EFX *e);

static inline void
_size_debug(Evas_Object *obj)
{
   Evas_Coord x, y, w, h;
   evas_object_geometry_get(obj, &x, &y, &w, &h);
   DBG("%s %p: x=%d,y=%d,w=%d,h=%d", evas_object_visible_get(obj) ? "vis" : "hid", obj, x, y, w, h);
}

static inline void
_color_debug(Evas_Object *obj)
{
   Evas_Coord r, g, b, a;
   evas_object_color_get(obj, &r, &g, &b, &a);
   DBG("%d/%d/%d/%d", MIN(r, a), MIN(g, a), MIN(b, a), a);
}

#define HIT DBG("HIT")

#endif