[transit] Added imageanimation fx.
authorDaniel Juyung Seo <juyung.seo@smasung.net>
Wed, 9 Jun 2010 03:46:18 +0000 (12:46 +0900)
committerDaniel Juyung Seo <juyung.seo@smasung.net>
Wed, 9 Jun 2010 03:46:18 +0000 (12:46 +0900)
src/lib/Elementary.h.in
src/lib/elm_transit.c

index 46681d3..df4e366 100755 (executable)
@@ -1923,6 +1923,9 @@ extern "C" {
    EAPI void elm_fx_transform_multiply( Elm_Fx_Matrix* m, Elm_Fx_Matrix* m1, Elm_Fx_Matrix* m2 );
    */
 
+   /* ImageAnimation Fx */
+   EAPI Elm_Effect* elm_fx_imageanimation_add( const Evas_Object* icon, const char** images, const unsigned int max_num );
+
    /* NavigationBar */
    EAPI Evas_Object *elm_navigationbar_add(Evas_Object *parent);
    EAPI void elm_navigationbar_push(Evas_Object *obj, const char *title, Evas_Object *left_btn, Evas_Object *right_btn, Evas_Object *content, Eina_Bool animation);
index b4e294b..b76beee 100644 (file)
@@ -2446,17 +2446,43 @@ EAPI void elm_fx_transform_multiply( Elm_Fx_Matrix* m, Elm_Fx_Matrix* m1, Elm_Fx
 }
 
 
-
-
 /////////////////////////////////////////////////////////////////////////////////////
 // ImageAnimation FX
 /////////////////////////////////////////////////////////////////////////////////////
 typedef struct _image_animation Elm_Fx_Image_Animation;
 
 struct _image_animation {
-       Evas_Object** images;
+       Evas_Object* icon;
+       char** images;
+       int count;
+       int item_num;
 };
 
+static void _elm_fx_imageanimation_begin( void* data,
+                                          const Eina_Bool auto_reverse, 
+                                          const unsigned int repeat_cnt )
+{
+}
+
+static void _elm_fx_imageanimation_end( void* data,
+                                 const Eina_Bool auto_reverse,
+                                 const unsigned int repeat_cnt )
+{
+}
+
+void _elm_fx_imageanimation_op( void* data, Elm_Animator* animator, const double frame )
+{
+       Elm_Fx_Image_Animation* image_animation = (Elm_Fx_Image_Animation *)data;
+
+       if ( image_animation->icon == NULL ) {
+               return;
+       }
+                       
+       image_animation->count = floor( frame * image_animation->item_num );
+
+       elm_icon_file_set( image_animation->icon, image_animation->images[image_animation->count], NULL );
+}
+
 /**
  * @ingroup Transit 
  *
@@ -2465,7 +2491,7 @@ struct _image_animation {
  * @param  images        Images for animation.
  * @return              ImageAnimation Effect.
  */
-EAPI Elm_Effect* elm_fx_imageanimation_add( Evas_Object* images[])
+EAPI Elm_Effect* elm_fx_imageanimation_add( const Evas_Object* icon, const char** images, const unsigned int item_num )
 {
 #ifdef ELM_FX_EXCEPTION_ENABLE
        ELM_FX_NULL_CHECK_WITH_RET( images, NULL );
@@ -2478,6 +2504,11 @@ EAPI Elm_Effect* elm_fx_imageanimation_add( Evas_Object* images[])
                return NULL;
        }
        
+       if( images == NULL || *images == NULL ) {
+               fprintf( stderr, "Failed to load NULL images!\n" );
+               return NULL;
+       }
+
        Elm_Fx_Image_Animation* image_animation = calloc( 1, sizeof( Elm_Fx_Image_Animation) );
 
        if( image_animation == NULL ) {
@@ -2486,15 +2517,16 @@ EAPI Elm_Effect* elm_fx_imageanimation_add( Evas_Object* images[])
                return NULL;
        }
 
+       image_animation->icon = icon;
        image_animation->images = images;
+       image_animation->count = 0;
+       image_animation->item_num = item_num;
 
-       effect->begin_op = NULL;
-       effect->end_op = NULL;
-       effect->animation_op = NULL;
+       effect->begin_op = _elm_fx_imageanimation_begin;
+       effect->end_op = _elm_fx_imageanimation_end;
+       effect->animation_op = _elm_fx_imageanimation_op;
        effect->user_data = image_animation ;
 
        return effect;
 }
 
-
-