1 #include <Elementary.h>
4 #define ELM_TRANSIT_CHECK_OR_RETURN(transit, ...) \
7 CRITICAL("Elm_Transit " # transit " is NULL!"); \
10 if (!EINA_MAGIC_CHECK(transit, ELM_TRANSIT_MAGIC)) { \
11 EINA_MAGIC_FAIL(transit, ELM_TRANSIT_MAGIC); \
14 if (transit->deleted){ \
15 ERR("Elm_Transit " # transit " has already been deleted!"); \
21 #define _TRANSIT_FOCAL 2000
25 #define ELM_TRANSIT_MAGIC 0xd27f190a
28 Ecore_Animator *animator;
29 Eina_Inlist *effect_list;
31 Elm_Transit *prev_chain_transit;
32 Eina_List *next_chain_transits;
33 Elm_Transit_Tween_Mode tween_mode;
35 Elm_Transit_Del_Cb func;
51 unsigned int effects_pending_del;
53 Eina_Bool auto_reverse : 1;
54 Eina_Bool event_enabled : 1;
55 Eina_Bool deleted : 1;
56 Eina_Bool state_keep : 1;
57 Eina_Bool finished : 1;
60 struct _Elm_Transit_Effect_Module
63 Elm_Transit_Effect_Transition_Cb transition_cb;
64 Elm_Transit_Effect_End_Cb end_cb;
65 Elm_Transit_Effect *effect;
66 Eina_Bool deleted : 1;
69 struct _Elm_Transit_Obj_State
71 Evas_Coord x, y, w, h;
74 Eina_Bool map_enabled : 1;
75 Eina_Bool visible : 1;
78 struct _Elm_Transit_Obj_Data
80 struct _Elm_Transit_Obj_State *state;
81 Eina_Bool freeze_events : 1;
84 typedef struct _Elm_Transit_Effect_Module Elm_Transit_Effect_Module;
85 typedef struct _Elm_Transit_Obj_Data Elm_Transit_Obj_Data;
86 typedef struct _Elm_Transit_Obj_State Elm_Transit_Obj_State;
88 static void _transit_obj_data_update(Elm_Transit *transit, Evas_Object *obj);
89 static void _transit_obj_data_recover(Elm_Transit *transit, Evas_Object *obj);
90 static void _transit_obj_states_save(Evas_Object *obj, Elm_Transit_Obj_Data *obj_data);
91 static void _transit_obj_remove_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__);
92 static void _transit_obj_remove(Elm_Transit *transit, Evas_Object *obj);
93 static void _transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Module *effect_module);
94 static void _transit_remove_dead_effects(Elm_Transit *transit);
95 static void _transit_chain_go(Elm_Transit *transit);
96 static void _transit_del(Elm_Transit *transit);
97 static Eina_Bool _transit_animate_op(Elm_Transit *transit, double progress);
98 static Eina_Bool _transit_animate_cb(void *data);
100 static char *_transit_key= "_elm_transit_key";
103 _transit_obj_data_update(Elm_Transit *transit, Evas_Object *obj)
105 Elm_Transit_Obj_Data *obj_data = evas_object_data_get(obj, _transit_key);
108 obj_data = ELM_NEW(Elm_Transit_Obj_Data);
110 obj_data->freeze_events = evas_object_freeze_events_get(obj);
112 if ((!transit->state_keep) && (obj_data->state))
114 free(obj_data->state);
115 obj_data->state = NULL;
119 _transit_obj_states_save(obj, obj_data);
122 evas_object_data_set(obj, _transit_key, obj_data);
126 _transit_obj_states_save(Evas_Object *obj, Elm_Transit_Obj_Data *obj_data)
128 Elm_Transit_Obj_State *state = obj_data->state;
131 state = calloc(1, sizeof(Elm_Transit_Obj_State));
134 evas_object_geometry_get(obj, &state->x, &state->y, &state->w, &state->h);
135 evas_object_color_get(obj, &state->r, &state->g, &state->b, &state->a);
136 state->visible = evas_object_visible_get(obj);
137 state->map_enabled = evas_object_map_enable_get(obj);
138 if (evas_object_map_get(obj))
139 state->map = evas_map_dup(evas_object_map_get(obj));
140 obj_data->state = state;
144 _remove_obj_from_list(Elm_Transit *transit, Evas_Object *obj)
146 //Remove duplicated objects
147 //TODO: Need to consider about optimizing here
150 if (!eina_list_data_find_list(transit->objs, obj))
152 transit->objs = eina_list_remove(transit->objs, obj);
153 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
154 _transit_obj_remove_cb,
160 _transit_obj_remove_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
162 Elm_Transit *transit = data;
163 Elm_Transit_Obj_Data *obj_data = evas_object_data_get(obj, _transit_key);
167 free(obj_data->state);
170 _remove_obj_from_list(transit, obj);
171 if (!transit->objs) elm_transit_del(transit);
175 _transit_obj_data_recover(Elm_Transit *transit, Evas_Object *obj)
177 Elm_Transit_Obj_Data *obj_data;
178 Elm_Transit_Obj_State *state;
180 obj_data = evas_object_data_get(obj, _transit_key);
181 if (!obj_data) return;
182 evas_object_data_del(obj, _transit_key);
183 evas_object_freeze_events_set(obj, obj_data->freeze_events);
184 state = obj_data->state;
187 //recover the states of the object.
188 if (!transit->state_keep)
190 evas_object_move(obj, state->x, state->y);
191 evas_object_resize(obj, state->w, state->h);
192 evas_object_color_set(obj, state->r, state->g, state->b, state->a);
193 if (state->visible) evas_object_show(obj);
194 else evas_object_hide(obj);
195 if (state->map_enabled)
196 evas_object_map_enable_set(obj, EINA_TRUE);
198 evas_object_map_enable_set(obj, EINA_FALSE);
200 evas_object_map_set(obj, state->map);
208 _transit_obj_remove(Elm_Transit *transit, Evas_Object *obj)
210 _remove_obj_from_list(transit, obj);
211 _transit_obj_data_recover(transit, obj);
215 _transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Module *effect_module)
217 if (effect_module->end_cb)
218 effect_module->end_cb(effect_module->effect, transit);
223 _transit_remove_dead_effects(Elm_Transit *transit)
225 Elm_Transit_Effect_Module *effect_module;
227 EINA_INLIST_FOREACH(transit->effect_list, effect_module)
229 if (effect_module->deleted)
231 _transit_effect_del(transit, effect_module);
232 transit->effects_pending_del--;
233 if (!transit->effects_pending_del) return;
239 _transit_chain_go(Elm_Transit *transit)
241 ELM_TRANSIT_CHECK_OR_RETURN(transit);
242 elm_transit_go(transit);
243 _transit_animate_cb(transit);
247 _transit_del(Elm_Transit *transit)
249 Elm_Transit_Effect_Module *effect_module;
250 Elm_Transit *chain_transit;
251 Eina_List *elist, *elist_next;
253 if (transit->animator)
254 ecore_animator_del(transit->animator);
257 while (transit->effect_list)
259 effect_module = EINA_INLIST_CONTAINER_GET(transit->effect_list, Elm_Transit_Effect_Module);
260 transit->effect_list = eina_inlist_remove(transit->effect_list, transit->effect_list);
261 _transit_effect_del(transit, effect_module);
265 while (transit->objs)
266 _transit_obj_remove(transit, eina_list_data_get(transit->objs));
268 transit->deleted = EINA_TRUE;
270 if (transit->del_data.func)
271 transit->del_data.func(transit->del_data.arg, transit);
273 //cut off the chain transit relationship
274 EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next, chain_transit)
275 chain_transit->prev_chain_transit = NULL;
277 if (transit->prev_chain_transit)
278 transit->prev_chain_transit->next_chain_transits =
279 eina_list_remove(transit->prev_chain_transit->next_chain_transits, transit);
281 // run chain transits
282 if (transit->finished && transit->next_chain_transits)
284 EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next, chain_transit)
285 _transit_chain_go(chain_transit);
289 eina_list_free(transit->next_chain_transits);
291 EINA_MAGIC_SET(transit, EINA_MAGIC_NONE);
295 //If the transit is deleted then EINA_FALSE is retruned.
297 _transit_animate_op(Elm_Transit *transit, double progress)
299 Elm_Transit_Effect_Module *effect_module;
302 EINA_INLIST_FOREACH(transit->effect_list, effect_module)
304 if (transit->deleted) break;
305 if (!effect_module->deleted)
306 effect_module->transition_cb(effect_module->effect, transit, progress);
310 if (transit->walking) return EINA_TRUE;
312 if (transit->deleted)
314 _transit_del(transit);
318 else if (transit->effects_pending_del) _transit_remove_dead_effects(transit);
324 _transit_animate_cb(void *data)
326 Elm_Transit *transit = data;
327 double elapsed_time, duration;
329 transit->time.current = ecore_loop_time_get();
330 elapsed_time = transit->time.current - transit->time.begin;
331 duration = transit->time.duration + transit->time.delayed;
333 if (elapsed_time > duration)
334 elapsed_time = duration;
336 transit->progress = elapsed_time / duration;
337 switch (transit->tween_mode)
339 case ELM_TRANSIT_TWEEN_MODE_LINEAR:
340 transit->progress = ecore_animator_pos_map(transit->progress,
341 ECORE_POS_MAP_LINEAR,
343 case ELM_TRANSIT_TWEEN_MODE_ACCELERATE:
344 transit->progress = ecore_animator_pos_map(transit->progress,
345 ECORE_POS_MAP_ACCELERATE,
348 case ELM_TRANSIT_TWEEN_MODE_DECELERATE:
349 transit->progress = ecore_animator_pos_map(transit->progress,
350 ECORE_POS_MAP_DECELERATE,
353 case ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL:
354 transit->progress = ecore_animator_pos_map(transit->progress,
355 ECORE_POS_MAP_SINUSOIDAL,
363 if (transit->repeat.reverse) transit->progress = 1 - transit->progress;
365 if (transit->time.duration > 0)
367 if (!_transit_animate_op(transit, transit->progress))
368 return ECORE_CALLBACK_CANCEL;
371 /* Not end. Keep going. */
372 if (elapsed_time < duration) return ECORE_CALLBACK_RENEW;
374 /* Repeat and reverse and time done! */
375 if ((transit->repeat.count >= 0) &&
376 (transit->repeat.current == transit->repeat.count) &&
377 ((!transit->auto_reverse) || transit->repeat.reverse))
379 transit->finished = EINA_TRUE;
380 elm_transit_del(transit);
381 return ECORE_CALLBACK_CANCEL;
385 if (!transit->auto_reverse || transit->repeat.reverse)
387 transit->repeat.current++;
388 transit->repeat.reverse = EINA_FALSE;
390 else transit->repeat.reverse = EINA_TRUE;
392 transit->time.begin = ecore_loop_time_get();
394 return ECORE_CALLBACK_RENEW;
398 elm_transit_add(void)
400 Elm_Transit *transit = ELM_NEW(Elm_Transit);
403 ERR("Failed to allocate a elm_transit object!");
407 EINA_MAGIC_SET(transit, ELM_TRANSIT_MAGIC);
409 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_LINEAR);
415 elm_transit_del(Elm_Transit *transit)
417 ELM_TRANSIT_CHECK_OR_RETURN(transit);
419 if (transit->walking) transit->deleted = EINA_TRUE;
420 else _transit_del(transit);
424 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)
426 ELM_TRANSIT_CHECK_OR_RETURN(transit);
427 EINA_SAFETY_ON_NULL_RETURN(transition_cb);
428 Elm_Transit_Effect_Module *effect_module;
430 EINA_INLIST_FOREACH(transit->effect_list, effect_module)
431 if ((effect_module->transition_cb == transition_cb) && (effect_module->effect == effect))
433 WRN("elm_transit does not allow to add the duplicated effect! : transit=%p", transit);
437 effect_module = ELM_NEW(Elm_Transit_Effect_Module);
440 ERR("Failed to allocate a new effect!: transit=%p", transit);
444 effect_module->end_cb = end_cb;
445 effect_module->transition_cb = transition_cb;
446 effect_module->effect = effect;
448 transit->effect_list = eina_inlist_append(transit->effect_list, (Eina_Inlist*) effect_module);
452 elm_transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Transition_Cb transition_cb, Elm_Transit_Effect *effect)
454 ELM_TRANSIT_CHECK_OR_RETURN(transit);
455 EINA_SAFETY_ON_NULL_RETURN(transition_cb);
456 Elm_Transit_Effect_Module *effect_module;
458 EINA_INLIST_FOREACH(transit->effect_list, effect_module)
460 if ((effect_module->transition_cb == transition_cb) && (effect_module->effect == effect))
462 if (transit->walking)
464 effect_module->deleted = EINA_TRUE;
465 transit->effects_pending_del++;
469 _transit_effect_del(transit, effect_module);
470 if (!transit->effect_list) elm_transit_del(transit);
478 elm_transit_object_add(Elm_Transit *transit, Evas_Object *obj)
480 ELM_TRANSIT_CHECK_OR_RETURN(transit);
481 EINA_SAFETY_ON_NULL_RETURN(obj);
483 if (transit->animator)
485 if (!evas_object_data_get(obj, _transit_key))
487 _transit_obj_data_update(transit, obj);
488 evas_object_freeze_events_set(obj, EINA_TRUE);
492 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
493 _transit_obj_remove_cb,
496 transit->objs = eina_list_append(transit->objs, obj);
500 elm_transit_object_remove(Elm_Transit *transit, Evas_Object *obj)
502 ELM_TRANSIT_CHECK_OR_RETURN(transit);
503 EINA_SAFETY_ON_NULL_RETURN(obj);
505 _transit_obj_remove(transit, obj);
506 if (!transit->objs) elm_transit_del(transit);
509 EAPI const Eina_List *
510 elm_transit_objects_get(const Elm_Transit *transit)
512 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
513 return transit->objs;
517 elm_transit_event_enabled_set(Elm_Transit *transit, Eina_Bool enabled)
519 ELM_TRANSIT_CHECK_OR_RETURN(transit);
524 if (transit->event_enabled == enabled) return;
525 transit->event_enabled = !!enabled;
526 if (!transit->animator) return;
528 EINA_LIST_FOREACH(transit->objs, list, obj)
529 evas_object_freeze_events_set(obj, enabled);
533 elm_transit_event_enabled_get(const Elm_Transit *transit)
535 ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE);
536 return transit->event_enabled;
540 elm_transit_del_cb_set(Elm_Transit *transit, void (*cb) (void *data, Elm_Transit *transit), void *data)
542 ELM_TRANSIT_CHECK_OR_RETURN(transit);
543 transit->del_data.func = cb;
544 transit->del_data.arg = data;
548 elm_transit_auto_reverse_set(Elm_Transit *transit, Eina_Bool reverse)
550 ELM_TRANSIT_CHECK_OR_RETURN(transit);
551 transit->auto_reverse = reverse;
555 elm_transit_auto_reverse_get(const Elm_Transit *transit)
557 ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE);
558 return transit->auto_reverse;
562 elm_transit_repeat_times_set(Elm_Transit *transit, int repeat)
564 ELM_TRANSIT_CHECK_OR_RETURN(transit);
565 transit->repeat.count = repeat;
566 transit->repeat.current = 0;
570 elm_transit_repeat_times_get(const Elm_Transit *transit)
572 ELM_TRANSIT_CHECK_OR_RETURN(transit, 0);
573 return transit->repeat.count;
577 elm_transit_tween_mode_set(Elm_Transit *transit, Elm_Transit_Tween_Mode tween_mode)
579 ELM_TRANSIT_CHECK_OR_RETURN(transit);
580 transit->tween_mode = tween_mode;
583 EAPI Elm_Transit_Tween_Mode
584 elm_transit_tween_mode_get(const Elm_Transit *transit)
586 ELM_TRANSIT_CHECK_OR_RETURN(transit, ELM_TRANSIT_TWEEN_MODE_LINEAR);
587 return transit->tween_mode;
591 elm_transit_duration_set(Elm_Transit *transit, double duration)
593 ELM_TRANSIT_CHECK_OR_RETURN(transit);
594 if (transit->animator)
596 WRN("elm_transit does not allow to set the duration time in operating! : transit=%p", transit);
599 transit->time.duration = duration;
603 elm_transit_duration_get(const Elm_Transit *transit)
605 ELM_TRANSIT_CHECK_OR_RETURN(transit, 0.0);
606 return transit->time.duration;
610 elm_transit_go(Elm_Transit *transit)
612 ELM_TRANSIT_CHECK_OR_RETURN(transit);
617 if (transit->animator)
618 ecore_animator_del(transit->animator);
620 EINA_LIST_FOREACH(transit->objs, elist, obj)
621 _transit_obj_data_update(transit, obj);
623 if (!transit->event_enabled)
625 EINA_LIST_FOREACH(transit->objs, elist, obj)
626 evas_object_freeze_events_set(obj, EINA_TRUE);
629 transit->time.paused = 0;
630 transit->time.delayed = 0;
631 transit->time.begin = ecore_loop_time_get();
632 transit->animator = ecore_animator_add(_transit_animate_cb, transit);
636 elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused)
638 ELM_TRANSIT_CHECK_OR_RETURN(transit);
640 if (!transit->animator) return;
644 if (transit->time.paused > 0)
646 ecore_animator_freeze(transit->animator);
647 transit->time.paused = ecore_loop_time_get();
651 if (transit->time.paused == 0)
653 ecore_animator_thaw(transit->animator);
654 transit->time.delayed += (ecore_loop_time_get() - transit->time.paused);
655 transit->time.paused = 0;
660 elm_transit_paused_get(const Elm_Transit *transit)
662 ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE);
664 if (transit->time.paused == 0)
671 elm_transit_progress_value_get(const Elm_Transit *transit)
673 ELM_TRANSIT_CHECK_OR_RETURN(transit, 0);
675 return transit->progress;
679 elm_transit_objects_final_state_keep_set(Elm_Transit *transit, Eina_Bool state_keep)
681 ELM_TRANSIT_CHECK_OR_RETURN(transit);
683 if (transit->state_keep == state_keep) return;
684 if (transit->animator)
686 WRN("elm_transit does not allow to change final state keep mode in operating! : transit=%p", transit);
689 transit->state_keep = !!state_keep;
693 elm_transit_objects_final_state_keep_get(const Elm_Transit *transit)
695 ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE);
696 return transit->state_keep;
700 elm_transit_chain_transit_add(Elm_Transit *transit, Elm_Transit *chain_transit)
702 ELM_TRANSIT_CHECK_OR_RETURN(transit);
703 ELM_TRANSIT_CHECK_OR_RETURN(chain_transit);
705 if (transit == chain_transit)
707 WRN("You add a same transit as a chain transit! : transit=%p, chain_transit=%p", transit, chain_transit);
710 if (transit == chain_transit->prev_chain_transit)
713 if (chain_transit->prev_chain_transit)
714 chain_transit->prev_chain_transit->next_chain_transits = eina_list_remove(chain_transit->prev_chain_transit->next_chain_transits, chain_transit);
716 chain_transit->prev_chain_transit = transit;
717 transit->next_chain_transits = eina_list_append(transit->next_chain_transits, chain_transit);
721 elm_transit_chain_transit_del(Elm_Transit *transit, Elm_Transit *chain_transit)
723 ELM_TRANSIT_CHECK_OR_RETURN(transit);
724 ELM_TRANSIT_CHECK_OR_RETURN(chain_transit);
726 if (chain_transit->prev_chain_transit != transit)
728 WRN("A pair of transits does not have the chain relationship! : transit=%p, chain_transit=%p", transit, chain_transit);
732 chain_transit->prev_chain_transit = NULL;
733 transit->next_chain_transits = eina_list_remove(transit->next_chain_transits, chain_transit);
737 elm_transit_chain_transits_get(const Elm_Transit * transit)
739 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
740 return transit->next_chain_transits;
743 ///////////////////////////////////////////////////////////////////////////
745 ///////////////////////////////////////////////////////////////////////////
746 typedef struct _Elm_Transit_Effect_Resizing Elm_Transit_Effect_Resizing;
748 struct _Elm_Transit_Effect_Resizing
756 _transit_effect_resizing_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
758 Elm_Transit_Effect_Resizing *resizing = effect;
763 _transit_effect_resizing_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
765 EINA_SAFETY_ON_NULL_RETURN(effect);
766 EINA_SAFETY_ON_NULL_RETURN(transit);
770 Elm_Transit_Effect_Resizing *resizing = effect;
772 w = resizing->from.w + (resizing->to.w * progress);
773 h = resizing->from.h + (resizing->to.h * progress);
775 EINA_LIST_FOREACH(transit->objs, elist, obj)
776 evas_object_resize(obj, w, h);
779 static Elm_Transit_Effect *
780 _transit_effect_resizing_context_new(Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h)
782 Elm_Transit_Effect_Resizing *resizing;
784 resizing = ELM_NEW(Elm_Transit_Effect_Resizing);
785 if (!resizing) return NULL;
787 resizing->from.w = from_w;
788 resizing->from.h = from_h;
789 resizing->to.w = to_w - from_w;
790 resizing->to.h = to_h - from_h;
795 EAPI Elm_Transit_Effect *
796 elm_transit_effect_resizing_add(Elm_Transit *transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h)
798 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
799 Elm_Transit_Effect *effect = _transit_effect_resizing_context_new(from_w, from_h, to_w, to_h);
803 ERR("Failed to allocate resizing effect! : transit=%p", transit);
806 elm_transit_effect_add(transit,
807 _transit_effect_resizing_op, effect,
808 _transit_effect_resizing_context_free);
812 ///////////////////////////////////////////////////////////////////////////
814 ///////////////////////////////////////////////////////////////////////////
815 typedef struct _Elm_Transit_Effect_Translation Elm_Transit_Effect_Translation;
816 typedef struct _Elm_Transit_Effect_Translation_Node Elm_Transit_Effect_Translation_Node;
818 struct _Elm_Transit_Effect_Translation_Node
824 struct _Elm_Transit_Effect_Translation
826 struct _position_variation {
833 _translation_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
835 Elm_Transit_Effect_Translation *translation = data;
837 Elm_Transit_Effect_Translation_Node *translation_node;
839 EINA_LIST_FOREACH(translation->nodes, elist, translation_node)
841 if (translation_node->obj != obj) continue;
842 translation->nodes = eina_list_remove_list(translation->nodes, elist);
843 free(translation_node);
849 _translation_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Translation *translation)
851 Elm_Transit_Effect_Translation_Node *translation_node;
852 const Eina_List *elist;
854 Eina_List *data_list = NULL;
855 const Eina_List *objs = elm_transit_objects_get(transit);
857 EINA_LIST_FOREACH(objs, elist, obj)
859 translation_node = ELM_NEW(Elm_Transit_Effect_Translation_Node);
860 if (!translation_node)
862 eina_list_free(data_list);
865 translation_node->obj = obj;
866 evas_object_geometry_get(obj, &(translation_node->x),
867 &(translation_node->y), NULL, NULL);
868 data_list = eina_list_append(data_list, translation_node);
869 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
870 _translation_object_del_cb, translation);
876 _transit_effect_translation_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
878 EINA_SAFETY_ON_NULL_RETURN(effect);
879 Elm_Transit_Effect_Translation *translation = effect;
880 Eina_List *elist, *elist_next;
881 Elm_Transit_Effect_Translation_Node *translation_node;
883 EINA_LIST_FOREACH_SAFE(translation->nodes,
884 elist, elist_next, translation_node)
886 evas_object_event_callback_del(translation_node->obj,
887 EVAS_CALLBACK_DEL, _translation_object_del_cb);
888 translation->nodes = eina_list_remove_list(translation->nodes, elist);
889 free(translation_node);
895 _transit_effect_translation_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress __UNUSED__)
897 EINA_SAFETY_ON_NULL_RETURN(effect);
898 EINA_SAFETY_ON_NULL_RETURN(transit);
900 Elm_Transit_Effect_Translation *translation = effect;
901 Elm_Transit_Effect_Translation_Node *translation_node;
904 if (!translation->nodes)
905 translation->nodes = _translation_nodes_build(transit, translation);
907 EINA_LIST_FOREACH(translation->nodes, elist, translation_node)
909 x = translation_node->x + translation->from.dx
910 + (translation->to.dx * progress);
911 y = translation_node->y + translation->from.dy
912 + (translation->to.dy * progress);
913 evas_object_move(translation_node->obj, x, y);
917 static Elm_Transit_Effect *
918 _transit_effect_translation_context_new(Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy)
920 Elm_Transit_Effect_Translation *translation;
922 translation = ELM_NEW(Elm_Transit_Effect_Translation);
923 if (!translation) return NULL;
925 translation->from.dx = from_dx;
926 translation->from.dy = from_dy;
927 translation->to.dx = to_dx - from_dx;
928 translation->to.dy = to_dy - from_dy;
933 EAPI Elm_Transit_Effect *
934 elm_transit_effect_translation_add(Elm_Transit *transit, Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy)
936 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
937 Elm_Transit_Effect *effect = _transit_effect_translation_context_new(from_dx, from_dy, to_dx, to_dy);
941 ERR("Failed to allocate translation effect! : transit=%p", transit);
944 elm_transit_effect_add(transit,
945 _transit_effect_translation_op, effect,
946 _transit_effect_translation_context_free);
950 ///////////////////////////////////////////////////////////////////////////
952 ///////////////////////////////////////////////////////////////////////////
953 typedef struct _Elm_Transit_Effect_Zoom Elm_Transit_Effect_Zoom;
955 struct _Elm_Transit_Effect_Zoom
961 _transit_effect_zoom_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
963 Elm_Transit_Effect_Zoom *zoom = effect;
968 _transit_effect_zoom_op(Elm_Transit_Effect *effect, Elm_Transit *transit , double progress)
970 EINA_SAFETY_ON_NULL_RETURN(effect);
971 EINA_SAFETY_ON_NULL_RETURN(transit);
974 Elm_Transit_Effect_Zoom *zoom = effect;
976 Evas_Coord x, y, w, h;
978 map = evas_map_new(4);
981 EINA_LIST_FOREACH(transit->objs, elist, obj)
983 evas_object_geometry_get(obj, &x, &y, &w, &h);
984 evas_map_util_points_populate_from_object_full(map, obj, zoom->from +
985 (progress * zoom->to));
986 evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, _TRANSIT_FOCAL);
987 evas_object_map_set(obj, map);
988 evas_object_map_enable_set(obj, EINA_TRUE);
993 static Elm_Transit_Effect *
994 _transit_effect_zoom_context_new(float from_rate, float to_rate)
996 Elm_Transit_Effect_Zoom *zoom;
998 zoom = ELM_NEW(Elm_Transit_Effect_Zoom);
999 if (!zoom) return NULL;
1001 zoom->from = (_TRANSIT_FOCAL - (from_rate * _TRANSIT_FOCAL)) * (1 / from_rate);
1002 zoom->to = ((_TRANSIT_FOCAL - (to_rate * _TRANSIT_FOCAL)) * (1 / to_rate)) - zoom->from;
1007 EAPI Elm_Transit_Effect *
1008 elm_transit_effect_zoom_add(Elm_Transit *transit, float from_rate, float to_rate)
1010 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
1011 Elm_Transit_Effect *effect = _transit_effect_zoom_context_new(from_rate, to_rate);
1015 ERR("Failed to allocate zoom effect! : transit=%p", transit);
1018 elm_transit_effect_add(transit,
1019 _transit_effect_zoom_op, effect,
1020 _transit_effect_zoom_context_free);
1024 ///////////////////////////////////////////////////////////////////////////
1026 ///////////////////////////////////////////////////////////////////////////
1027 typedef struct _Elm_Transit_Effect_Flip Elm_Transit_Effect_Flip;
1029 struct _Elm_Transit_Effect_Flip
1031 Elm_Transit_Effect_Flip_Axis axis;
1036 _transit_effect_flip_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit)
1038 EINA_SAFETY_ON_NULL_RETURN(effect);
1039 EINA_SAFETY_ON_NULL_RETURN(transit);
1040 Elm_Transit_Effect_Flip *flip = effect;
1041 Evas_Object *front, *back;
1043 int count = eina_list_count(transit->objs);
1045 for (i = 0; i < (count - 1); i += 2)
1047 front = eina_list_nth(transit->objs, i);
1048 back = eina_list_nth(transit->objs, i+1);
1049 evas_object_map_enable_set(front, EINA_FALSE);
1050 evas_object_map_enable_set(back, EINA_FALSE);
1056 _transit_effect_flip_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
1058 EINA_SAFETY_ON_NULL_RETURN(effect);
1059 EINA_SAFETY_ON_NULL_RETURN(transit);
1060 Evas_Object *obj, *front, *back;
1062 Elm_Transit_Effect_Flip *flip = effect;
1065 Evas_Coord x, y, w, h;
1067 map = evas_map_new(4);
1070 if (flip->cw) degree = (float)(progress * 180);
1071 else degree = (float)(progress * -180);
1073 count = eina_list_count(transit->objs);
1075 for (i = 0; i < (count - 1); i += 2)
1077 Evas_Coord half_w, half_h;
1079 front = eina_list_nth(transit->objs, i);
1080 back = eina_list_nth(transit->objs, i+1);
1082 if ((degree < 90) && (degree > -90))
1087 evas_object_hide(back);
1088 evas_object_show(front);
1096 evas_object_hide(front);
1097 evas_object_show(back);
1101 evas_map_util_points_populate_from_object_full(map, obj, 0);
1102 evas_object_geometry_get(obj, &x, &y, &w, &h);
1106 if (flip->axis == ELM_TRANSIT_EFFECT_FLIP_AXIS_Y)
1108 if ((degree >= 90) || (degree <= -90))
1110 evas_map_point_image_uv_set(map, 0, w, 0);
1111 evas_map_point_image_uv_set(map, 1, 0, 0);
1112 evas_map_point_image_uv_set(map, 2, 0, h);
1113 evas_map_point_image_uv_set(map, 3, w, h);
1115 evas_map_util_3d_rotate(map, 0, degree,
1116 0, x + half_w, y + half_h, 0);
1120 if ((degree >= 90) || (degree <= -90))
1122 evas_map_point_image_uv_set(map, 0, 0, h);
1123 evas_map_point_image_uv_set(map, 1, w, h);
1124 evas_map_point_image_uv_set(map, 2, w, 0);
1125 evas_map_point_image_uv_set(map, 3, 0, 0);
1127 evas_map_util_3d_rotate(map, degree,
1128 0, 0, x + half_w, y + half_h, 0);
1130 evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, _TRANSIT_FOCAL);
1131 evas_object_map_enable_set(front, EINA_TRUE);
1132 evas_object_map_enable_set(back, EINA_TRUE);
1133 evas_object_map_set(obj, map);
1138 static Elm_Transit_Effect *
1139 _transit_effect_flip_context_new(Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw)
1141 Elm_Transit_Effect_Flip *flip;
1143 flip = ELM_NEW(Elm_Transit_Effect_Flip);
1144 if (!flip) return NULL;
1152 EAPI Elm_Transit_Effect *
1153 elm_transit_effect_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw)
1155 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
1156 Elm_Transit_Effect *effect = _transit_effect_flip_context_new(axis, cw);
1160 ERR("Failed to allocate flip effect! : transit=%p", transit);
1163 elm_transit_effect_add(transit,
1164 _transit_effect_flip_op, effect,
1165 _transit_effect_flip_context_free);
1169 ///////////////////////////////////////////////////////////////////////////
1170 //ResizableFlip Effect
1171 ///////////////////////////////////////////////////////////////////////////
1172 typedef struct _Elm_Transit_Effect_Resizable_Flip Elm_Transit_Effect_ResizableFlip;
1173 typedef struct _Elm_Transit_Effect_Resizable_Flip_Node Elm_Transit_Effect_ResizableFlip_Node;
1175 struct _Elm_Transit_Effect_Resizable_Flip_Node
1181 } from_pos, from_size, to_pos, to_size;
1184 struct _Elm_Transit_Effect_Resizable_Flip
1188 Elm_Transit_Effect_Flip_Axis axis;
1192 _resizable_flip_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1194 Elm_Transit_Effect_ResizableFlip *resizable_flip = data;
1196 Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node;
1198 EINA_LIST_FOREACH(resizable_flip->nodes, elist, resizable_flip_node)
1200 if (resizable_flip_node->front == obj)
1201 evas_object_event_callback_del(resizable_flip_node->back,
1202 EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb);
1203 else if (resizable_flip_node->back == obj)
1204 evas_object_event_callback_del(resizable_flip_node->front,
1205 EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb);
1208 resizable_flip->nodes = eina_list_remove_list(resizable_flip->nodes,
1210 free(resizable_flip_node);
1216 _resizable_flip_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_ResizableFlip *resizable_flip)
1218 Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node;
1219 Eina_List *data_list = NULL;
1220 Evas_Coord front_x, front_y, front_w, front_h;
1221 Evas_Coord back_x, back_y, back_w, back_h;
1224 count = eina_list_count(transit->objs);
1225 for (i = 0; i < (count - 1); i += 2)
1227 resizable_flip_node = ELM_NEW(Elm_Transit_Effect_ResizableFlip_Node);
1228 if (!resizable_flip_node)
1230 eina_list_free(data_list);
1234 resizable_flip_node->front = eina_list_nth(transit->objs, i);
1235 resizable_flip_node->back = eina_list_nth(transit->objs, i+1);
1237 evas_object_geometry_get(resizable_flip_node->front,
1238 &front_x, &front_y, &front_w, &front_h);
1239 evas_object_geometry_get(resizable_flip_node->back,
1240 &back_x, &back_y, &back_w, &back_h);
1242 resizable_flip_node->from_pos.x = front_x;
1243 resizable_flip_node->from_pos.y = front_y;
1244 resizable_flip_node->to_pos.x = back_x - front_x;
1245 resizable_flip_node->to_pos.y = back_y - front_y;
1247 resizable_flip_node->from_size.x = front_w;
1248 resizable_flip_node->from_size.y = front_h;
1249 resizable_flip_node->to_size.x = back_w - front_w;
1250 resizable_flip_node->to_size.y = back_h - front_h;
1252 data_list = eina_list_append(data_list, resizable_flip_node);
1254 evas_object_event_callback_add(resizable_flip_node->back,
1255 EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb, resizable_flip);
1256 evas_object_event_callback_add(resizable_flip_node->front,
1257 EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb, resizable_flip);
1264 _set_image_uv_by_axis_y(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, float degree)
1266 if ((degree >= 90) || (degree <= -90))
1268 evas_map_point_image_uv_set(map, 0,
1269 (flip->from_size.x * 2) + flip->to_size.x,
1271 evas_map_point_image_uv_set(map, 1, 0, 0);
1272 evas_map_point_image_uv_set(map, 2, 0,
1273 (flip->from_size.y * 2) + flip->to_size.y);
1274 evas_map_point_image_uv_set(map, 3,
1275 (flip->from_size.x * 2) + flip->to_size.x,
1276 (flip->from_size.y * 2) + flip->to_size.y);
1280 evas_map_point_image_uv_set(map, 0, 0, 0);
1281 evas_map_point_image_uv_set(map, 1, flip->from_size.x, 0);
1282 evas_map_point_image_uv_set(map, 2, flip->from_size.x,
1284 evas_map_point_image_uv_set(map, 3, 0, flip->from_size.y);
1289 _set_image_uv_by_axis_x(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, float degree)
1291 if ((degree >= 90) || (degree <= -90))
1293 evas_map_point_image_uv_set(map, 0, 0,
1294 (flip->from_size.y * 2) + flip->to_size.y);
1295 evas_map_point_image_uv_set(map, 1,
1296 (flip->from_size.x * 2) + flip->to_size.x,
1297 (flip->from_size.y * 2) + flip->to_size.y);
1298 evas_map_point_image_uv_set(map, 2,
1299 (flip->from_size.x * 2) + flip->to_size.x,
1301 evas_map_point_image_uv_set(map, 3, 0, 0);
1305 evas_map_point_image_uv_set(map, 0, 0, 0);
1306 evas_map_point_image_uv_set(map, 1, flip->from_size.x, 0);
1307 evas_map_point_image_uv_set(map, 2, flip->from_size.x,
1309 evas_map_point_image_uv_set(map, 3, 0, flip->from_size.y);
1314 _transit_effect_resizable_flip_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
1316 EINA_SAFETY_ON_NULL_RETURN(effect);
1318 Elm_Transit_Effect_ResizableFlip *resizable_flip = effect;
1319 Eina_List *elist, *elist_next;
1320 Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node;
1322 EINA_LIST_FOREACH_SAFE(resizable_flip->nodes,
1323 elist, elist_next, resizable_flip_node)
1325 evas_object_map_enable_set(resizable_flip_node->front, EINA_FALSE);
1326 evas_object_map_enable_set(resizable_flip_node->back, EINA_FALSE);
1328 resizable_flip->nodes = eina_list_remove_list(resizable_flip->nodes,
1331 evas_object_event_callback_del(resizable_flip_node->back,
1332 EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb);
1333 evas_object_event_callback_del(resizable_flip_node->front,
1334 EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb);
1335 free(resizable_flip_node);
1337 free(resizable_flip);
1341 _transit_effect_resizable_flip_op(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__, double progress)
1343 EINA_SAFETY_ON_NULL_RETURN(effect);
1348 Evas_Coord half_w, half_h;
1349 Elm_Transit_Effect_ResizableFlip *resizable_flip = effect;
1350 Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node;
1353 map = evas_map_new(4);
1356 if (resizable_flip->cw) degree = (float)(progress * 180);
1357 else degree = (float)(progress * -180);
1359 if (!resizable_flip->nodes)
1360 resizable_flip->nodes = _resizable_flip_nodes_build(transit,
1363 EINA_LIST_FOREACH(resizable_flip->nodes, elist, resizable_flip_node)
1365 if ((degree < 90) && (degree > -90))
1367 obj = resizable_flip_node->front;
1368 if (resizable_flip_node->front != resizable_flip_node->back)
1370 evas_object_hide(resizable_flip_node->back);
1371 evas_object_show(resizable_flip_node->front);
1376 obj = resizable_flip_node->back;
1377 if (resizable_flip_node->front != resizable_flip_node->back)
1379 evas_object_hide(resizable_flip_node->front);
1380 evas_object_show(resizable_flip_node->back);
1384 x = resizable_flip_node->from_pos.x +
1385 (resizable_flip_node->to_pos.x * progress);
1386 y = resizable_flip_node->from_pos.y +
1387 (resizable_flip_node->to_pos.y * progress);
1388 w = resizable_flip_node->from_size.x +
1389 (resizable_flip_node->to_size.x * progress);
1390 h = resizable_flip_node->from_size.y +
1391 (resizable_flip_node->to_size.y * progress);
1392 evas_map_point_coord_set(map, 0, x, y, 0);
1393 evas_map_point_coord_set(map, 1, x + w, y, 0);
1394 evas_map_point_coord_set(map, 2, x + w, y + h, 0);
1395 evas_map_point_coord_set(map, 3, x, y + h, 0);
1397 half_w = (Evas_Coord)(w / 2);
1398 half_h = (Evas_Coord)(h / 2);
1400 if (resizable_flip->axis == ELM_TRANSIT_EFFECT_FLIP_AXIS_Y)
1402 _set_image_uv_by_axis_y(map, resizable_flip_node, degree);
1403 evas_map_util_3d_rotate(map, 0, degree,
1404 0, x + half_w, y + half_h, 0);
1408 _set_image_uv_by_axis_x(map, resizable_flip_node, degree);
1409 evas_map_util_3d_rotate(map, degree, 0,
1410 0, x + half_w, y + half_h, 0);
1413 evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, _TRANSIT_FOCAL);
1414 evas_object_map_enable_set(resizable_flip_node->front, EINA_TRUE);
1415 evas_object_map_enable_set(resizable_flip_node->back, EINA_TRUE);
1416 evas_object_map_set(obj, map);
1421 static Elm_Transit_Effect *
1422 _transit_effect_resizable_flip_context_new(Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw)
1424 Elm_Transit_Effect_ResizableFlip *resizable_flip;
1426 resizable_flip = ELM_NEW(Elm_Transit_Effect_ResizableFlip);
1427 if (!resizable_flip) return NULL;
1429 resizable_flip->cw = cw;
1430 resizable_flip->axis = axis;
1432 return resizable_flip;
1435 EAPI Elm_Transit_Effect *
1436 elm_transit_effect_resizable_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw)
1438 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
1439 Elm_Transit_Effect *effect = _transit_effect_resizable_flip_context_new(axis, cw);
1443 ERR("Failed to allocate resizable_flip effect! : transit=%p", transit);
1446 elm_transit_effect_add(transit,
1447 _transit_effect_resizable_flip_op, effect,
1448 _transit_effect_resizable_flip_context_free);
1452 ///////////////////////////////////////////////////////////////////////////
1454 ///////////////////////////////////////////////////////////////////////////
1455 typedef struct _Elm_Transit_Effect_Wipe Elm_Transit_Effect_Wipe;
1457 struct _Elm_Transit_Effect_Wipe
1459 Elm_Transit_Effect_Wipe_Type type;
1460 Elm_Transit_Effect_Wipe_Dir dir;
1464 _elm_fx_wipe_hide(Evas_Map * map, Elm_Transit_Effect_Wipe_Dir dir, float x, float y, float w, float h, float progress)
1470 case ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT:
1471 w2 = w - (w * progress);
1473 evas_map_point_image_uv_set(map, 0, 0, 0);
1474 evas_map_point_image_uv_set(map, 1, w2, 0);
1475 evas_map_point_image_uv_set(map, 2, w2, h);
1476 evas_map_point_image_uv_set(map, 3, 0, h);
1477 evas_map_point_coord_set(map, 0, x, y, 0);
1478 evas_map_point_coord_set(map, 1, x + w2, y, 0);
1479 evas_map_point_coord_set(map, 2, x + w2, h2, 0);
1480 evas_map_point_coord_set(map, 3, x, h2, 0);
1482 case ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT:
1483 w2 = (w * progress);
1485 evas_map_point_image_uv_set(map, 0, w2, 0);
1486 evas_map_point_image_uv_set(map, 1, w, 0);
1487 evas_map_point_image_uv_set(map, 2, w, h);
1488 evas_map_point_image_uv_set(map, 3, w2, h);
1489 evas_map_point_coord_set(map, 0, x + w2, y, 0);
1490 evas_map_point_coord_set(map, 1, x + w, y, 0);
1491 evas_map_point_coord_set(map, 2, x + w, h2, 0);
1492 evas_map_point_coord_set(map, 3, x + w2, h2, 0);
1494 case ELM_TRANSIT_EFFECT_WIPE_DIR_UP:
1496 h2 = h - (h * progress);
1497 evas_map_point_image_uv_set(map, 0, 0, 0);
1498 evas_map_point_image_uv_set(map, 1, w, 0);
1499 evas_map_point_image_uv_set(map, 2, w, h2);
1500 evas_map_point_image_uv_set(map, 3, 0, h2);
1501 evas_map_point_coord_set(map, 0, x, y, 0);
1502 evas_map_point_coord_set(map, 1, w2, y, 0);
1503 evas_map_point_coord_set(map, 2, w2, y+h2, 0);
1504 evas_map_point_coord_set(map, 3, x, y+h2, 0);
1506 case ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN:
1508 h2 = (h * progress);
1509 evas_map_point_image_uv_set(map, 0, 0, h2);
1510 evas_map_point_image_uv_set(map, 1, w, h2);
1511 evas_map_point_image_uv_set(map, 2, w, h);
1512 evas_map_point_image_uv_set(map, 3, 0, h);
1513 evas_map_point_coord_set(map, 0, x, y + h2, 0);
1514 evas_map_point_coord_set(map, 1, w2, y + h2, 0);
1515 evas_map_point_coord_set(map, 2, w2, y + h, 0);
1516 evas_map_point_coord_set(map, 3, x, y + h, 0);
1521 evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, _TRANSIT_FOCAL);
1525 _elm_fx_wipe_show(Evas_Map *map, Elm_Transit_Effect_Wipe_Dir dir, float x, float y, float w, float h, float progress)
1531 case ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT:
1532 w2 = (w - (w * progress));
1534 evas_map_point_image_uv_set(map, 0, w2, 0);
1535 evas_map_point_image_uv_set(map, 1, w, 0);
1536 evas_map_point_image_uv_set(map, 2, w, h);
1537 evas_map_point_image_uv_set(map, 3, w2, h);
1538 evas_map_point_coord_set(map, 0, x + w2, y, 0);
1539 evas_map_point_coord_set(map, 1, w, y, 0);
1540 evas_map_point_coord_set(map, 2, w, h2, 0);
1541 evas_map_point_coord_set(map, 3, x + w2, h2, 0);
1543 case ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT:
1544 w2 = (w * progress);
1546 evas_map_point_image_uv_set(map, 0, 0, 0);
1547 evas_map_point_image_uv_set(map, 1, w2, 0);
1548 evas_map_point_image_uv_set(map, 2, w2, h);
1549 evas_map_point_image_uv_set(map, 3, 0, h);
1550 evas_map_point_coord_set(map, 0, x, y, 0);
1551 evas_map_point_coord_set(map, 1, x + w2, y, 0);
1552 evas_map_point_coord_set(map, 2, x + w2, h2, 0);
1553 evas_map_point_coord_set(map, 3, x, h2, 0);
1555 case ELM_TRANSIT_EFFECT_WIPE_DIR_UP:
1557 h2 = (h - (h * progress));
1558 evas_map_point_image_uv_set(map, 0, 0, h2);
1559 evas_map_point_image_uv_set(map, 1, w, h2);
1560 evas_map_point_image_uv_set(map, 2, w, h);
1561 evas_map_point_image_uv_set(map, 3, 0, h);
1562 evas_map_point_coord_set(map, 0, x, y + h2, 0);
1563 evas_map_point_coord_set(map, 1, w2, y + h2, 0);
1564 evas_map_point_coord_set(map, 2, w2, y + h, 0);
1565 evas_map_point_coord_set(map, 3, x, y + h, 0);
1567 case ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN:
1569 h2 = (h * progress);
1570 evas_map_point_image_uv_set(map, 0, 0, 0);
1571 evas_map_point_image_uv_set(map, 1, w, 0);
1572 evas_map_point_image_uv_set(map, 2, w, h2);
1573 evas_map_point_image_uv_set(map, 3, 0, h2);
1574 evas_map_point_coord_set(map, 0, x, y, 0);
1575 evas_map_point_coord_set(map, 1, w2, y, 0);
1576 evas_map_point_coord_set(map, 2, w2, y + h2, 0);
1577 evas_map_point_coord_set(map, 3, x, y + h2, 0);
1582 evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, _TRANSIT_FOCAL);
1586 _transit_effect_wipe_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit)
1588 EINA_SAFETY_ON_NULL_RETURN(effect);
1589 EINA_SAFETY_ON_NULL_RETURN(transit);
1592 Elm_Transit_Effect_Wipe *wipe = effect;
1593 Eina_Bool reverse = elm_transit_auto_reverse_get(transit);
1595 EINA_LIST_FOREACH(transit->objs, elist, obj)
1597 if ((wipe->type == ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW && !reverse)
1598 || (wipe->type == ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE && reverse))
1599 evas_object_show(obj);
1600 else evas_object_hide(obj);
1601 evas_object_map_enable_set(obj, EINA_FALSE);
1608 _transit_effect_wipe_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
1610 EINA_SAFETY_ON_NULL_RETURN(effect);
1611 EINA_SAFETY_ON_NULL_RETURN(transit);
1612 Elm_Transit_Effect_Wipe *wipe = effect;
1614 Evas_Coord _x, _y, _w, _h;
1618 map = evas_map_new(4);
1621 EINA_LIST_FOREACH(transit->objs, elist, obj)
1623 evas_object_geometry_get(obj, &_x, &_y, &_w, &_h);
1625 if (wipe->type == ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW)
1626 _elm_fx_wipe_show(map, wipe->dir, _x, _y, _w, _h, (float)progress);
1628 _elm_fx_wipe_hide(map, wipe->dir, _x, _y, _w, _h, (float)progress);
1630 evas_object_map_enable_set(obj, EINA_TRUE);
1631 evas_object_map_set(obj, map);
1636 static Elm_Transit_Effect *
1637 _transit_effect_wipe_context_new(Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir)
1639 Elm_Transit_Effect_Wipe *wipe;
1641 wipe = ELM_NEW(Elm_Transit_Effect_Wipe);
1642 if (!wipe) return NULL;
1651 elm_transit_effect_wipe_add(Elm_Transit *transit, Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir)
1653 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
1654 void *effect = _transit_effect_wipe_context_new(type, dir);
1658 ERR("Failed to allocate wipe effect! : transit=%p", transit);
1661 elm_transit_effect_add(transit,
1662 _transit_effect_wipe_op, effect,
1663 _transit_effect_wipe_context_free);
1667 ///////////////////////////////////////////////////////////////////////////
1669 ///////////////////////////////////////////////////////////////////////////
1670 typedef struct _Elm_Transit_Effect_Color Elm_Transit_Effect_Color;
1672 struct _Elm_Transit_Effect_Color
1674 struct _unsigned_color {
1675 unsigned int r, g, b, a;
1677 struct _signed_color {
1683 _transit_effect_color_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
1685 Elm_Transit_Effect_Color *color = effect;
1690 _transit_effect_color_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
1692 EINA_SAFETY_ON_NULL_RETURN(effect);
1693 EINA_SAFETY_ON_NULL_RETURN(transit);
1694 Elm_Transit_Effect_Color *color = effect;
1697 unsigned int r, g, b, a;
1699 r = (color->from.r + (int)((float)color->to.r * progress));
1700 g = (color->from.g + (int)((float)color->to.g * progress));
1701 b = (color->from.b + (int)((float)color->to.b * progress));
1702 a = (color->from.a + (int)((float)color->to.a * progress));
1704 EINA_LIST_FOREACH(transit->objs, elist, obj)
1705 evas_object_color_set(obj, r, g, b, a);
1708 static Elm_Transit_Effect *
1709 _transit_effect_color_context_new(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)
1711 Elm_Transit_Effect_Color *color;
1713 color = ELM_NEW(Elm_Transit_Effect_Color);
1714 if (!color) return NULL;
1716 color->from.r = from_r;
1717 color->from.g = from_g;
1718 color->from.b = from_b;
1719 color->from.a = from_a;
1720 color->to.r = to_r - from_r;
1721 color->to.g = to_g - from_g;
1722 color->to.b = to_b - from_b;
1723 color->to.a = to_a - from_a;
1728 EAPI Elm_Transit_Effect *
1729 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)
1731 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
1732 Elm_Transit_Effect *effect = _transit_effect_color_context_new(from_r, from_g, from_b, from_a, to_r, to_g, to_b, to_a);
1736 ERR("Failed to allocate color effect! : transit=%p", transit);
1739 elm_transit_effect_add(transit,
1740 _transit_effect_color_op, effect,
1741 _transit_effect_color_context_free);
1745 ///////////////////////////////////////////////////////////////////////////
1747 ///////////////////////////////////////////////////////////////////////////
1748 typedef struct _Elm_Transit_Effect_Fade Elm_Transit_Effect_Fade;
1749 typedef struct _Elm_Transit_Effect_Fade_Node Elm_Transit_Effect_Fade_Node;
1751 struct _Elm_Transit_Effect_Fade_Node
1753 Evas_Object *before;
1755 struct _signed_color before_color, after_color;
1758 Eina_Bool inversed : 1;
1761 struct _Elm_Transit_Effect_Fade
1767 _fade_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1769 Elm_Transit_Effect_Fade *fade = data;
1771 Elm_Transit_Effect_Fade_Node *fade_node;
1773 EINA_LIST_FOREACH(fade->nodes, elist, fade_node)
1775 if (fade_node->before == obj)
1776 evas_object_event_callback_del(fade_node->after,
1777 EVAS_CALLBACK_DEL, _fade_object_del_cb);
1778 else if (fade_node->after == obj)
1779 evas_object_event_callback_del(fade_node->before,
1780 EVAS_CALLBACK_DEL, _fade_object_del_cb);
1783 fade->nodes = eina_list_remove_list(fade->nodes, elist);
1790 _fade_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Fade *fade_data)
1792 Elm_Transit_Effect_Fade_Node *fade;
1793 Eina_List *data_list = NULL;
1796 count = eina_list_count(transit->objs);
1797 for (i = 0; i < count; i += 2)
1799 fade = ELM_NEW(Elm_Transit_Effect_Fade_Node);
1802 eina_list_free(data_list);
1806 fade->before = eina_list_nth(transit->objs, i);
1807 fade->after = eina_list_nth(transit->objs, i+1);
1809 evas_object_color_get(fade->before,
1810 &fade->before_color.r, &fade->before_color.g,
1811 &fade->before_color.b, &fade->before_color.a);
1812 evas_object_color_get(fade->after,
1813 &fade->after_color.r, &fade->after_color.g,
1814 &fade->after_color.b, &fade->after_color.a);
1816 fade->before_alpha = (255 - fade->before_color.a);
1817 fade->after_alpha = (255 - fade->after_color.a);
1819 data_list = eina_list_append(data_list, fade);
1821 evas_object_event_callback_add(fade->before,
1822 EVAS_CALLBACK_DEL, _fade_object_del_cb, fade_data);
1823 evas_object_event_callback_add(fade->after,
1824 EVAS_CALLBACK_DEL, _fade_object_del_cb, fade_data);
1830 _transit_effect_fade_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
1832 EINA_SAFETY_ON_NULL_RETURN(effect);
1833 Elm_Transit_Effect_Fade *fade = effect;
1834 Elm_Transit_Effect_Fade_Node *fade_node;
1835 Eina_List *elist, *elist_next;
1837 EINA_LIST_FOREACH_SAFE(fade->nodes, elist, elist_next, fade_node)
1839 evas_object_color_set(fade_node->before, fade_node->before_color.r,
1840 fade_node->before_color.g,
1841 fade_node->before_color.b,
1842 fade_node->before_color.a);
1843 evas_object_color_set(fade_node->after, fade_node->after_color.r,
1844 fade_node->after_color.g,
1845 fade_node->after_color.b,
1846 fade_node->after_color.a);
1848 fade->nodes = eina_list_remove_list(fade->nodes, elist);
1849 evas_object_event_callback_del(fade_node->before,
1850 EVAS_CALLBACK_DEL, _fade_object_del_cb);
1851 evas_object_event_callback_del(fade_node->after,
1852 EVAS_CALLBACK_DEL, _fade_object_del_cb);
1860 _transit_effect_fade_op(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__, double progress)
1862 EINA_SAFETY_ON_NULL_RETURN(effect);
1863 Elm_Transit_Effect_Fade *fade = effect;
1865 Elm_Transit_Effect_Fade_Node *fade_node;
1869 fade->nodes = _fade_nodes_build(transit, fade);
1871 EINA_LIST_FOREACH(fade->nodes, elist, fade_node)
1875 if (!fade_node->inversed)
1877 evas_object_hide(fade_node->after);
1878 evas_object_show(fade_node->before);
1879 fade_node->inversed = EINA_TRUE;
1882 _progress = (1 - (progress * 2));
1884 evas_object_color_set(fade_node->before,
1885 fade_node->before_color.r * _progress,
1886 fade_node->before_color.g * _progress,
1887 fade_node->before_color.b * _progress,
1888 fade_node->before_color.a +
1889 fade_node->before_alpha * (1 - _progress));
1893 if (fade_node->inversed)
1895 evas_object_hide(fade_node->before);
1896 evas_object_show(fade_node->after);
1897 fade_node->inversed = EINA_FALSE;
1900 _progress = ((progress - 0.5) * 2);
1902 evas_object_color_set(fade_node->after,
1903 fade_node->after_color.r * _progress,
1904 fade_node->after_color.g * _progress,
1905 fade_node->after_color.b * _progress,
1906 fade_node->after_color.a +
1907 fade_node->after_alpha * (1 - _progress));
1912 static Elm_Transit_Effect *
1913 _transit_effect_fade_context_new(void)
1915 Elm_Transit_Effect_Fade *fade;
1916 fade = ELM_NEW(Elm_Transit_Effect_Fade);
1917 if (!fade) return NULL;
1921 EAPI Elm_Transit_Effect *
1922 elm_transit_effect_fade_add(Elm_Transit *transit)
1924 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
1926 Elm_Transit_Effect *effect = _transit_effect_fade_context_new();
1930 ERR("Failed to allocate fade effect! : transit=%p", transit);
1933 elm_transit_effect_add(transit,
1934 _transit_effect_fade_op, effect,
1935 _transit_effect_fade_context_free);
1939 ///////////////////////////////////////////////////////////////////////////
1941 ///////////////////////////////////////////////////////////////////////////
1942 typedef struct _Elm_Transit_Effect_Blend Elm_Transit_Effect_Blend;
1943 typedef struct _Elm_Transit_Effect_Blend_Node Elm_Transit_Effect_Blend_Node;
1945 struct _Elm_Transit_Effect_Blend_Node
1947 Evas_Object *before;
1949 struct _signed_color from, to;
1952 struct _Elm_Transit_Effect_Blend
1958 _blend_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1960 Elm_Transit_Effect_Blend *blend = data;
1962 Elm_Transit_Effect_Blend_Node *blend_node;
1964 EINA_LIST_FOREACH(blend->nodes, elist, blend_node)
1966 if (blend_node->after == obj)
1967 evas_object_event_callback_del(blend_node->before,
1968 EVAS_CALLBACK_DEL, _blend_object_del_cb);
1969 else if (blend_node->before == obj)
1970 evas_object_event_callback_del(blend_node->after,
1971 EVAS_CALLBACK_DEL, _blend_object_del_cb);
1974 blend->nodes = eina_list_remove_list(blend->nodes, elist);
1981 _blend_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Blend *blend)
1983 Elm_Transit_Effect_Blend_Node *blend_node;
1984 Eina_List *data_list = NULL;
1987 count = eina_list_count(transit->objs);
1988 for (i = 0; i < (count - 1); i += 2)
1990 blend_node = ELM_NEW(Elm_Transit_Effect_Blend_Node);
1993 eina_list_free(data_list);
1997 blend_node->before = eina_list_nth(transit->objs, i);
1998 blend_node->after = eina_list_nth(transit->objs, i + 1);
1999 evas_object_show(blend_node->before);
2000 evas_object_show(blend_node->after);
2002 evas_object_color_get(blend_node->before, &blend_node->from.r,
2003 &blend_node->from.g, &blend_node->from.b,
2004 &blend_node->from.a);
2005 evas_object_color_get(blend_node->after, &blend_node->to.r,
2006 &blend_node->to.g, &blend_node->to.b,
2009 data_list = eina_list_append(data_list, blend_node);
2011 evas_object_event_callback_add(blend_node->before,
2012 EVAS_CALLBACK_DEL, _blend_object_del_cb, blend);
2013 evas_object_event_callback_add(blend_node->after,
2014 EVAS_CALLBACK_DEL, _blend_object_del_cb, blend);
2020 _transit_effect_blend_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
2022 EINA_SAFETY_ON_NULL_RETURN(effect);
2023 Elm_Transit_Effect_Blend *blend = effect;
2024 Elm_Transit_Effect_Blend_Node *blend_node;
2025 Eina_List *elist, *elist_next;
2027 EINA_LIST_FOREACH_SAFE(blend->nodes, elist, elist_next, blend_node)
2029 evas_object_color_set(blend_node->before,
2030 blend_node->from.r, blend_node->from.g,
2031 blend_node->from.b, blend_node->from.a);
2032 evas_object_color_set(blend_node->after, blend_node->to.r,
2033 blend_node->to.g, blend_node->to.b,
2036 if (elm_transit_auto_reverse_get(transit))
2037 evas_object_hide(blend_node->after);
2039 evas_object_hide(blend_node->before);
2041 blend->nodes = eina_list_remove_list(blend->nodes, elist);
2043 evas_object_event_callback_del(blend_node->before,
2044 EVAS_CALLBACK_DEL, _blend_object_del_cb);
2045 evas_object_event_callback_del(blend_node->after,
2046 EVAS_CALLBACK_DEL, _blend_object_del_cb);
2053 _transit_effect_blend_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
2055 EINA_SAFETY_ON_NULL_RETURN(effect);
2056 EINA_SAFETY_ON_NULL_RETURN(transit);
2057 Elm_Transit_Effect_Blend *blend = effect;
2058 Elm_Transit_Effect_Blend_Node *blend_node;
2061 if (!blend->nodes) blend->nodes = _blend_nodes_build(transit, blend);
2063 EINA_LIST_FOREACH(blend->nodes, elist, blend_node)
2065 evas_object_color_set(blend_node->before,
2066 (int)(blend_node->from.r * (1 - progress)),
2067 (int)(blend_node->from.g * (1 - progress)),
2068 (int)(blend_node->from.b * (1 - progress)),
2069 (int)(blend_node->from.a * (1 - progress)));
2070 evas_object_color_set(blend_node->after,
2071 (int)(blend_node->to.r * progress),
2072 (int)(blend_node->to.g * progress),
2073 (int)(blend_node->to.b * progress),
2074 (int)(blend_node->to.a * progress));
2078 static Elm_Transit_Effect *
2079 _transit_effect_blend_context_new(void)
2081 Elm_Transit_Effect_Blend *blend;
2083 blend = ELM_NEW(Elm_Transit_Effect_Blend);
2084 if (!blend) return NULL;
2088 EAPI Elm_Transit_Effect *
2089 elm_transit_effect_blend_add(Elm_Transit *transit)
2091 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
2092 Elm_Transit_Effect *effect = _transit_effect_blend_context_new();
2096 ERR("Failed to allocate blend effect! : transit=%p", transit);
2099 elm_transit_effect_add(transit,
2100 _transit_effect_blend_op, effect,
2101 _transit_effect_blend_context_free);
2105 ///////////////////////////////////////////////////////////////////////////
2107 ///////////////////////////////////////////////////////////////////////////
2108 typedef struct _Elm_Transit_Effect_Rotation Elm_Transit_Effect_Rotation;
2110 struct _Elm_Transit_Effect_Rotation
2116 _transit_effect_rotation_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
2118 Elm_Transit_Effect_Rotation *rotation = effect;
2123 _transit_effect_rotation_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
2125 EINA_SAFETY_ON_NULL_RETURN(effect);
2126 EINA_SAFETY_ON_NULL_RETURN(transit);
2127 Elm_Transit_Effect_Rotation *rotation = effect;
2129 Evas_Coord x, y, w, h;
2131 float half_w, half_h;
2135 map = evas_map_new(4);
2138 EINA_LIST_FOREACH(transit->objs, elist, obj)
2140 evas_map_util_points_populate_from_object_full(map, obj, 0);
2141 degree = rotation->from + (float)(progress * rotation->to);
2143 evas_object_geometry_get(obj, &x, &y, &w, &h);
2145 half_w = (float)w * 0.5;
2146 half_h = (float)h * 0.5;
2148 evas_map_util_rotate(map, degree, x + half_w, y + half_h);
2149 evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, _TRANSIT_FOCAL);
2150 evas_object_map_enable_set(obj, EINA_TRUE);
2151 evas_object_map_set(obj, map);
2156 static Elm_Transit_Effect *
2157 _transit_effect_rotation_context_new(float from_degree, float to_degree)
2159 Elm_Transit_Effect_Rotation *rotation;
2161 rotation = ELM_NEW(Elm_Transit_Effect_Rotation);
2162 if (!rotation) return NULL;
2164 rotation->from = from_degree;
2165 rotation->to = to_degree - from_degree;
2170 EAPI Elm_Transit_Effect *
2171 elm_transit_effect_rotation_add(Elm_Transit *transit, float from_degree, float to_degree)
2173 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
2174 Elm_Transit_Effect *effect = _transit_effect_rotation_context_new(from_degree, to_degree);
2178 ERR("Failed to allocate rotation effect! : transit=%p", transit);
2181 elm_transit_effect_add(transit,
2182 _transit_effect_rotation_op, effect,
2183 _transit_effect_rotation_context_free);
2187 ///////////////////////////////////////////////////////////////////////////
2188 //ImageAnimation Effect
2189 ///////////////////////////////////////////////////////////////////////////
2190 typedef struct _Elm_Transit_Effect_Image_Animation Elm_Transit_Effect_Image_Animation;
2192 struct _Elm_Transit_Effect_Image_Animation
2198 _transit_effect_image_animation_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__)
2200 EINA_SAFETY_ON_NULL_RETURN(effect);
2201 Elm_Transit_Effect_Image_Animation *image_animation = effect;
2203 Eina_List *elist, *elist_next;
2205 EINA_LIST_FOREACH_SAFE(image_animation->images, elist, elist_next, image)
2207 image_animation->images =
2208 eina_list_remove_list(image_animation->images, elist);
2209 eina_stringshare_del(image);
2212 free(image_animation);
2216 _transit_effect_image_animation_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
2218 EINA_SAFETY_ON_NULL_RETURN(effect);
2219 EINA_SAFETY_ON_NULL_RETURN(transit);
2223 Elm_Transit_Effect_Image_Animation *image_animation = effect;
2224 unsigned int count = 0;
2227 type = eina_stringshare_add("icon");
2228 len = eina_list_count(image_animation->images);
2230 if (!len) count = floor(progress * len);
2231 else count = floor(progress * (len - 1));
2233 EINA_LIST_FOREACH(transit->objs, elist, obj)
2235 if (elm_widget_type_check(obj, type, __func__))
2236 elm_icon_file_set(obj,
2237 eina_list_nth(image_animation->images, count), NULL);
2240 eina_stringshare_del(type);
2243 static Elm_Transit_Effect *
2244 _transit_effect_image_animation_context_new(Eina_List *images)
2246 Elm_Transit_Effect_Image_Animation *image_animation;
2247 image_animation = ELM_NEW(Elm_Transit_Effect_Image_Animation);
2249 if (!image_animation) return NULL;
2250 image_animation->images = images;
2251 return image_animation;
2254 EAPI Elm_Transit_Effect *
2255 elm_transit_effect_image_animation_add(Elm_Transit *transit, Eina_List *images)
2257 ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
2258 Elm_Transit_Effect *effect = _transit_effect_image_animation_context_new(images);
2262 ERR("Failed to allocate image_animation effect! : transit=%p", transit);
2265 elm_transit_effect_add(transit,
2266 _transit_effect_image_animation_op, effect,
2267 _transit_effect_image_animation_context_free);