1 /**
2  * @defgroup Elm_Transit Transit
3  * @ingroup Elementary
4  *
5  * Transit is designed to apply various animated transition effects to @c
6  * Evas_Object, such like translation, rotation, etc. For using these
7  * effects, create an @ref Elm_Transit and add the desired transition effects.
8  *
9  * Once the effects are added into transit, they will be automatically
10  * managed (their callback will be called for the set duration and
11  * they will be deleted upon completion).
12  *
13  * Example:
14  * @code
15  * Elm_Transit *trans = elm_transit_add();
16  * elm_transit_object_add(trans, obj);
17  * elm_transit_effect_translation_add(trans, 0, 0, 280, 280
18  * elm_transit_duration_set(transit, 1);
19  * elm_transit_auto_reverse_set(transit, EINA_TRUE);
20  * elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
21  * elm_transit_repeat_times_set(transit, 3);
22  * @endcode
23  *
24  * Some transition effects are used to change the properties of objects. They
25  * are:
26  * @li @ref elm_transit_effect_translation_add
27  * @li @ref elm_transit_effect_color_add
28  * @li @ref elm_transit_effect_rotation_add
29  * @li @ref elm_transit_effect_wipe_add
30  * @li @ref elm_transit_effect_zoom_add
31  * @li @ref elm_transit_effect_resizing_add
32  *
33  * Other transition effects are used to make one object disappear and another
34  * object appear on its place. These effects are:
35  *
36  * @li @ref elm_transit_effect_flip_add
37  * @li @ref elm_transit_effect_resizable_flip_add
38  * @li @ref elm_transit_effect_fade_add
39  * @li @ref elm_transit_effect_blend_add
40  *
41  * It's also possible to make a transition chain with @ref
42  * elm_transit_chain_transit_add.
43  *
44  * @warning We strongly recommend to use elm_transit just when edje can not do
45  * the trick. Edje is better at handling transitions than Elm_Transit.
46  * Edje has more flexibility and animations can be manipulated inside the theme.
47  *
48  * List of examples:
49  * @li @ref transit_example_01_explained
50  * @li @ref transit_example_02_explained
51  * @li @ref transit_example_03_c
52  * @li @ref transit_example_04_c
53  *
54  * @{
55  */
56 
57 /**
58  * @enum Elm_Transit_Tween_Mode
59  *
60  * The type of acceleration used in the transition.
61  */
62 typedef enum
63 {
64    ELM_TRANSIT_TWEEN_MODE_LINEAR, /**< Constant speed */
65    ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL, /**< Starts slow, increase speed
66                                          over time, then decrease again
67                                          and stop slowly, v1 being a power factor */
68    ELM_TRANSIT_TWEEN_MODE_DECELERATE, /**< Starts fast and decrease
69                                          speed over time, v1 being a power factor */
70    ELM_TRANSIT_TWEEN_MODE_ACCELERATE, /**< Starts slow and increase speed
71                                          over time, v1 being a power factor */
72    ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP, /**< Start at gradient v1,
73                                              interpolated via power of v2 curve */
74    ELM_TRANSIT_TWEEN_MODE_BOUNCE, /**< Start at 0.0 then "drop" like a ball
75                                      bouncing to the ground at 1.0, and
76                                      bounce v2 times, with decay factor of v1 */
77    ELM_TRANSIT_TWEEN_MODE_SPRING, /**< Start at 0.0 then "wobble" like a spring
78                                      rest position 1.0, and wobble v2 times,
79                                      with decay factor of v1 */
80    ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE /**< @since 1.13
81                                           Follow the cubic-bezier curve
82                                           calculated with the control points
83                                           (x1, y1), (x2, y2) */
84 } Elm_Transit_Tween_Mode;
85 
86 /**
87  * @enum Elm_Transit_Effect_Flip_Axis
88  *
89  * The axis along which flip effect should be applied.
90  */
91 typedef enum
92 {
93    ELM_TRANSIT_EFFECT_FLIP_AXIS_X, /**< Flip on X axis */
94    ELM_TRANSIT_EFFECT_FLIP_AXIS_Y /**< Flip on Y axis */
95 } Elm_Transit_Effect_Flip_Axis;
96 
97 /**
98  * @enum Elm_Transit_Effect_Wipe_Dir
99  *
100  * The direction in which the wipe effect should occur.
101  */
102 typedef enum
103 {
104    ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT, /**< Wipe to the left */
105    ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT, /**< Wipe to the right */
106    ELM_TRANSIT_EFFECT_WIPE_DIR_UP, /**< Wipe up */
107    ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN /**< Wipe down */
108 } Elm_Transit_Effect_Wipe_Dir;
109 
110 /** @enum Elm_Transit_Effect_Wipe_Type
111  *
112  * Whether the wipe effect should show or hide the object.
113  */
114 typedef enum
115 {
116    ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE, /**< Hide the object during the
117                                          animation */
118    ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW /**< Show the object during the
119                                         animation */
120 } Elm_Transit_Effect_Wipe_Type;
121 
122 /**
123  * @typedef Elm_Transit
124  *
125  * The Transit created with elm_transit_add(). This type has the information
126  * about the objects which the transition will be applied, and the
127  * transition effects that will be used. It also contains info about
128  * duration, number of repetitions, auto-reverse, etc.
129  */
130 typedef struct _Elm_Transit Elm_Transit;
131 typedef void                Elm_Transit_Effect;
132 
133 /**
134  * @typedef Elm_Transit_Effect_Transition_Cb
135  *
136  * Transition callback called for this effect on each transition iteration.
137  */
138 typedef void (*Elm_Transit_Effect_Transition_Cb)(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress);
139 
140 /**
141  * Elm_Transit_Effect_End_Cb
142  *
143  * Transition callback called for this effect when the transition is over.
144  */
145 typedef void (*Elm_Transit_Effect_End_Cb)(Elm_Transit_Effect *effect, Elm_Transit *transit);
146 
147 /**
148  * Elm_Transit_Del_Cb
149  *
150  * A callback called when the transit is deleted.
151  */
152 typedef void (*Elm_Transit_Del_Cb)(void *data, Elm_Transit *transit);
153 
154 /**
155  * Create new transit.
156  *
157  * @note It is not necessary to delete the transit object, it will be deleted at
158  * the end of its operation.
159  * @note The transit will start playing when the program enters the main loop.
160  *
161  * @return The transit object.
162  *
163  * @ingroup Elm_Transit
164  */
165 EAPI Elm_Transit           *elm_transit_add(void);
166 
167 /**
168  * Stops the animation and delete the @p transit object.
169  *
170  * Call this function if you want to stop the animation before the
171  * transit time. Make sure the @p transit object is still alive with
172  * elm_transit_del_cb_set() function.
173  * All added effects will be deleted, calling its respective data_free_cb
174  * functions. The function set by elm_transit_del_cb_set() will be called.
175  *
176  * @see elm_transit_del_cb_set()
177  *
178  * @param transit The transit object to be deleted.
179  *
180  * @ingroup Elm_Transit
181  */
182 EAPI void                   elm_transit_del(Elm_Transit *transit);
183 
184 /**
185  * Add a new effect to the transit.
186  *
187  * @note The cb function and the data are the key to the effect.
188  * If you try to add an existing effect, nothing is done.
189  * @note After the first addition of an effect to @p transit, if its
190  * effect list become empty again, the @p transit will be killed by
191  * elm_transit_del(transit) function.
192  *
193  * Example:
194  * @code
195  * Elm_Transit *transit = elm_transit_add();
196  * elm_transit_effect_add(transit,
197  *                        elm_transit_effect_blend_op,
198  *                        elm_transit_effect_blend_context_new(),
199  *                        elm_transit_effect_blend_context_free);
200  * @endcode
201  *
202  * @param transit The transit object.
203  * @param transition_cb The operation function. It is called when the
204  * animation begins, it is the function that actually performs the animation.
205  * It is called with the @p data, @p transit and the time progression of the
206  * animation (a double value between 0.0 and 1.0).
207  * @param effect The context data of the effect.
208  * @param end_cb The function to free the context data, it will be called
209  * at the end of the effect, it must finalize the animation and free the
210  * @p data.
211  *
212  * @ingroup Elm_Transit
213  * @warning The transit will free the context data at the and of the
214  * transition with the data_free_cb function.
215  * Do not share the context data in between different transit objects.
216  */
217 EAPI void                   elm_transit_effect_add(Elm_Transit *transit, Elm_Transit_Effect_Transition_Cb transition_cb, Elm_Transit_Effect *effect, Elm_Transit_Effect_End_Cb end_cb);
218 
219 /**
220  * Delete an added effect.
221  *
222  * This function will remove the effect from the @p transit, calling the
223  * data_free_cb to free the @p data.
224  *
225  * @see elm_transit_effect_add()
226  *
227  * @note If the effect is not found, nothing is done.
228  * @note If the effect list become empty, this function will call
229  * elm_transit_del(transit), i.e., it will kill the @p transit.
230  *
231  * @param transit The transit object.
232  * @param transition_cb The operation function.
233  * @param effect The context data of the effect.
234  *
235  * @ingroup Elm_Transit
236  */
237 EAPI void                   elm_transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Transition_Cb transition_cb, Elm_Transit_Effect *effect);
238 
239 /**
240  * Add new object to apply the effects.
241  *
242  * @note After the first addition of an object to @p transit, if its
243  * object list become empty again, the @p transit will be killed by
244  * elm_transit_del(transit) function.
245  * @note If the @p obj belongs to another transit, the @p obj will be
246  * removed from it and it will only belong to the other @p transit.
247  * If the old transit stays without objects, it will die.
248  * @note When you add an object into the @p transit, its state from
249  * evas_object_pass_events_get(obj) is saved, and it is applied when the
250  * transit ends, if you change this state with evas_object_pass_events_set()
251  * after add the object, this state will change again when @p transit stops.
252  *
253  * @param transit The transit object.
254  * @param obj Object to be animated.
255  *
256  * @ingroup Elm_Transit
257  * @warning It is not allowed to add a new object after transit begins.
258  */
259 EAPI void                   elm_transit_object_add(Elm_Transit *transit, Evas_Object *obj);
260 
261 /**
262  * Removes an added object from the transit.
263  *
264  * @note If the @p obj is not in the @p transit, nothing is done.
265  * @note If the list become empty, this function will call
266  * elm_transit_del(transit), i.e., it will kill the @p transit.
267  *
268  * @param transit The transit object.
269  * @param obj Object to be removed from @p transit.
270  *
271  * @ingroup Elm_Transit
272  * @warning It is not allowed to remove objects after transit begins.
273  */
274 EAPI void                   elm_transit_object_remove(Elm_Transit *transit, Evas_Object *obj);
275 
276 /**
277  * Get the objects of the transit.
278  *
279  * @param transit The transit object.
280  * @return a Eina_List with the objects from the transit.
281  *
282  * @ingroup Elm_Transit
283  */
284 EAPI const Eina_List       *elm_transit_objects_get(const Elm_Transit *transit);
285 
286 /**
287  * Enable/disable keeping up the objects states.
288  * If it is not kept, the objects states will be reset when transition ends.
289  *
290  * @note @p transit can not be NULL.
291  * @note One state includes geometry, color, map data.
292  *
293  * @param transit The transit object.
294  * @param state_keep retain the state or not.
295  *
296  * @ingroup Elm_Transit
297  */
298 EAPI void                   elm_transit_objects_final_state_keep_set(Elm_Transit *transit, Eina_Bool state_keep);
299 
300 /**
301  * Get a value whether the objects states will be reset or not.
302  *
303  * @note @p transit can not be NULL
304  *
305  * @see elm_transit_objects_final_state_keep_set()
306  *
307  * @param transit The transit object.
308  * @return @c EINA_TRUE means the states of the objects will be reset.
309  * If @p transit is NULL, @c EINA_FALSE is returned
310  *
311  * @ingroup Elm_Transit
312  */
313 EAPI Eina_Bool              elm_transit_objects_final_state_keep_get(const Elm_Transit *transit);
314 
315 /**
316  * Set the event enabled when transit is operating.
317  *
318  * If @p enabled is @c EINA_TRUE, the objects of the transit will receive
319  * events from mouse and keyboard during the animation.
320  * @note When you add an object with elm_transit_object_add(), its state from
321  * evas_object_freeze_events_get(obj) is saved, and it is applied when the
322  * transit ends. If you change this state with evas_object_freeze_events_set()
323  * after adding the object, this state will change again when @p transit stops
324  * to run.
325  *
326  * @param transit The transit object.
327  * @param enabled Events are received when enabled is @c EINA_TRUE, and
328  * ignored otherwise.
329  *
330  * @ingroup Elm_Transit
331  */
332 EAPI void                   elm_transit_event_enabled_set(Elm_Transit *transit, Eina_Bool enabled);
333 
334 /**
335  * Get the value of event enabled status.
336  *
337  * @see elm_transit_event_enabled_set()
338  *
339  * @param transit The Transit object
340  * @return @c EINA_TRUE, when event is enabled. If @p transit is NULL
341  * @c EINA_FALSE is returned
342  *
343  * @ingroup Elm_Transit
344  */
345 EAPI Eina_Bool              elm_transit_event_enabled_get(const Elm_Transit *transit);
346 
347 /**
348  * Set the user-callback function when the transit is deleted.
349  *
350  * @note Using this function twice will overwrite the first function set.
351  * @note the @p transit object will be deleted after call @p cb function.
352  *
353  * @param transit The transit object.
354  * @param cb Callback function pointer. This function will be called before
355  * the deletion of the transit.
356  * @param data Callback function user data. It is the @p op parameter.
357  *
358  * @ingroup Elm_Transit
359  */
360 EAPI void                   elm_transit_del_cb_set(Elm_Transit *transit, Elm_Transit_Del_Cb cb, void *data);
361 
362 /**
363  * Set reverse effect automatically.
364  *
365  * If auto reverse is set, after running the effects with the progress
366  * parameter from 0 to 1, it will call the effects again with the progress
367  * from 1 to 0. The transit will last for a time equal to (2 * duration * repeat),
368  * where the duration was set with the function elm_transit_add and
369  * the repeat with the function elm_transit_repeat_times_set().
370  *
371  * @param transit The transit object.
372  * @param reverse @c EINA_TRUE means the auto_reverse is on.
373  *
374  * @ingroup Elm_Transit
375  */
376 EAPI void                   elm_transit_auto_reverse_set(Elm_Transit *transit, Eina_Bool reverse);
377 
378 /**
379  * Get if the auto reverse is on.
380  *
381  * @see elm_transit_auto_reverse_set()
382  *
383  * @param transit The transit object.
384  * @return @c EINA_TRUE means auto reverse is on. If @p transit is NULL
385  * @c EINA_FALSE is returned
386  *
387  * @ingroup Elm_Transit
388  */
389 EAPI Eina_Bool              elm_transit_auto_reverse_get(const Elm_Transit *transit);
390 
391 /**
392  * Set the transit repeat count. Effect will be repeated by repeat count.
393  *
394  * This function sets the number of repetition the transit will run after
395  * the first one, i.e., if @p repeat is 1, the transit will run 2 times.
396  * If the @p repeat is a negative number, it will repeat infinite times.
397  *
398  * @note If this function is called during the transit execution, the transit
399  * will run @p repeat times, ignoring the times it already performed.
400  *
401  * @param transit The transit object
402  * @param repeat Repeat count
403  *
404  * @ingroup Elm_Transit
405  */
406 EAPI void                   elm_transit_repeat_times_set(Elm_Transit *transit, int repeat);
407 
408 /**
409  * Get the transit repeat count.
410  *
411  * @see elm_transit_repeat_times_set()
412  *
413  * @param transit The Transit object.
414  * @return The repeat count. If @p transit is NULL
415  * 0 is returned
416  *
417  * @ingroup Elm_Transit
418  */
419 EAPI int                    elm_transit_repeat_times_get(const Elm_Transit *transit);
420 
421 /**
422  * Get current transit repeated count.
423  *
424  * @see elm_transit_repeat_times_set()
425  *
426  * @param transit The Transit object.
427  * @return Current repeated count. If @p transit is NULL
428  * 0 is returned
429  *
430  * @warning Return value is only valid when repeat times is set.
431  * @since 1.22
432  *
433  * @ingroup Elm_Transit
434  */
435 EAPI int                    elm_transit_current_repeat_times_get(const Elm_Transit *transit);
436 
437 /**
438  * Set the transit animation acceleration type.
439  *
440  * This function sets the tween mode of the transit that can be:
441  * ELM_TRANSIT_TWEEN_MODE_LINEAR - The default mode.
442  * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL - Starts in accelerate mode and ends
443  * decelerating with factor.
444  * ELM_TRANSIT_TWEEN_MODE_DECELERATE - The animation will be slowed over time
445  * with factor.
446  * ELM_TRANSIT_TWEEN_MODE_ACCELERATE - The animation will accelerate over time
447  * with factor.
448  * ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP - Start at gradient v1, interpolated
449  * via power of v2 curve.
450  * ELM_TRANSIT_TWEEN_MODE_BOUNCE - Start at 0.0 then "drop" like a ball bouncing
451  * to the ground at 1.0, and bounce v2 times, with decay factor of v1.
452  * ELM_TRANSIT_TWEEN_MODE_SPRING - Start at 0.0 then "wobble" like a spring rest
453  * position 1.0, and wobble v2 times, with decay factor of v1.
454  *
455  * @param transit The transit object.
456  * @param tween_mode The tween type.
457  *
458  * @ingroup Elm_Transit
459  */
460 EAPI void                   elm_transit_tween_mode_set(Elm_Transit *transit, Elm_Transit_Tween_Mode tween_mode);
461 
462 /**
463  * Get the transit animation acceleration type.
464  *
465  * @note @p transit can not be NULL
466  *
467  * @param transit The transit object.
468  * @return The tween type. If @p transit is NULL
469  * ELM_TRANSIT_TWEEN_MODE_LINEAR is returned.
470  *
471  * @ingroup Elm_Transit
472  */
473 EAPI Elm_Transit_Tween_Mode elm_transit_tween_mode_get(const Elm_Transit *transit);
474 
475 /**
476  * Set the transit animation acceleration factor.
477  *
478  * This function sets the tween mode factor of the transit that can be:
479  * If you use the below tween modes, you have to set the factor using this API.
480  * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL - Start slow, speed up then slow down
481  * at end, v1 being a power factor, 0.0 being linear, 1.0 being
482  * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL default, 2.0 being much more pronounced
483  * sinusoidal(squared), 3.0 being cubed, etc.
484  * ELM_TRANSIT_TWEEN_MODE_DECELERATE - Start fast then slow down, v1 being a
485  * power factor, 0.0 being linear, 1.0 being ELM_TRANSIT_TWEEN_MODE_DECELERATE
486  * default, 2.0 being much more pronounced decelerate (squared), 3.0 being
487  * cubed, etc.
488  * ELM_TRANSIT_TWEEN_MODE_ACCELERATE - Start slow then speed up, v1 being a
489  * power factor, 0.0 being linear, 1.0 being ELM_TRANSIT_TWEEN_MODE_ACCELERATE
490  * default, 2.0 being much more pronounced accelerate (squared), 3.0 being
491  * cubed, etc.
492  * ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP - Start at gradient * v1, interpolated
493  * via power of v2 curve
494  * ELM_TRANSIT_TWEEN_MODE_BOUNCE - Start at 0.0 then "drop" like a ball bouncing
495  * to the ground at 1.0, and bounce v2 times, with decay factor of v1
496  * ELM_TRANSIT_TWEEN_MODE_SPRING - Start at 0.0 then "wobble" like a spring rest
497  * position 1.0, and wobble v2 times, with decay factor of v1
498  *
499  * @param transit The transit object.
500  * @param v1 A parameter use by the mapping (default is 1.0)
501  * @param v2 A parameter use by the mapping (default is 0.0)
502  *
503  * @see elm_transit_tween_mode_factor_get()
504  *
505  * @ingroup Elm_Transit
506  */
507 EAPI void                   elm_transit_tween_mode_factor_set(Elm_Transit *transit, double v1, double v2);
508 
509 /**
510  * Get the transit animation acceleration factor.
511  *
512  * @note @p transit can not be NULL
513  *
514  * @param transit The transit object.
515  * @param v1      Pointer to an double in which to store the factor value.
516  * @param v2      Pointer to an double in which to store the factor value2.
517  *
518  * @see elm_transit_tween_mode_factor_set()
519  *
520  * @ingroup Elm_Transit
521  */
522 EAPI void                   elm_transit_tween_mode_factor_get(const Elm_Transit *transit, double *v1, double *v2);
523 
524 /**
525  * Set the transit animation acceleration factor.
526  *
527  * This function sets the tween mode factor of the transit that can be:
528  * If you use the below tween modes, you have to set the factor using this API.
529  * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL - Start slow, speed up then slow down
530  * at end, v[0] being a power factor, 0.0 being linear, 1.0 being
531  * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL default, 2.0 being much more pronounced
532  * sinusoidal(squared), 3.0 being cubed, etc.
533  * ELM_TRANSIT_TWEEN_MODE_DECELERATE - Start fast then slow down, v[0] being a
534  * power factor, 0.0 being linear, 1.0 being ELM_TRANSIT_TWEEN_MODE_DECELERATE
535  * default, 2.0 being much more pronounced decelerate (squared), 3.0 being
536  * cubed, etc.
537  * ELM_TRANSIT_TWEEN_MODE_ACCELERATE - Start slow then speed up, v[0] being a
538  * power factor, 0.0 being linear, 1.0 being ELM_TRANSIT_TWEEN_MODE_ACCELERATE
539  * default, 2.0 being much more pronounced accelerate (squared), 3.0 being
540  * cubed, etc.
541  * ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP - Start at gradient v[0], interpolated
542  * via power of v[1] curve
543  * ELM_TRANSIT_TWEEN_MODE_BOUNCE - Start at 0.0 then "drop" like a ball bouncing
544  * to the ground at 1.0, and bounce v[1] times, with decay factor of v[0]
545  * ELM_TRANSIT_TWEEN_MODE_SPRING - Start at 0.0 then "wobble" like a spring rest
546  * position 1.0, and wobble v[1] times, with decay factor of v[0]
547  * ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE - Use an interpolated cubic-bezier curve
548  * adjusted with parameters from v[0] to v[3]
549  *
550  * @param transit The transit object.
551  * @param v_size The size of the array pointing to v
552  * @param v The address of an array with the double parameters to be used by the mapping.
553  *
554  * @see elm_transit_tween_mode_factor_set()
555  * @since 1.13
556  * @ingroup Elm_Transit
557  */
558 EAPI void                   elm_transit_tween_mode_factor_n_set(Elm_Transit *transit, unsigned int v_size, double *v);
559 
560 /**
561  * Set the transit animation time
562  *
563  * @note @p transit can not be NULL
564  *
565  * @param transit The transit object.
566  * @param duration The animation time.
567  *
568  * @ingroup Elm_Transit
569  */
570 EAPI void                   elm_transit_duration_set(Elm_Transit *transit, double duration);
571 
572 /**
573  * Get the transit animation time
574  *
575  * @note @p transit can not be NULL
576  *
577  * @param transit The transit object.
578  *
579  * @return The transit animation time.
580  *
581  * @ingroup Elm_Transit
582  */
583 EAPI double                 elm_transit_duration_get(const Elm_Transit *transit);
584 
585 /**
586  * Starts the transition.
587  * Once this API is called, the transit begins to measure the time.
588  *
589  * @note @p transit can not be NULL
590  *
591  * @param transit The transit object.
592  *
593  * @ingroup Elm_Transit
594  */
595 EAPI void                   elm_transit_go(Elm_Transit *transit);
596 
597 /**
598  * This API can be used to reverse play an ongoing transition.
599  * It shows effect only when an animation is going on.
600  * If this API is called twice transition will go in forward direction as normal one.
601  * If a repeat count is set, this API call will revert just the ongoing cycle and once
602  * it is reverted back completely, the transition will go in forward direction.
603  * If an autoreverse is set for the transition and this API is called in the midst of
604  * the transition the ongoing transition will be reverted and once it is done, the
605  * transition will begin again and complete a full auto reverse cycle.
606  *
607  * @note @p transit can not be NULL
608  *
609  * @param transit The transit object.
610  * @return @c EINA_TRUE if transition is reverted, @c EINA_FALSE otherwise.
611  *
612  * @since 1.18
613  * @ingroup Elm_Transit
614  */
615 EAPI Eina_Bool               elm_transit_revert(Elm_Transit *transit);
616 
617 /**
618  * Starts the transition in given seconds.
619  *
620  * @note @p transit can not be NULL
621  *
622  * @param transit The transit object.
623  * @param in The interval value in seconds
624  *
625  * @since 1.14
626  * @ingroup Elm_Transit
627  */
628 EAPI void                   elm_transit_go_in(Elm_Transit *transit, double in);
629 
630 /**
631  * Pause/Resume the transition.
632  *
633  * If you call elm_transit_go again, the transit will be started from the
634  * beginning, and will be played.
635  *
636  * @note @p transit can not be NULL
637  *
638  * @param transit The transit object.
639  * @param paused Whether the transition should be paused or not.
640  *
641  * @ingroup Elm_Transit
642  */
643 EAPI void                   elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused);
644 
645 /**
646  * Get the value of paused status.
647  *
648  * @see elm_transit_paused_set()
649  *
650  * @note @p transit can not be NULL
651  *
652  * @param transit The transit object.
653  * @return @c EINA_TRUE means transition is paused. If @p transit is NULL
654  * @c EINA_FALSE is returned
655  *
656  * @ingroup Elm_Transit
657  */
658 EAPI Eina_Bool              elm_transit_paused_get(const Elm_Transit *transit);
659 
660 /**
661  * Get the time progression of the animation (a double value between 0.0 and 1.0).
662  *
663  * The value returned is a fraction (current time / total time). It
664  * represents the progression position relative to the total.
665  *
666  * @note @p transit can not be NULL
667  *
668  * @param transit The transit object.
669  *
670  * @return The time progression value. If @p transit is NULL
671  * 0 is returned
672  *
673  * @ingroup Elm_Transit
674  */
675 EAPI double                 elm_transit_progress_value_get(const Elm_Transit *transit);
676 
677 
678 /**
679  * Set current time progression of the animation.
680  *
681  * Intervene current progress instantly when it requires to jump onto a specific frame position.
682  *
683  * @note @p transit can not be NULL
684  *
685  * @param transit The transit object.
686  * @param progress The time progression value. The value must be in range of (0.0 ~ 1.0).
687  *
688  * @see elm_transit_progress_value_get()
689  *
690  * @since 1.22
691  *
692  * @ingroup Elm_Transit
693  */
694 EAPI void                   elm_transit_progress_value_set(Elm_Transit *transit, double progress);
695 
696 /**
697  * Makes the chain relationship between two transits.
698  *
699  * @note @p transit can not be NULL. Transit would have multiple chain transits.
700  * @note @p chain_transit can not be NULL. Chain transits could be chained to the only one transit.
701  *
702  * @param transit The transit object.
703  * @param chain_transit The chain transit object. This transit will be operated
704  *        after transit is done.
705  *
706  * This function adds @p chain_transit transition to a chain after the @p
707  * transit, and will be started as soon as @p transit ends. See @ref
708  * transit_example_02_explained for a full example.
709  *
710  * @ingroup Elm_Transit
711  */
712 EAPI void                   elm_transit_chain_transit_add(Elm_Transit *transit, Elm_Transit *chain_transit);
713 
714 /**
715  * Cut off the chain relationship between two transits.
716  *
717  * @note @p transit can not be NULL. Transit would have the chain relationship with @p chain transit.
718  * @note @p chain_transit can not be NULL. Chain transits should be chained to the @p transit.
719  *
720  * @param transit The transit object.
721  * @param chain_transit The chain transit object.
722  *
723  * This function remove the @p chain_transit transition from the @p transit.
724  *
725  * @ingroup Elm_Transit
726  */
727 EAPI void                   elm_transit_chain_transit_del(Elm_Transit *transit, Elm_Transit *chain_transit);
728 
729 /**
730  * Get the current chain transit list.
731  *
732  * @note @p transit can not be NULL.
733  *
734  * @param transit The transit object.
735  * @return chain transit list.
736  *
737  * @ingroup Elm_Transit
738  */
739 EAPI Eina_List             *elm_transit_chain_transits_get(const Elm_Transit *transit);
740 
741 /**
742  * Set the smooth effect for a transit.
743  *
744  * @param transit The transit object
745  * @param enabled enable or disable smooth map rendering
746  *
747  * This sets smoothing for transit map rendering. If the object added in a
748  * transit is a type that has its own smoothing settings, then both the smooth
749  * settings for this object and the map must be turned off. By default smooth
750  * maps are enabled.
751  *
752  * @see evas_map_smooth_set()
753  * @since 1.8
754  *
755  * @ingroup Elm_Transit
756  */
757 EAPI void                   elm_transit_smooth_set(Elm_Transit *transit, Eina_Bool enabled);
758 
759 /**
760  * Get the smooth scaling for transit map rendering
761  *
762  * This gets smooth scaling for transit map rendering.
763  *
764  * @param transit The transit object
765  * @return @c EINA_TRUE if the smooth is enabled, @c EINA_FALSE otherwise.
766  *
767  * @see elm_transit_smooth_set()
768  * @since 1.8
769  *
770  */
771 EAPI Eina_Bool              elm_transit_smooth_get(const Elm_Transit *transit);
772 
773 /**
774  * Add the Resizing Effect to Elm_Transit.
775  *
776  * @note This API is one of the facades. It creates resizing effect context
777  * and add it's required APIs to elm_transit_effect_add.
778  *
779  * @see elm_transit_effect_add()
780  *
781  * @param transit Transit object.
782  * @param from_w Object width size when effect begins.
783  * @param from_h Object height size when effect begins.
784  * @param to_w Object width size when effect ends.
785  * @param to_h Object height size when effect ends.
786  * @return Resizing effect context data.
787  *
788  * @ingroup Elm_Transit
789  */
790 EAPI Elm_Transit_Effect    *elm_transit_effect_resizing_add(Elm_Transit *transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h);
791 
792 /**
793  * Add the Translation Effect to Elm_Transit.
794  *
795  * @note This API is one of the facades. It creates translation effect context
796  * and add it's required APIs to elm_transit_effect_add.
797  *
798  * @see elm_transit_effect_add()
799  *
800  * @param transit Transit object.
801  * @param from_dx X Position variation when effect begins.
802  * @param from_dy Y Position variation when effect begins.
803  * @param to_dx X Position variation when effect ends.
804  * @param to_dy Y Position variation when effect ends.
805  * @return Translation effect context data.
806  *
807  * @ingroup Elm_Transit
808  * @warning It is highly recommended just create a transit with this effect when
809  * the window that the objects of the transit belongs has already been created.
810  * This is because this effect needs the geometry information about the objects,
811  * and if the window was not created yet, it can get a wrong information.
812  */
813 EAPI Elm_Transit_Effect    *elm_transit_effect_translation_add(Elm_Transit *transit, Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy);
814 
815 /**
816  * Add the Zoom Effect to Elm_Transit.
817  *
818  * @note This API is one of the facades. It creates zoom effect context
819  * and add it's required APIs to elm_transit_effect_add.
820  *
821  * @see elm_transit_effect_add()
822  *
823  * @param transit Transit object.
824  * @param from_rate Scale rate when effect begins (1 is current rate).
825  * @param to_rate Scale rate when effect ends.
826  * @return Zoom effect context data.
827  *
828  * @ingroup Elm_Transit
829  * @warning It is highly recommended just create a transit with this effect when
830  * the window that the objects of the transit belongs has already been created.
831  * This is because this effect needs the geometry information about the objects,
832  * and if the window was not created yet, it can get a wrong information.
833  */
834 EAPI Elm_Transit_Effect    *elm_transit_effect_zoom_add(Elm_Transit *transit, float from_rate, float to_rate);
835 
836 /**
837  * Add the Flip Effect to Elm_Transit.
838  *
839  * @note This API is one of the facades. It creates flip effect context
840  * and add it's required APIs to elm_transit_effect_add.
841  * @note This effect is applied to each pair of objects in the order they are listed
842  * in the transit list of objects. The first object in the pair will be the
843  * "front" object and the second will be the "back" object.
844  *
845  * @see elm_transit_effect_add()
846  *
847  * @param transit Transit object.
848  * @param axis Flipping Axis(X or Y).
849  * @param cw Flipping Direction. @c EINA_TRUE is clock-wise.
850  * @return Flip effect context data.
851  *
852  * @ingroup Elm_Transit
853  * @warning It is highly recommended just create a transit with this effect when
854  * the window that the objects of the transit belongs has already been created.
855  * This is because this effect needs the geometry information about the objects,
856  * and if the window was not created yet, it can get a wrong information.
857  */
858 EAPI Elm_Transit_Effect    *elm_transit_effect_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw);
859 
860 /**
861  * Add the Resizeable Flip Effect to Elm_Transit.
862  *
863  * @note This API is one of the facades. It creates resizable flip effect context
864  * and add it's required APIs to elm_transit_effect_add.
865  * @note This effect is applied to each pair of objects in the order they are listed
866  * in the transit list of objects. The first object in the pair will be the
867  * "front" object and the second will be the "back" object.
868  *
869  * @see elm_transit_effect_add()
870  *
871  * @param transit Transit object.
872  * @param axis Flipping Axis(X or Y).
873  * @param cw Flipping Direction. @c EINA_TRUE is clock-wise.
874  * @return Resizeable flip effect context data.
875  *
876  * @ingroup Elm_Transit
877  * @warning It is highly recommended just create a transit with this effect when
878  * the window that the objects of the transit belongs has already been created.
879  * This is because this effect needs the geometry information about the objects,
880  * and if the window was not created yet, it can get a wrong information.
881  */
882 EAPI Elm_Transit_Effect    *elm_transit_effect_resizable_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw);
883 
884 /**
885  * Add the Wipe Effect to Elm_Transit.
886  *
887  * @note This API is one of the facades. It creates wipe effect context
888  * and add it's required APIs to elm_transit_effect_add.
889  *
890  * @see elm_transit_effect_add()
891  *
892  * @param transit Transit object.
893  * @param type Wipe type. Hide or show.
894  * @param dir Wipe Direction.
895  * @return Wipe effect context data.
896  *
897  * @ingroup Elm_Transit
898  * @warning It is highly recommended just create a transit with this effect when
899  * the window that the objects of the transit belongs has already been created.
900  * This is because this effect needs the geometry information about the objects,
901  * and if the window was not created yet, it can get a wrong information.
902  */
903 EAPI Elm_Transit_Effect    *elm_transit_effect_wipe_add(Elm_Transit *transit, Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir);
904 
905 /**
906  * Add the Color Effect to Elm_Transit.
907  *
908  * @note This API is one of the facades. It creates color effect context
909  * and add it's required APIs to elm_transit_effect_add.
910  *
911  * @see elm_transit_effect_add()
912  *
913  * @param transit        Transit object.
914  * @param  from_r        RGB R when effect begins.
915  * @param  from_g        RGB G when effect begins.
916  * @param  from_b        RGB B when effect begins.
917  * @param  from_a        RGB A when effect begins.
918  * @param  to_r          RGB R when effect ends.
919  * @param  to_g          RGB G when effect ends.
920  * @param  to_b          RGB B when effect ends.
921  * @param  to_a          RGB A when effect ends.
922  * @return               Color effect context data.
923  *
924  * @ingroup Elm_Transit
925  */
926 EAPI Elm_Transit_Effect    *elm_transit_effect_color_add(Elm_Transit *transit, unsigned int from_r, unsigned int from_g, unsigned int from_b, unsigned int from_a, unsigned int to_r, unsigned int to_g, unsigned int to_b, unsigned int to_a);
927 
928 /**
929  * Add the Fade Effect to Elm_Transit.
930  *
931  * @note This API is one of the facades. It creates fade effect context
932  * and add it's required APIs to elm_transit_effect_add.
933  * @note This effect is applied to each pair of objects in the order they are listed
934  * in the transit list of objects. The first object in the pair will be the
935  * "before" object and the second will be the "after" object.
936  *
937  * @see elm_transit_effect_add()
938  *
939  * @param transit Transit object.
940  * @return Fade effect context data.
941  *
942  * @ingroup Elm_Transit
943  * @warning It is highly recommended just create a transit with this effect when
944  * the window that the objects of the transit belongs has already been created.
945  * This is because this effect needs the color information about the objects,
946  * and if the window was not created yet, it can get a wrong information.
947  */
948 EAPI Elm_Transit_Effect    *elm_transit_effect_fade_add(Elm_Transit *transit);
949 
950 /**
951  * Add the Blend Effect to Elm_Transit.
952  *
953  * @note This API is one of the facades. It creates blend effect context
954  * and add it's required APIs to elm_transit_effect_add.
955  * @note This effect is applied to each pair of objects in the order they are listed
956  * in the transit list of objects. The first object in the pair will be the
957  * "before" object and the second will be the "after" object.
958  *
959  * @see elm_transit_effect_add()
960  *
961  * @param transit Transit object.
962  * @return Blend effect context data.
963  *
964  * @ingroup Elm_Transit
965  * @warning It is highly recommended just create a transit with this effect when
966  * the window that the objects of the transit belongs has already been created.
967  * This is because this effect needs the color information about the objects,
968  * and if the window was not created yet, it can get a wrong information.
969  */
970 EAPI Elm_Transit_Effect    *elm_transit_effect_blend_add(Elm_Transit *transit);
971 
972 /**
973  * Add the Rotation Effect to Elm_Transit.
974  *
975  * @note This API is one of the facades. It creates rotation effect context
976  * and add it's required APIs to elm_transit_effect_add.
977  *
978  * @see elm_transit_effect_add()
979  *
980  * @param transit Transit object.
981  * @param from_degree Degree when effect begins.
982  * @param to_degree Degree when effect is ends.
983  * @return Rotation effect context data.
984  *
985  * @ingroup Elm_Transit
986  * @warning It is highly recommended just create a transit with this effect when
987  * the window that the objects of the transit belongs has already been created.
988  * This is because this effect needs the geometry information about the objects,
989  * and if the window was not created yet, it can get a wrong information.
990  */
991 EAPI Elm_Transit_Effect    *elm_transit_effect_rotation_add(Elm_Transit *transit, float from_degree, float to_degree);
992 
993 /**
994  * Add the ImageAnimation Effect to Elm_Transit.
995  *
996  * @note This API is one of the facades. It creates image animation effect context
997  * and add it's required APIs to elm_transit_effect_add.
998  * The @p images parameter is a list images paths. This list and
999  * its contents will be deleted at the end of the effect by
1000  * elm_transit_effect_image_animation_context_free() function.
1001  *
1002  * Example:
1003  * @code
1004  * char buf[PATH_MAX];
1005  * Eina_List *images = NULL;
1006  * Elm_Transit *transi = elm_transit_add();
1007  *
1008  * snprintf(buf, sizeof(buf), "%s/images/icon_11.png", PACKAGE_DATA_DIR);
1009  * images = eina_list_append(images, eina_stringshare_add(buf));
1010  *
1011  * snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1012  * images = eina_list_append(images, eina_stringshare_add(buf));
1013  * elm_transit_effect_image_animation_add(transi, images);
1014  *
1015  * @endcode
1016  *
1017  * @see elm_transit_effect_add()
1018  *
1019  * @param transit Transit object.
1020  * @param images Eina_List of images file paths. This list and
1021  * its contents will be deleted at the end of the effect by
1022  * elm_transit_effect_image_animation_context_free() function.
1023  * @return Image Animation effect context data.
1024  *
1025  * @ingroup Elm_Transit
1026  */
1027 EAPI Elm_Transit_Effect    *elm_transit_effect_image_animation_add(Elm_Transit *transit, Eina_List *images);
1028 /**
1029  * @}
1030  */
1031