summaryrefslogtreecommitdiff
path: root/src/lib/exactness/Exactness.h
blob: 33c448cf580ee4aadf04940612e4dd420aa89760 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#ifndef _EXACTNESS_H
#define _EXACTNESS_H

#include <Evas.h>

#ifdef EAPI
# undef EAPI
#endif

#ifdef _WIN32
# ifdef EXACTNESS_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else
#  define EAPI __declspec(dllimport)
# endif /* ! EXACTNESS_BUILD */
#else
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI __attribute__ ((visibility("default")))
#  else
#   define EAPI
#  endif
# else
#  define EAPI
# endif
#endif /* ! _WIN32 */

/**
 * @page exactness_main Exactness
 *
 * @date 2018 (created)
 *
 * This page describes the public structures and APIs available for Exactness.
 *
 * @addtogroup Exactness
 * @{
 */

/**
 * @typedef Exactness_Action_Type
 * The type values for an Exactness action.
 */
typedef enum
{
   EXACTNESS_ACTION_UNKNOWN = 0,
   EXACTNESS_ACTION_MOUSE_IN,
   EXACTNESS_ACTION_MOUSE_OUT,
   EXACTNESS_ACTION_MOUSE_WHEEL,
   EXACTNESS_ACTION_MULTI_DOWN,
   EXACTNESS_ACTION_MULTI_UP,
   EXACTNESS_ACTION_MULTI_MOVE,
   EXACTNESS_ACTION_KEY_DOWN,
   EXACTNESS_ACTION_KEY_UP,
   EXACTNESS_ACTION_TAKE_SHOT,
   EXACTNESS_ACTION_EFL_EVENT,
   EXACTNESS_ACTION_CLICK_ON,
   EXACTNESS_ACTION_STABILIZE,
   EXACTNESS_ACTION_LAST = EXACTNESS_ACTION_STABILIZE
   /* Add any supported actions here and update _LAST */
} Exactness_Action_Type;

/**
 * @typedef Exactness_Action_Mouse_Wheel
 * The type for the Exactness Mouse Wheel action.
 */
typedef struct
{
   int direction;
   int z;
} Exactness_Action_Mouse_Wheel;

/**
 * @typedef Exactness_Action_Key_Down_Up
 * The type for the Exactness Key Down Up action.
 */
typedef struct
{
   const char *keyname;
   const char *key;
   const char *string;
   const char *compose;
   unsigned int keycode;
} Exactness_Action_Key_Down_Up;

/**
 * @typedef Exactness_Action_Multi_Event
 * The type for the Exactness Multi Event action.
 */
typedef struct
{
   int d;
   int b; /* In case of simple mouse down/up, corresponds to the button */
   int x;
   int y;
   double rad;
   double radx;
   double rady;
   double pres;
   double ang;
   double fx;
   double fy;
   Evas_Button_Flags flags;
} Exactness_Action_Multi_Event;

/**
 * @typedef Exactness_Action_Multi_Move
 * The type for the Exactness Multi Move action.
 */
typedef struct
{
   int d;
   int x;
   int y;
   double rad;
   double radx;
   double rady;
   double pres;
   double ang;
   double fx;
   double fy;
} Exactness_Action_Multi_Move;

/**
 * @typedef Exactness_Action_Efl_Event
 * The type for the Exactness EFL Event action.
 */
typedef struct
{
   char *wdg_name;
   char *event_name;
} Exactness_Action_Efl_Event;

/**
 * @typedef Exactness_Action_Click_On
 * The type for the Exactness Click on (widget) action.
 */
typedef struct
{
   char *wdg_name;
} Exactness_Action_Click_On;

/**
 * @typedef Exactness_Action
 * The type for the Exactness action.
 */
typedef struct
{
   Exactness_Action_Type type;   /**< The action type */
   unsigned int n_evas;          /**< The evas number on which the action has to be applied */
   unsigned int delay_ms;        /**< The delay (in ms) to wait for this action */
   void *data;                   /**< The specific action data */
} Exactness_Action;

/**
 * @typedef Exactness_Object
 * The type for the Exactness object.
 */
typedef struct
{
   long long id;                 /**< The Eo pointer */
   long long parent_id;          /**< The Eo parent pointer */
   const char *kl_name;          /**< The class name */

   Eina_List *children; /* NOT EET */

   /* Evas stuff */
   int x;   /**< The X coordinate */
   int y;   /**< The Y coordinate */
   int w;   /**< The object width */
   int h;   /**< The object height */
} Exactness_Object;

/**
 * @typedef Exactness_Objects
 * The type for the Exactness objects list.
 */
typedef struct
{
   Eina_List *objs;        /**< List of all the objects */
   /* main_objs not in EET */
   Eina_List *main_objs;   /**< List of the main objects */
} Exactness_Objects;

/**
 * @typedef Exactness_Image
 * The type for the Exactness Image.
 */
typedef struct
{
   unsigned int w;   /**< Width of the image */
   unsigned int h;   /**< Height of the image */
   void *pixels;     /**< Pixels of the image */
} Exactness_Image;

typedef struct
{
   char *language; /**< String describing the language of the content e.g "C"...*/
   char *content; /**< Content used as source */
   char *command; /**< Command needed to generate the application from the content */
} Exactness_Source_Code;

typedef struct
{
   Eina_List *actions;  /**< List of Exactness_Action */
   /* imgs not in EET */
   Eina_List *imgs;     /**< List of Exactness_Image */
   Eina_List *objs;     /**< List of Exactness_Objects */
   Eina_List *codes;    /**< List of Exactness_Source_Code */
   const char *fonts_path; /**< Path to the fonts to use, relative to the fonts dir given in parameter to the player/recorder */
   int nb_shots;        /**< The number of shots present in the unit */
} Exactness_Unit;

/**
 * @brief Read an unit from a given file
 *
 * @param filename Name of the file containing the unit
 *
 * @return the unit
 */
EAPI Exactness_Unit *exactness_unit_file_read(const char *filename);

/**
 * @brief Write an unit into the given file
 *
 * @param unit Unit to store
 * @param filename Name of the file containing the unit
 *
 * @return EINA_TRUE on success, EINA_FALSE otherwise
 */
EAPI Eina_Bool exactness_unit_file_write(Exactness_Unit *unit, const char *filename);

/**
 * @brief Compare two images
 *
 * @param img1 first image
 * @param img2 second image
 * @param imgO pointer for the diff image. Can be NULL
 *
 * @return EINA_TRUE if the images are different, EINA_FALSE otherwise
 */
EAPI Eina_Bool exactness_image_compare(Exactness_Image *img1, Exactness_Image *img2, Exactness_Image **imgO);

/**
 * @brief Free the given image
 *
 * @param img the image
 *
 */
EAPI void exactness_image_free(Exactness_Image *img);

/**
 * @}
 */

#endif /* _EXACTNESS_H */