From f9fe9254a6d2460245cf49ee9b03f724706095a5 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Thu, 16 Dec 2010 07:53:42 +0000 Subject: [PATCH] From: ChunEon Park MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 003_elm_transit.diff.txt (made all effect context APIs private. But expose each one façade API to use easy.) SVN revision: 55579 --- src/bin/test_transit.c | 87 +-- src/lib/Elementary.h.in | 54 +- src/lib/elm_transit.c | 1226 +++++++++++++++------------------------ 3 files changed, 489 insertions(+), 878 deletions(-) diff --git a/src/bin/test_transit.c b/src/bin/test_transit.c index a4cd088f7..c82467bb7 100644 --- a/src/bin/test_transit.c +++ b/src/bin/test_transit.c @@ -68,7 +68,6 @@ static void _transit_rotation_translation_color(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; trans = elm_transit_add(5.0); elm_transit_object_add(trans, obj); @@ -76,44 +75,27 @@ _transit_rotation_translation_color(void *data __UNUSED__, Evas_Object *obj, voi elm_transit_repeat_times_set(trans, 2); /* Translation Effect */ - effect_context = elm_transit_effect_translation_context_new(-70.0, -150.0, - 70.0, 150.0); - elm_transit_effect_add(trans, - elm_transit_effect_translation_op, effect_context, - elm_transit_effect_translation_context_free); + elm_transit_effect_translation_add(trans, -70.0, -150.0, 70.0, 150.0); /* Color Effect */ - effect_context = elm_transit_effect_color_context_new(100, 255, 100, - 255, 200, 50, 200, 50); - elm_transit_effect_add(trans, - elm_transit_effect_color_op, effect_context, - elm_transit_effect_color_context_free); + elm_transit_effect_color_add(trans, 100, 255, 100, 255, 200, 50, 200, 50); /* Rotation Effect */ - effect_context = elm_transit_effect_rotation_context_new(0.0, - 135.0, EINA_FALSE); - elm_transit_effect_add(trans, - elm_transit_effect_rotation_op, effect_context, - elm_transit_effect_rotation_context_free); - + elm_transit_effect_rotation_add(trans, 0.0, 135.0, EINA_FALSE); } static void _transit_wipe(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; trans = elm_transit_add(5.0); elm_transit_object_add(trans, obj); elm_transit_auto_reverse_set(trans, EINA_TRUE); - effect_context = \ - elm_transit_effect_wipe_context_new(ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE, - ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT); - elm_transit_effect_add(trans, - elm_transit_effect_wipe_op, effect_context, - elm_transit_effect_wipe_context_free); + elm_transit_effect_wipe_add(trans, + ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE, + ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT); } static void @@ -123,7 +105,6 @@ _transit_image_animation(void *data, Evas_Object *obj __UNUSED__, void *event_in char buf[PATH_MAX]; Elm_Transit *trans; Evas_Object *ic = data; - void *effect_context; snprintf(buf, sizeof(buf), "%s/images/icon_19.png", PACKAGE_DATA_DIR); images = eina_list_append(images, eina_stringshare_add(buf)); @@ -139,109 +120,75 @@ _transit_image_animation(void *data, Evas_Object *obj __UNUSED__, void *event_in trans = elm_transit_add(5.0); elm_transit_object_add(trans, ic); - - effect_context = \ - elm_transit_effect_image_animation_context_new(images); - elm_transit_effect_add(trans, - elm_transit_effect_image_animation_op, effect_context, - elm_transit_effect_image_animation_context_free); + + elm_transit_effect_image_animation_add(trans, images); } static void -_transit_resizing(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +_transit_resizing(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; trans = elm_transit_add(5.0); - effect_context = elm_transit_effect_resizing_context_new(100, 50, 300, 150); - - elm_transit_object_add(trans, obj); - elm_transit_effect_add(trans, - elm_transit_effect_resizing_op, effect_context, - elm_transit_effect_resizing_context_free); + + elm_transit_effect_resizing_add(trans, 100, 50, 300, 150); } static void _transit_flip(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; Evas_Object *obj2 = data; trans = elm_transit_add(5.0); elm_transit_object_add(trans, obj); elm_transit_object_add(trans, obj2); - effect_context = elm_transit_effect_flip_context_new( - ELM_TRANSIT_EFFECT_FLIP_AXIS_X, - EINA_TRUE); - elm_transit_effect_add(trans, - elm_transit_effect_flip_op, effect_context, - elm_transit_effect_flip_context_free); + elm_transit_effect_flip_add(trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_X, EINA_TRUE); } static void -_transit_zoom(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +_transit_zoom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; trans = elm_transit_add(5.0); - elm_transit_object_add(trans, obj); - effect_context = elm_transit_effect_zoom_context_new(1.0, 3.0); - elm_transit_effect_add(trans, - elm_transit_effect_zoom_op, effect_context, - elm_transit_effect_zoom_context_free); + elm_transit_effect_zoom_add(trans, 1.0, 3.0); } static void _transit_blend(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; Evas_Object *obj2 = data; trans = elm_transit_add(5.0); elm_transit_object_add(trans, obj); elm_transit_object_add(trans, obj2); - effect_context = elm_transit_effect_blend_context_new(); - elm_transit_effect_add(trans, - elm_transit_effect_blend_op, effect_context, - elm_transit_effect_blend_context_free); + elm_transit_effect_blend_add(trans); } static void _transit_fade(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; Evas_Object *obj2 = data; trans = elm_transit_add(5.0); elm_transit_object_add(trans, obj); elm_transit_object_add(trans, obj2); - effect_context = elm_transit_effect_fade_context_new(); - elm_transit_effect_add(trans, - elm_transit_effect_fade_op, effect_context, - elm_transit_effect_fade_context_free); + elm_transit_effect_fade_add(trans); } static void _transit_resizable_flip(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Elm_Transit *trans; - void *effect_context; Evas_Object *obj2 = data; trans = elm_transit_add(5.0); elm_transit_object_add(trans, obj); elm_transit_object_add(trans, obj2); - effect_context = elm_transit_effect_resizable_flip_context_new( - ELM_TRANSIT_EFFECT_FLIP_AXIS_Y, - EINA_TRUE); - elm_transit_effect_add(trans, - elm_transit_effect_resizable_flip_op, effect_context, - elm_transit_effect_resizable_flip_context_free); + elm_transit_effect_resizable_flip_add(trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_Y, EINA_TRUE); } /* Translation, Rotation, Color, Wipe, ImagemAnimation Effect */ diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index d00cfaf5f..0459d3553 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -2475,49 +2475,17 @@ extern "C" { EAPI void elm_transit_tween_mode_set(Elm_Transit *transit, Elm_Transit_Tween_Mode tween_mode) EINA_ARG_NONNULL(1); EAPI Elm_Transit_Tween_Mode elm_transit_tween_mode_get(const Elm_Transit *transit) EINA_ARG_NONNULL(1) EINA_ARG_NONNULL(1); - EAPI void *elm_transit_effect_resizing_context_new(Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h); - EAPI void elm_transit_effect_resizing_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_resizing_context_free(void *data, Elm_Transit *transit); - - EAPI void *elm_transit_effect_translation_context_new(Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy); - EAPI void elm_transit_effect_translation_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_translation_context_free(void *data, Elm_Transit *transit) EINA_ARG_NONNULL(1); - - EAPI void *elm_transit_effect_zoom_context_new(float from_rate, float to_rate); - EAPI void elm_transit_effect_zoom_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_zoom_context_free(void *data, Elm_Transit *transit); - - EAPI void *elm_transit_effect_flip_context_new(Elm_Fx_Flip_Axis axis, Eina_Bool cw); - EAPI void elm_transit_effect_flip_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_flip_context_free(void *data, Elm_Transit *transit) EINA_ARG_NONNULL(1, 2); - - EAPI void *elm_transit_effect_resizable_flip_context_new(Elm_Fx_Flip_Axis axis, Eina_Bool cw); - EAPI void elm_transit_effect_resizable_flip_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1); - EAPI void elm_transit_effect_resizable_flip_context_free(void *data, Elm_Transit *transit) EINA_ARG_NONNULL(1); - - EAPI void *elm_transit_effect_wipe_context_new(Elm_Fx_Wipe_Type type, Elm_Fx_Wipe_Dir dir); - EAPI void elm_transit_effect_wipe_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_wipe_context_free(void *data, Elm_Transit *transit) EINA_ARG_NONNULL(1, 2); - - EAPI void *elm_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); - EAPI void elm_transit_effect_color_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_color_context_free(void *data, Elm_Transit *transit); - - EAPI void *elm_transit_effect_fade_context_new(void); - EAPI void elm_transit_effect_fade_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1); - EAPI void elm_transit_effect_fade_context_free(void *data, Elm_Transit *tranasit) EINA_ARG_NONNULL(1); - - EAPI void *elm_transit_effect_blend_context_new(void); - EAPI void elm_transit_effect_blend_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_blend_context_free(void *data, Elm_Transit *transit) EINA_ARG_NONNULL(1); - - EAPI void *elm_transit_effect_rotation_context_new(float from_degree, float to_degree, Eina_Bool cw); - EAPI void elm_transit_effect_rotation_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_rotation_context_free(void *data, Elm_Transit *transit); - - EAPI void *elm_transit_effect_image_animation_context_new(Eina_List *images); - EAPI void elm_transit_effect_image_animation_op(void *data, Elm_Transit *transit, double progress) EINA_ARG_NONNULL(1, 2); - EAPI void elm_transit_effect_image_animation_context_free(void *data, Elm_Transit *transit) EINA_ARG_NONNULL(1); + EAPI void *elm_transit_effect_resizing_add(Elm_Transit* transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h); + EAPI void *elm_transit_effect_translation_add(Elm_Transit* transit, Evas_Coord from_dx, Evas_Coord dy, Evas_Coord to_dx, Evas_Coord to_dy); + EAPI void *elm_transit_effect_zoom_add(Elm_Transit *transit, float from_rate, float to_rate); + EAPI void *elm_transit_effect_flip_add(Elm_Transit *transit, Elm_Fx_Flip_Axis axis, Eina_Bool cw); + EAPI void *elm_transit_effect_resizable_flip_add(Elm_Transit *transit, Elm_Fx_Flip_Axis axis, Eina_Bool cw); + EAPI void *elm_transit_effect_wipe_add(Elm_Transit *transit, Elm_Fx_Wipe_Type type, Elm_Fx_Wipe_Dir dir); + EAPI void *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); + EAPI void *elm_transit_effect_fade_add(Elm_Transit *transit); + EAPI void *elm_transit_effect_blend_add(Elm_Transit *transit); + EAPI void *elm_transit_effect_rotation_add(Elm_Transit *transit, float from_degree, float to_degree, Eina_Bool cw); + EAPI void *elm_transit_effect_image_animation_add(Elm_Transit *transit, Eina_List *images); typedef struct _Elm_Store Elm_Store; typedef struct _Elm_Store_Filesystem Elm_Store_Filesystem; diff --git a/src/lib/elm_transit.c b/src/lib/elm_transit.c index 1b4a3d361..4832eabe8 100644 --- a/src/lib/elm_transit.c +++ b/src/lib/elm_transit.c @@ -784,55 +784,14 @@ struct _Elm_Fx_Resizing } from, to; }; -/** - * The Free function to Resizing Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Risizing effect, which consists of functions: - * - elm_transit_effect_resizing_context_new() - * - elm_transit_effect_resizing_op() - * - elm_transit_effect_resizing_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Resizing context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_resizing_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_resizing_context_free(void *data, Elm_Transit *transit __UNUSED__) { free(data); } -/** - * Operation function to the Resizing Effect. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note This effect will be applied to the objects that are in the transit, - * If you change the set of objects in the transit with elm_transit_object_add() - * or elm_transit_object_remove(), the set of objects affected by this effect - * will be changed too. - * - * This function belongs to the Risizing effect, which consists of functions: - * - elm_transit_effect_resizing_context_new() - * - elm_transit_effect_resizing_op() - * - elm_transit_effect_resizing_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Resizing context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_resizing_op(void *data, Elm_Transit *transit, double progress) +void +_transit_effect_resizing_op(void *data, Elm_Transit *transit, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -851,16 +810,35 @@ elm_transit_effect_resizing_op(void *data, Elm_Transit *transit, double progress evas_object_resize(obj, w, h); } +void * +_transit_effect_resizing_context_new(Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h) +{ + Elm_Fx_Resizing *resizing; + + resizing = ELM_NEW(Elm_Fx_Resizing); + if (!resizing) return NULL; + + resizing->from.w = from_w; + resizing->from.h = from_h; + resizing->to.w = to_w - from_w; + resizing->to.h = to_h - from_h; + + return resizing; +} + /** - * Get a new context data of Resizing Effect. + * Add the Resizing Effect to Elm_Transit. * - * This function belongs to the Risizing effect, which consists of functions: - * - elm_transit_effect_resizing_context_new() - * - elm_transit_effect_resizing_op() - * - elm_transit_effect_resizing_context_free() + * @note This API is one of the facades. It creates resizing effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect will be applied to the objects that are in the transit, + * @note If you change the set of objects in the transit with elm_transit_object_add() + * or elm_transit_object_remove(), the set of objects affected by this effect + * will be changed too. * * @see elm_transit_effect_add() * + * @param transit Transit object. * @param from_w Object width size when effect begins. * @param from_h Object height size when effect begins. * @param to_w Object width size when effect ends. @@ -868,21 +846,18 @@ elm_transit_effect_resizing_op(void *data, Elm_Transit *transit, double progress * @return Resizing effect context data. * * @ingroup Transit - */ +*/ EAPI void * -elm_transit_effect_resizing_context_new(Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h) +elm_transit_effect_resizing_add(Elm_Transit *transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h) { - Elm_Fx_Resizing *resizing; - - resizing = ELM_NEW(Elm_Fx_Resizing); - if (!resizing) return NULL; - - resizing->from.w = from_w; - resizing->from.h = from_h; - resizing->to.w = to_w - from_w; - resizing->to.h = to_h - from_h; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return resizing; + void *effect_context = _transit_effect_resizing_context_new(from_w, from_h, to_w, to_h); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_resizing_op, effect_context, + _transit_effect_resizing_context_free); + return effect_context; } /////////////////////////////////////////////////////////////////////////////// @@ -952,26 +927,8 @@ _translation_nodes_build(Elm_Transit *transit, Elm_Fx_Translation *translation) return data_list; } -/** - * The Free function to Translation Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Translation effect, which consists of functions: - * - elm_transit_effect_translation_context_new() - * - elm_transit_effect_translation_op() - * - elm_transit_effect_translation_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Translation context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_translation_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_translation_context_free(void *data, Elm_Transit *transit __UNUSED__) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -990,35 +947,8 @@ elm_transit_effect_translation_context_free(void *data, Elm_Transit *transit __U free(translation); } -/** - * Operation function to the Translation Effect. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note When this function begins to be called, it gets the current objects in - * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() - * will not cause any changes in the set of objects that this effect is being - * applied if these functions are called after the @p transit starts to run. - * - * This function belongs to the Translation effect, which consists of functions: - * - elm_transit_effect_translation_context_new() - * - elm_transit_effect_translation_op() - * - elm_transit_effect_translation_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Translation context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the geometry information about the objects, - * and if the window was not created yet, it can get a wrong information. - */ -EAPI void -elm_transit_effect_translation_op(void *data, Elm_Transit *transit, double progress __UNUSED__) +void +_transit_effect_translation_op(void *data, Elm_Transit *transit, double progress __UNUSED__) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -1042,16 +972,36 @@ elm_transit_effect_translation_op(void *data, Elm_Transit *transit, double progr } } +void * +_transit_effect_translation_context_new(Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy) +{ + Elm_Fx_Translation *translation; + + translation = ELM_NEW(Elm_Fx_Translation); + + if (!translation) return NULL; + + translation->from.dx = from_dx; + translation->from.dy = from_dy; + translation->to.dx = to_dx - from_dx; + translation->to.dy = to_dy - from_dy; + + return translation; +} + /** - * Get a new context data of Translation Effect + * Add the Translation Effect to Elm_Transit. * - * This function belongs to the Translation effect, which consists of functions: - * - elm_transit_effect_translation_context_new() - * - elm_transit_effect_translation_op() - * - elm_transit_effect_translation_context_free() + * @note This API is one of the facades. It creates translation effect context + * and add it's required APIs to elm_transit_effect_add. + * @note When this function is called, it gets the current objects in + * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() + * will not cause any changes in the set of objects that this effect is being + * applied. * * @see elm_transit_effect_add() * + * @param transit Transit object. * @param from_dx X Position variation when effect begins. * @param from_dy Y Position variation when effect begins. * @param to_dx X Position variation when effect ends. @@ -1059,24 +1009,27 @@ elm_transit_effect_translation_op(void *data, Elm_Transit *transit, double progr * @return Translation effect context data. * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_translation_context_new(Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy) +elm_transit_effect_translation_add(Elm_Transit *transit, Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy) { - Elm_Fx_Translation *translation; - - translation = ELM_NEW(Elm_Fx_Translation); - - if (!translation) return NULL; - - translation->from.dx = from_dx; - translation->from.dy = from_dy; - translation->to.dx = to_dx - from_dx; - translation->to.dy = to_dy - from_dy; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return translation; + void *effect_context = _transit_effect_translation_context_new(from_dx, from_dy, to_dx, to_dy); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_translation_op, effect_context, + _transit_effect_translation_context_free); + return effect_context; } + /////////////////////////////////////////////////////////////////////////////// //Zoom FX /////////////////////////////////////////////////////////////////////////////// @@ -1087,61 +1040,14 @@ struct _Elm_Fx_Zoom float from, to; }; -/** - * The Free function to Zoom Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Zoom effect, which consists of functions: - * - elm_transit_effect_zoom_context_new() - * - elm_transit_effect_zoom_op() - * - elm_transit_effect_zoom_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Zoom context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_zoom_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_zoom_context_free(void *data, Elm_Transit *transit __UNUSED__) { free(data); } -/** - * Operation function to the Zoom Effect - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note This effect will be applied to the objects that are in the transit, - * If you change the set of objects in the transit with elm_transit_object_add() - * or elm_transit_object_remove(), the set of objects affected by this effect - * will be changed too. - * - * This function belongs to the Zoom effect, which consists of functions: - * - elm_transit_effect_zoom_context_new() - * - elm_transit_effect_zoom_op() - * - elm_transit_effect_zoom_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Zoom context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the geometry information about the objects, - * and if the window was not created yet, it can get a wrong information. - * @warning Is not recommended remove or add an object after the transit begins - * to run, because the order of the objects will be affected. - */ -EAPI void -elm_transit_effect_zoom_op(void *data, Elm_Transit *transit , double progress) +void +_transit_effect_zoom_op(void *data, Elm_Transit *transit , double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -1172,37 +1078,58 @@ elm_transit_effect_zoom_op(void *data, Elm_Transit *transit , double progress) evas_map_free(map); } +void * +_transit_effect_zoom_context_new(float from_rate, float to_rate) +{ + Elm_Fx_Zoom *zoom; + + zoom = ELM_NEW(Elm_Fx_Zoom); + if (!zoom) return NULL; + + zoom->from = (FOCAL - (from_rate * FOCAL)) * (1 / from_rate); + zoom->to = ((FOCAL - (to_rate * FOCAL)) * (1 / to_rate)) - zoom->from; + + return zoom; +} + /** - * Get a new context data of Zoom Effect + * Add the Zoom Effect to Elm_Transit. * - * @see elm_transit_effect_add() + * @note This API is one of the facades. It creates zoom effect context + * and add it's required APIs to elm_transit_effect_add. + * @note If you change the set of objects in the transit with elm_transit_object_add() + * or elm_transit_object_remove(), the set of objects affected by this effect + * will be changed too. * - * This function belongs to the Zoom effect, which consists of functions: - * - elm_transit_effect_zoom_context_new() - * - elm_transit_effect_zoom_op() - * - elm_transit_effect_zoom_context_free() + * @see elm_transit_effect_add() * + * @param transit Transit object. * @param from_rate Scale rate when effect begins (1 is current rate). * @param to_rate Scale rate when effect ends. * @return Zoom effect context data. * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_zoom_context_new(float from_rate, float to_rate) +elm_transit_effect_zoom_add(Elm_Transit *transit, float from_rate, float to_rate) { - Elm_Fx_Zoom *zoom; - - zoom = ELM_NEW(Elm_Fx_Zoom); - if (!zoom) return NULL; - - zoom->from = (FOCAL - (from_rate * FOCAL)) * (1 / from_rate); - zoom->to = ((FOCAL - (to_rate * FOCAL)) * (1 / to_rate)) - zoom->from; - - return zoom; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + void *effect_context = _transit_effect_zoom_context_new(from_rate, to_rate); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_zoom_op, effect_context, + _transit_effect_zoom_context_free); + return effect_context; } + /////////////////////////////////////////////////////////////////////////////// //Flip FX /////////////////////////////////////////////////////////////////////////////// @@ -1214,26 +1141,8 @@ struct _Elm_Fx_Flip Eina_Bool cw:1; }; -/** - * The Free function to Flip Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Flip effect, which consists of functions: - * - elm_transit_effect_flip_context_new() - * - elm_transit_effect_flip_op() - * - elm_transit_effect_flip_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Flip context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_flip_context_free(void *data, Elm_Transit *transit) +void +_transit_effect_flip_context_free(void *data, Elm_Transit *transit) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -1254,41 +1163,8 @@ elm_transit_effect_flip_context_free(void *data, Elm_Transit *transit) free(data); } -/** - * Operation function to the Flip Effect. - * - * This effect is applied to each pair of objects in the order they are listed - * in the transit list of objects. The first object in the pair will be the - * "front" object and the second will be the "back" object. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note This effect will be applied to the objects that are in the transit, - * If you change the set of objects in the transit with elm_transit_object_add() - * or elm_transit_object_remove(), the set of objects affected by this effect - * will be changed too. - * - * This function belongs to the Flip effect, which consists of functions: - * - elm_transit_effect_flip_context_new() - * - elm_transit_effect_flip_op() - * - elm_transit_effect_flip_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Flip context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the geometry information about the objects, - * and if the window was not created yet, it can get a wrong information. - * @warning Is not recommended remove or add an object after the transit begins - * to run, because the order of the objects will be affected. - */ -EAPI void -elm_transit_effect_flip_op(void *data, Elm_Transit *transit, double progress) +void +_transit_effect_flip_op(void *data, Elm_Transit *transit, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -1378,34 +1254,58 @@ elm_transit_effect_flip_op(void *data, Elm_Transit *transit, double progress) evas_map_free(map); } +void * +_transit_effect_flip_context_new(Elm_Fx_Flip_Axis axis, Eina_Bool cw) +{ + Elm_Fx_Flip *flip; + + flip = ELM_NEW(Elm_Fx_Flip); + if (!flip) return NULL; + + flip->cw = cw; + flip->axis = axis; + + return flip; +} + /** - * Get a new context data of Flip Effect - * - * This function belongs to the Flip effect, which consists of functions: - * - elm_transit_effect_flip_context_new() - * - elm_transit_effect_flip_op() - * - elm_transit_effect_flip_context_free() + * Add the Flip Effect to Elm_Transit. * + * @note This API is one of the facades. It creates flip effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "front" object and the second will be the "back" object. + * @note If you change the set of objects in the transit with elm_transit_object_add() + * or elm_transit_object_remove(), the set of objects affected by this effect + * will be changed too. + * * @see elm_transit_effect_add() * + * @param transit Transit object. * @param axis Flipping Axis(X or Y). * @param cw Flipping Direction. EINA_TRUE is clock-wise. * @return Flip effect context data. * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_flip_context_new(Elm_Fx_Flip_Axis axis, Eina_Bool cw) +elm_transit_effect_flip_add(Elm_Transit *transit, Elm_Fx_Flip_Axis axis, Eina_Bool cw) { - Elm_Fx_Flip *flip; - - flip = ELM_NEW(Elm_Fx_Flip); - if (!flip) return NULL; - - flip->cw = cw; - flip->axis = axis; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return flip; + void *effect_context = _transit_effect_flip_context_new(axis, cw); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_flip_op, effect_context, + _transit_effect_flip_context_free); + return effect_context; } /////////////////////////////////////////////////////////////////////////////// @@ -1555,33 +1455,8 @@ _set_image_uv_by_axis_x(Evas_Map *map, Elm_Fx_ResizableFlip_Node *flip, float de } } -/** - * The Free function to Resizable Flip Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Resizable Flip effect, which consists of - * functions: - * - elm_transit_effect_resizable_flip_context_new() - * - elm_transit_effect_resizable_flip_op() - * - elm_transit_effect_resizing_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Resizable Flip context data. - * @param transit Transit object. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the geometry information about the objects, - * and if the window was not created yet, it can get a wrong information. - * @warning Is not recommended remove or add an object after the transit begins - * to run, because the order of the objects will be affected. - */ -EAPI void -elm_transit_effect_resizable_flip_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_resizable_flip_context_free(void *data, Elm_Transit *transit __UNUSED__) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -1607,40 +1482,8 @@ elm_transit_effect_resizable_flip_context_free(void *data, Elm_Transit *transit free(resizable_flip); } -/** - * Operation function to the Resizable Flip Effect - * - * This effect is applied to each pair of objects in the order they are listed - * in the transit list of objects. The first object in the pair will be the - * "front" object and the second will be the "back" object. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note When this function begins to be called, it gets the current objects in - * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() - * will not cause any changes in the set of objects that this effect is being - * applied if these functions are called after the @p transit starts to run. - * - * This function belongs to the Resizable Flip effect, which consists of - * functions: - * - elm_transit_effect_resizable_flip_context_new() - * - elm_transit_effect_resizable_flip_op() - * - elm_transit_effect_resizing_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Resizable Flip context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the geometry information about the objects, - * and if the window was not created yet, it can get a wrong information. - */ -EAPI void -elm_transit_effect_resizable_flip_op(void *data, Elm_Transit *transit __UNUSED__, double progress) +void +_transit_effect_resizable_flip_op(void *data, Elm_Transit *transit __UNUSED__, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -1726,37 +1569,62 @@ elm_transit_effect_resizable_flip_op(void *data, Elm_Transit *transit __UNUSED__ evas_map_free(map); } +void * +_transit_effect_resizable_flip_context_new(Elm_Fx_Flip_Axis axis, Eina_Bool cw) +{ + Elm_Fx_ResizableFlip *resizable_flip; + + resizable_flip = ELM_NEW(Elm_Fx_ResizableFlip); + if (!resizable_flip) return NULL; + + resizable_flip->cw = cw; + resizable_flip->axis = axis; + + return resizable_flip; +} + /** - * Get a new context data of Resizable Flip Effect. - * - * This function belongs to the Resizable Flip effect, which consists of - * functions: - * - elm_transit_effect_resizable_flip_context_new() - * - elm_transit_effect_resizable_flip_op() - * - elm_transit_effect_resizing_context_free() + * Add the Resizable Flip Effect to Elm_Transit. * + * @note This API is one of the facades. It creates resizable flip effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "front" object and the second will be the "back" object. + * @note When this function is called, it gets the current objects in + * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() + * will not cause any changes in the set of objects that this effect is being + * applied. + * * @see elm_transit_effect_add() * - * @param axis Flipping Axis.(X or Y). + * @param transit Transit object. + * @param axis Flipping Axis(X or Y). * @param cw Flipping Direction. EINA_TRUE is clock-wise. - * @return Resizable Flip effect context data. + * @return Resizable flip effect context data. * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_resizable_flip_context_new(Elm_Fx_Flip_Axis axis, Eina_Bool cw) +elm_transit_effect_resizable_flip_add(Elm_Transit *transit, Elm_Fx_Flip_Axis axis, Eina_Bool cw) { - Elm_Fx_ResizableFlip *resizable_flip; - - resizable_flip = ELM_NEW(Elm_Fx_ResizableFlip); - if (!resizable_flip) return NULL; - - resizable_flip->cw = cw; - resizable_flip->axis = axis; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return resizable_flip; + void *effect_context = _transit_effect_resizable_flip_context_new(axis, cw); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_resizable_flip_op, effect_context, + _transit_effect_resizable_flip_context_free); + return effect_context; } + /////////////////////////////////////////////////////////////////////////////// //Wipe FX /////////////////////////////////////////////////////////////////////////////// @@ -1892,31 +1760,8 @@ _elm_fx_wipe_show(Evas_Map *map, Elm_Fx_Wipe_Dir dir, float x, float y, float w, evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, FOCAL); } -/** - * The Free function to Wipe Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note This effect will be applied to the objects that are in the transit, - * If you change the set of objects in the transit with elm_transit_object_add() - * or elm_transit_object_remove(), the set of objects affected by this effect - * will be changed too. - * - * This function belongs to the Wipe effect, which consists of - * functions: - * - elm_transit_effect_wipe_context_new() - * - elm_transit_effect_wipe_op() - * - elm_transit_effect_wipe_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Wipe context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_wipe_context_free(void *data, Elm_Transit *transit) +void +_transit_effect_wipe_context_free(void *data, Elm_Transit *transit) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -1939,34 +1784,8 @@ elm_transit_effect_wipe_context_free(void *data, Elm_Transit *transit) free(wipe); } -/** - * Operation function to the Wipe Effect. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Wipe effect, which consists of - * functions: - * - elm_transit_effect_wipe_context_new() - * - elm_transit_effect_wipe_op() - * - elm_transit_effect_wipe_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Wipe context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the geometry information about the objects, - * and if the window was not created yet, it can get a wrong information. - * @warning Is not recommended remove or add an object after the transit begins - * to run, because the order of the objects will be affected. - */ -EAPI void -elm_transit_effect_wipe_op(void *data, Elm_Transit *transit, double progress) +void +_transit_effect_wipe_op(void *data, Elm_Transit *transit, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2002,37 +1821,59 @@ elm_transit_effect_wipe_op(void *data, Elm_Transit *transit, double progress) evas_map_free(map); } +void * +_transit_effect_wipe_context_new(Elm_Fx_Wipe_Type type, Elm_Fx_Wipe_Dir dir) +{ + Elm_Fx_Wipe *wipe; + + wipe = ELM_NEW(Elm_Fx_Wipe); + if (!wipe) return NULL; + + wipe->type = type; + wipe->dir = dir; + + return wipe; +} + /** - * Get a new context data of Wipe Flip Effect. - * - * This function belongs to the Wipe effect, which consists of - * functions: - * - elm_transit_effect_wipe_context_new() - * - elm_transit_effect_wipe_op() - * - elm_transit_effect_wipe_context_free() + * Add the Wipe Effect to Elm_Transit. * + * @note This API is one of the facades. It creates wipe effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect will be applied to the objects that are in the transit, + * If you change the set of objects in the transit with elm_transit_object_add() + * or elm_transit_object_remove(), the set of objects affected by this effect + * will be changed too. + * * @see elm_transit_effect_add() * + * @param transit Transit object. * @param type Wipe type. Hide or show. * @param dir Wipe Direction. * @return Wipe effect context data. * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_wipe_context_new(Elm_Fx_Wipe_Type type, Elm_Fx_Wipe_Dir dir) +elm_transit_effect_wipe_add(Elm_Transit *transit, Elm_Fx_Wipe_Type type, Elm_Fx_Wipe_Dir dir) { - Elm_Fx_Wipe *wipe; - - wipe = ELM_NEW(Elm_Fx_Wipe); - if (!wipe) return NULL; - - wipe->type = type; - wipe->dir = dir; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return wipe; + void *effect_context = _transit_effect_wipe_context_new(type, dir); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_wipe_op, effect_context, + _transit_effect_wipe_context_free); + return effect_context; } + /////////////////////////////////////////////////////////////////////////////// //Color FX /////////////////////////////////////////////////////////////////////////////// @@ -2050,57 +1891,14 @@ struct _Elm_Fx_Color } to; }; -/** - * The Free function to Color Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Color effect, which consists of - * functions: - * - elm_transit_effect_color_context_new() - * - elm_transit_effect_color_op() - * - elm_transit_effect_color_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Color context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_color_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_color_context_free(void *data, Elm_Transit *transit __UNUSED__) { free(data); } -/** - * Operation function to the Color Effect. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note This effect will be applied to the objects that are in the transit, - * If you change the set of objects in the transit with elm_transit_object_add() - * or elm_transit_object_remove(), the set of objects affected by this effect - * will be changed too. - * - * This function belongs to the Color effect, which consists of - * functions: - * - elm_transit_effect_color_context_new() - * - elm_transit_effect_color_op() - * - elm_transit_effect_color_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Color context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_color_op(void *data, Elm_Transit *transit, double progress) +void +_transit_effect_color_op(void *data, Elm_Transit *transit, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2121,17 +1919,39 @@ elm_transit_effect_color_op(void *data, Elm_Transit *transit, double progress) evas_object_color_set(obj, r, g, b, a); } +void * +_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) +{ + Elm_Fx_Color *color; + + color = ELM_NEW(Elm_Fx_Color); + if (!color) return NULL; + + color->from.r = from_r; + color->from.g = from_g; + color->from.b = from_b; + color->from.a = from_a; + color->to.r = to_r - from_r; + color->to.g = to_g - from_g; + color->to.b = to_b - from_b; + color->to.a = to_a - from_a; + + return color; +} + /** - * Get a new context data of Color Effect. + * Add the Color Effect to Elm_Transit. * + * @note This API is one of the facades. It creates color effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect will be applied to the objects that are in the transit, + * If you change the set of objects in the transit with elm_transit_object_add() + * or elm_transit_object_remove(), the set of objects affected by this effect + * will be changed too. + * * @see elm_transit_effect_add() * - * This function belongs to the Color effect, which consists of - * functions: - * - elm_transit_effect_color_context_new() - * - elm_transit_effect_color_op() - * - elm_transit_effect_color_context_free() - * + * @param transit Transit object. * @param from_r RGB R when effect begins. * @param from_g RGB G when effect begins. * @param from_b RGB B when effect begins. @@ -2145,23 +1965,16 @@ elm_transit_effect_color_op(void *data, Elm_Transit *transit, double progress) * @ingroup Transit */ EAPI void * -elm_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) +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) { - Elm_Fx_Color *color; - - color = ELM_NEW(Elm_Fx_Color); - if (!color) return NULL; - - color->from.r = from_r; - color->from.g = from_g; - color->from.b = from_b; - color->from.a = from_a; - color->to.r = to_r - from_r; - color->to.g = to_g - from_g; - color->to.b = to_b - from_b; - color->to.a = to_a - from_a; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return color; + void *effect_context = _transit_effect_color_context_new(from_r, from_g, from_b, from_a, to_r, to_g, to_b, to_a); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_color_op, effect_context, + _transit_effect_color_context_free); + return effect_context; } /////////////////////////////////////////////////////////////////////////////// @@ -2250,27 +2063,8 @@ _fade_nodes_build(Elm_Transit *transit, Elm_Fx_Fade *fade_data) return data_list; } -/** - * The Free function to Fade Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Fade effect, which consists of - * functions: - * - elm_transit_effect_fade_context_new() - * - elm_transit_effect_fade_op() - * - elm_transit_effect_fade_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Fade context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_fade_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_fade_context_free(void *data, Elm_Transit *transit __UNUSED__) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2300,42 +2094,8 @@ elm_transit_effect_fade_context_free(void *data, Elm_Transit *transit __UNUSED__ free(fade); } -/** - * Operation function to the Fade Effect - * - * This effect is applied to each pair of objects in the order they are listed - * in the transit list of objects. The first object in the pair will be the - * "before" object and the second will be the "after" object. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note When this function begins to be called, it gets the current objects in - * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() - * will not cause any changes in the set of objects that this effect is being - * applied if these functions are called after the @p transit starts to run. - * - * This function belongs to the Fade effect, which consists of - * functions: - * - elm_transit_effect_fade_context_new() - * - elm_transit_effect_fade_op() - * - elm_transit_effect_fade_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Fade context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the color information about the objects, - * and if the window was not created yet, it can get a wrong information. - * @warning Is not recommended remove or add an object after the transit begins - * to run, because the order of the objects will be affected. - */ -EAPI void -elm_transit_effect_fade_op(void *data, Elm_Transit *transit __UNUSED__, double progress) +void +_transit_effect_fade_op(void *data, Elm_Transit *transit __UNUSED__, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2389,30 +2149,55 @@ elm_transit_effect_fade_op(void *data, Elm_Transit *transit __UNUSED__, double p } } +void * +_transit_effect_fade_context_new(void) +{ + Elm_Fx_Fade *fade; + fade = ELM_NEW(Elm_Fx_Fade); + if (!fade) return NULL; + return fade; +} + /** - * Get a new context data of Fade Effect. - * - * This function belongs to the Fade effect, which consists of - * functions: - * - elm_transit_effect_fade_context_new() - * - elm_transit_effect_fade_op() - * - elm_transit_effect_fade_context_free() + * Add the Fade Effect to Elm_Transit. * + * @note This API is one of the facades. It creates fade effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "before" object and the second will be the "after" object. + * @note When this function is called, it gets the current objects in + * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() + * will not cause any changes in the set of objects that this effect is being + * applied. + * * @see elm_transit_effect_add() * + * @param transit Transit object. * @return Fade effect context data. - * + * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the color information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_fade_context_new(void) +elm_transit_effect_fade_add(Elm_Transit *transit) { - Elm_Fx_Fade *fade; - fade = ELM_NEW(Elm_Fx_Fade); - if (!fade) return NULL; - return fade; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + + void *effect_context = _transit_effect_fade_context_new(); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_fade_op, effect_context, + _transit_effect_fade_context_free); + return effect_context; } + /////////////////////////////////////////////////////////////////////////////// //Blend FX /////////////////////////////////////////////////////////////////////////////// @@ -2494,27 +2279,8 @@ _blend_nodes_build(Elm_Transit *transit, Elm_Fx_Blend *blend) return data_list; } -/** - * The Free function to Blend Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Blend effect, which consists of - * functions: - * - elm_transit_effect_blend_context_new() - * - elm_transit_effect_blend_op() - * - elm_transit_effect_blend_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Blend context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_blend_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_blend_context_free(void *data, Elm_Transit *transit __UNUSED__) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2547,42 +2313,8 @@ elm_transit_effect_blend_context_free(void *data, Elm_Transit *transit __UNUSED_ free(data); } -/** - * Operation function to the Blend Effect. - * - * This effect is applied to each pair of objects in the order they are listed - * in the transit list of objects. The first object in the pair will be the - * "before" object and the second will be the "after" object. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note When this function begins to be called, it gets the current objects in - * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() - * will not cause any changes in the set of objects that this effect is being - * applied if these functions are called after the @p transit starts to run. - * - * This function belongs to the Blend effect, which consists of - * functions: - * - elm_transit_effect_blend_context_new() - * - elm_transit_effect_blend_op() - * - elm_transit_effect_blend_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Blend context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the color information about the objects, - * and if the window was not created yet, it can get a wrong information. - * @warning Is not recommended remove or add an object after the transit begins - * to run, because the order of the objects will be affected. - */ -EAPI void -elm_transit_effect_blend_op(void *data, Elm_Transit *transit, double progress) +void +_transit_effect_blend_op(void *data, Elm_Transit *transit, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2610,32 +2342,57 @@ elm_transit_effect_blend_op(void *data, Elm_Transit *transit, double progress) } } +void * +_transit_effect_blend_context_new(void) +{ + Elm_Fx_Blend *blend; + + blend = ELM_NEW(Elm_Fx_Blend); + if (!blend) return NULL; + + return blend; +} + /** - * Get a new context data of Blend Effect. + * Add the Blend Effect to Elm_Transit. * + * @note This API is one of the facades. It creates blend effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "before" object and the second will be the "after" object. + * @note When this function be called, it gets the current objects in + * the transit, that is, elm_transit_object_remove() and elm_transit_object_add() + * will not cause any changes in the set of objects that this effect is being + * applied. + * * @see elm_transit_effect_add() * - * This function belongs to the Blend effect, which consists of - * functions: - * - elm_transit_effect_blend_context_new() - * - elm_transit_effect_blend_op() - * - elm_transit_effect_blend_context_free() - * + * @param transit Transit object. * @return Blend effect context data. - * + * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the color information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_blend_context_new(void) +elm_transit_effect_blend_add(Elm_Transit *transit) { - Elm_Fx_Blend *blend; - - blend = ELM_NEW(Elm_Fx_Blend); - if (!blend) return NULL; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return blend; + void *effect_context = _transit_effect_blend_context_new(); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_blend_op, effect_context, + _transit_effect_blend_context_free); + return effect_context; } + /////////////////////////////////////////////////////////////////////////////// //Rotation FX /////////////////////////////////////////////////////////////////////////////// @@ -2647,63 +2404,14 @@ struct _Elm_Fx_Rotation float from, to; }; -/** - * The Free function to Rotation Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Rotation effect, which consists of - * functions: - * - elm_transit_effect_rotation_context_new() - * - elm_transit_effect_rotation_op() - * - elm_transit_effect_rotation_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Rotation context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_rotation_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_rotation_context_free(void *data, Elm_Transit *transit __UNUSED__) { free(data); } -/** - * Operation function to the Rotation Effect - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note This effect will be applied to the objects that are in the transit, - * If you change the set of objects in the transit with elm_transit_object_add() - * or elm_transit_object_remove(), the set of objects affected by this effect - * will be changed too. - * - * This function belongs to the Rotation effect, which consists of - * functions: - * - elm_transit_effect_rotation_context_new() - * - elm_transit_effect_rotation_op() - * - elm_transit_effect_rotation_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Rotation context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - * @warning Is higher recommended just create a transit with this effect when - * the window that the objects of the transit belongs has already been created. - * This is because this effect needs the geometry information about the objects, - * and if the window was not created yet, it can get a wrong information. - * @warning Is not recommended remove or add an object after the transit begins - * to run, because the order of the objects will be affected. - */ -EAPI void -elm_transit_effect_rotation_op(void *data, Elm_Transit *transit, double progress) +void +_transit_effect_rotation_op(void *data, Elm_Transit *transit, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2749,39 +2457,61 @@ elm_transit_effect_rotation_op(void *data, Elm_Transit *transit, double progress evas_map_free(map); } +void * +_transit_effect_rotation_context_new(float from_degree, float to_degree, Eina_Bool cw) +{ + Elm_Fx_Rotation *rotation; + + rotation = ELM_NEW(Elm_Fx_Rotation); + if (!rotation) return NULL; + + rotation->from = from_degree; + rotation->to = to_degree - from_degree; + rotation->cw = cw; + + return rotation; +} + /** - * Get a new context data of Rotation Effect. - * - * This function belongs to the Rotation effect, which consists of - * functions: - * - elm_transit_effect_rotation_context_new() - * - elm_transit_effect_rotation_op() - * - elm_transit_effect_rotation_context_free() + * Add the Rotation Effect to Elm_Transit. * + * @note This API is one of the facades. It creates rotation effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect will be applied to the objects that are in the transit, + * If you change the set of objects in the transit with elm_transit_object_add() + * or elm_transit_object_remove(), the set of objects affected by this effect + * will be changed too. + * * @see elm_transit_effect_add() * + * @param transit Transit object. * @param from_degree Degree when effect begins. * @param to_degree Degree when effect is ends. * @param cw Rotation direction. EINA_TRUE is clock wise. * @return Rotation effect context data. - * + * * @ingroup Transit + * @warning Is higher recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + * @warning Is not recommended remove or add an object after the transit begins + * to run, because the order of the objects will be affected. */ EAPI void * -elm_transit_effect_rotation_context_new(float from_degree, float to_degree, Eina_Bool cw) +elm_transit_effect_rotation_add(Elm_Transit *transit, float from_degree, float to_degree, Eina_Bool cw) { - Elm_Fx_Rotation *rotation; - - rotation = ELM_NEW(Elm_Fx_Rotation); - if (!rotation) return NULL; - - rotation->from = from_degree; - rotation->to = to_degree - from_degree; - rotation->cw = cw; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return rotation; + void *effect_context = _transit_effect_rotation_context_new(from_degree, to_degree, cw); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_rotation_op, effect_context, + _transit_effect_rotation_context_free); + return effect_context; } + /////////////////////////////////////////////////////////////////////////////// // ImageAnimation FX /////////////////////////////////////////////////////////////////////////////// @@ -2792,27 +2522,8 @@ struct _Elm_Fx_Image_Animation Eina_List *images; }; -/** - * The Free function to Image Animation Effect context data. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * - * This function belongs to the Image Animation effect, which consists of - * functions: - * - elm_transit_effect_image_animation_context_new() - * - elm_transit_effect_image_animation_op() - * - elm_transit_effect_image_animation_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Imagem Animation context data. - * @param transit Transit object. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_image_animation_context_free(void *data, Elm_Transit *transit __UNUSED__) +void +_transit_effect_image_animation_context_free(void *data, Elm_Transit *transit __UNUSED__) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2831,34 +2542,8 @@ elm_transit_effect_image_animation_context_free(void *data, Elm_Transit *transit free(data); } -/** - * Operation function to the Imagem Animation Effect. - * - * This effect changes the image from an icon object in the @p transit. - * - * @note You not need to call this function, just pass as parameter to - * elm_transit_effect_add() function. - * @note This effect will be applied to the objects that are in the transit, - * If you change the set of objects in the transit with elm_transit_object_add() - * or elm_transit_object_remove(), the set of objects affected by this effect - * will be changed too. - * - * This function belongs to the Image Animation effect, which consists of - * functions: - * - elm_transit_effect_image_animation_context_new() - * - elm_transit_effect_image_animation_op() - * - elm_transit_effect_image_animation_context_free() - * - * @see elm_transit_effect_add() - * - * @param data The Imagem Animation context data. - * @param transit Transit object. - * @param progress The time progression, it is a double value between 0.0 and 1.0. - * - * @ingroup Transit - */ -EAPI void -elm_transit_effect_image_animation_op(void *data, Elm_Transit *transit, double progress) +void +_transit_effect_image_animation_op(void *data, Elm_Transit *transit, double progress) { EINA_SAFETY_ON_NULL_RETURN(data); @@ -2890,12 +2575,32 @@ elm_transit_effect_image_animation_op(void *data, Elm_Transit *transit, double p eina_stringshare_del(type); } +void * +_transit_effect_image_animation_context_new(Eina_List *images) +{ + Elm_Fx_Image_Animation *image_animation; + + image_animation = ELM_NEW(Elm_Fx_Image_Animation); + + if (!image_animation) return NULL; + + image_animation->images = images; + + return image_animation; +} + /** - * Get a new context data of Imagem Animation Effect. + * Add the Rotation Effect to Elm_Transit. * + * @note This API is one of the facades. It creates image animation effect context + * and add it's required APIs to elm_transit_effect_add. * The @p images parameter is a list images paths. This list and * its contents will be deleted at the end of the effect by * elm_transit_effect_image_animation_context_free() function. + * @note This effect will be applied to the objects that are in the transit, + * If you change the set of objects in the transit with elm_transit_object_add() + * or elm_transit_object_remove(), the set of objects affected by this effect + * will be changed too. * * Example: * @code @@ -2908,38 +2613,29 @@ elm_transit_effect_image_animation_op(void *data, Elm_Transit *transit, double p * * snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); * images = eina_list_append(images, eina_stringshare_add(buf)); + * elm_transit_effect_image_animation_add(transi, images); * - * elm_transit_effect_add(transit, - * elm_transit_effect_image_animation_op, - * elm_transit_effect_image_animation_context_new(images), - * elm_transit_effect_image_animation_context_free); * @endcode - * - * This function belongs to the Image Animation effect, which consists of - * functions: - * - elm_transit_effect_image_animation_context_new() - * - elm_transit_effect_image_animation_op() - * - elm_transit_effect_image_animation_context_free() - * + * * @see elm_transit_effect_add() * + * @param transit Transit object. * @param images Eina_List of images file paths. This list and * its contents will be deleted at the end of the effect by * elm_transit_effect_image_animation_context_free() function. * @return Image Animation effect context data. - * + * * @ingroup Transit */ EAPI void * -elm_transit_effect_image_animation_context_new(Eina_List *images) +elm_transit_effect_image_animation_add(Elm_Transit *transit, Eina_List *images) { - Elm_Fx_Image_Animation *image_animation; - - image_animation = ELM_NEW(Elm_Fx_Image_Animation); - - if (!image_animation) return NULL; - - image_animation->images = images; + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); - return image_animation; + void *effect_context = _transit_effect_image_animation_context_new(images); + if(!effect_context) return NULL; + elm_transit_effect_add(transit, + _transit_effect_image_animation_op, effect_context, + _transit_effect_image_animation_context_free); + return effect_context; } -- 2.34.1