(Vector) Add StopBehavior and LoopingMode 32/210132/4
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 16 Jul 2019 05:41:54 +0000 (14:41 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 24 Jul 2019 01:37:33 +0000 (10:37 +0900)
Change-Id: I7aab7733d8e01f5423575f9bb6d45161912d7b20

automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp
dali-toolkit/devel-api/visuals/image-visual-properties-devel.h
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h
dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.h
dali-toolkit/internal/visuals/visual-string-constants.cpp
dali-toolkit/internal/visuals/visual-string-constants.h

index 2fc3dcd..20ee4d7 100644 (file)
@@ -175,11 +175,18 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetAnimatedVectorImageVisual04: Request animated vector image visual with a Property::Map" );
 
+  int startFrame = 1, endFrame = 3;
+  Property::Array playRange;
+  playRange.PushBack( startFrame );
+  playRange.PushBack( endFrame );
+
   Property::Map propertyMap;
   propertyMap.Add( "visualType", DevelVisual::ANIMATED_VECTOR_IMAGE )
-             .Add( "url", TEST_VECTOR_IMAGE_FILE_NAME  )
-             .Add( "loopCount", 3  )
-             .Add( "playRange", Vector2( 0.2f, 0.8f )  );
+             .Add( "url", TEST_VECTOR_IMAGE_FILE_NAME )
+             .Add( "loopCount", 3 )
+             .Add( "playRange", playRange )
+             .Add( "stopBehavior", DevelImageVisual::StopBehavior::FIRST_FRAME )
+             .Add( "loopingMode", DevelImageVisual::LoopingMode::AUTO_REVERSE );
 
   Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
   DALI_TEST_CHECK( visual );
@@ -201,6 +208,35 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void)
   Renderer renderer = actor.GetRendererAt( 0u );
   DALI_TEST_CHECK( renderer );
 
+  Property::Map resultMap;
+  visual.CreatePropertyMap( resultMap );
+
+  // check the property values from the returned map from a visual
+  Property::Value* value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get< std::string >() == TEST_VECTOR_IMAGE_FILE_NAME );
+
+  value = resultMap.Find( DevelImageVisual::Property::LOOP_COUNT, Property::INTEGER );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get< int >() == 3 );
+
+  value = resultMap.Find( DevelImageVisual::Property::PLAY_RANGE, Property::ARRAY );
+  DALI_TEST_CHECK( value );
+
+  Property::Array* result = value->GetArray();
+  DALI_TEST_CHECK( result );
+
+  DALI_TEST_CHECK( result->GetElementAt( 0 ).Get< int >() == startFrame );
+  DALI_TEST_CHECK( result->GetElementAt( 1 ).Get< int >() == endFrame );
+
+  value = resultMap.Find( DevelImageVisual::Property::STOP_BEHAVIOR, Property::INTEGER );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::StopBehavior::FIRST_FRAME );
+
+  value = resultMap.Find( DevelImageVisual::Property::LOOPING_MODE, Property::INTEGER );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::LoopingMode::AUTO_REVERSE );
+
   actor.Unparent( );
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
 
@@ -219,9 +255,9 @@ int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void)
 
   Property::Map propertyMap;
   propertyMap.Add( Toolkit::Visual::Property::TYPE,  DevelVisual::ANIMATED_VECTOR_IMAGE )
-             .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME  )
-             .Add( DevelImageVisual::Property::LOOP_COUNT, 3  )
-             .Add( DevelImageVisual::Property::PLAY_RANGE, playRange  );
+             .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME )
+             .Add( DevelImageVisual::Property::LOOP_COUNT, 3 )
+             .Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
 
   // request AnimatedVectorImageVisual with a property map
   VisualFactory factory = VisualFactory::Get();
@@ -252,6 +288,14 @@ int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void)
   DALI_TEST_CHECK( result->GetElementAt( 0 ).Get< int >() == startFrame );
   DALI_TEST_CHECK( result->GetElementAt( 1 ).Get< int >() == endFrame );
 
+  value = resultMap.Find( DevelImageVisual::Property::STOP_BEHAVIOR, Property::INTEGER );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::StopBehavior::CURRENT_FRAME );
+
+  value = resultMap.Find( DevelImageVisual::Property::LOOPING_MODE, Property::INTEGER );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::LoopingMode::RESTART );
+
   // request AnimatedVectorImageVisual with an URL
   Visual::Base visual2 = factory.CreateVisual( TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions() );
 
@@ -303,7 +347,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     Property::Map map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PLAYING ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
 
     tet_infoline( "Test Pause action" );
     DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, attributes );
@@ -315,7 +359,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PAUSED ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PAUSED );
 
     tet_infoline( "Test Play action" );
     DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
@@ -325,7 +369,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PLAYING ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
 
     tet_infoline( "Test Stop action" );
     DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
@@ -335,7 +379,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::STOPPED ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
 
     tet_infoline( "Test Stop action again" );
     DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
@@ -345,7 +389,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::STOPPED ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
 
     tet_infoline( "Test Play action" );
     DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
@@ -355,7 +399,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PLAYING ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
 
     tet_infoline( "Off stage" );
     dummyControl.Unparent();
@@ -365,7 +409,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PAUSED ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PAUSED );
 
     tet_infoline( "On stage again" );
     Stage::GetCurrent().Add( dummyControl );
@@ -375,7 +419,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PAUSED ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PAUSED );
 
     tet_infoline( "Test Play action" );
     DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
@@ -385,7 +429,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void)
 
     map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
     value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PLAYING ) );
+    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
 
     // Change Size
     Vector3 newSize( 100.0f, 100.0f, 0.0f );
@@ -646,7 +690,7 @@ int UtcDaliAnimatedVectorImageVisualAnimationFinishedSignal(void)
 
   Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
   Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-  DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::STOPPED ) );
+  DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
 
   DALI_TEST_EQUALS( gAnimationFinishedSignalFired, true, TEST_LOCATION );
 
@@ -830,3 +874,176 @@ int UtcDaliAnimatedVectorImageVisualUpdateProperty(void)
 
   END_TEST;
 }
+
+int UtcDaliAnimatedVectorImageVisualStopBehavior(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliAnimatedVectorImageVisualStopBehavior" );
+
+  Property::Map propertyMap;
+  propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
+             .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME )
+             .Add( DevelImageVisual::Property::LOOP_COUNT, 3 )
+             .Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::FIRST_FRAME );
+
+  Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
+  DALI_TEST_CHECK( visual );
+
+  DummyControl actor = DummyControl::New( true );
+  DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+  Vector2 controlSize( 20.f, 30.f );
+  actor.SetSize( controlSize );
+
+  Stage::GetCurrent().Add( actor );
+
+  Property::Map attributes;
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+  application.SendNotification();
+  application.Render();
+
+  // Trigger count is 2 - resource ready and animation finished
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION );
+
+  Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+  Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+  DALI_TEST_EQUALS( value->Get< int >(), 0, TEST_LOCATION );  // Should be the first frame
+
+  // Change stop behavior
+  attributes.Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME );
+
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+  attributes.Clear();
+
+  // Play again
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+  application.SendNotification();
+  application.Render();
+
+  // Trigger count is 1 - animation finished
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+
+  Property::Value* value1 = map.Find( DevelImageVisual::Property::TOTAL_FRAME_NUMBER );
+  int totalFrameNumber = value1->Get< int >();
+
+  value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+  DALI_TEST_EQUALS( value->Get< int >(), totalFrameNumber - 1, TEST_LOCATION );  // Should be the last frame
+
+  // Change stop behavior
+  attributes.Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::CURRENT_FRAME );
+  attributes.Add( DevelImageVisual::Property::LOOP_COUNT, -1 );
+
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+  attributes.Clear();
+
+  // Play again
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+  application.SendNotification();
+  application.Render();
+
+  // Pause
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, attributes );
+
+  map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+  value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+  int currentFrameNumber = value->Get< int >();
+
+  // Stop
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
+
+  // Trigger count is 1 - animation finished
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+  value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+  DALI_TEST_EQUALS( value->Get< int >(), currentFrameNumber, TEST_LOCATION );  // Should be same with currentFrameNumber
+
+  END_TEST;
+}
+
+int UtcDaliAnimatedVectorImageVisualLoopingMode(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliAnimatedVectorImageVisualLoopingMode" );
+
+  Property::Map propertyMap;
+  propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
+             .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME )
+             .Add( DevelImageVisual::Property::LOOP_COUNT, 3 )
+             .Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME )
+             .Add( DevelImageVisual::Property::LOOPING_MODE, DevelImageVisual::LoopingMode::AUTO_REVERSE );
+
+  Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
+  DALI_TEST_CHECK( visual );
+
+  DummyControl actor = DummyControl::New( true );
+  DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+  Vector2 controlSize( 20.f, 30.f );
+  actor.SetSize( controlSize );
+
+  Stage::GetCurrent().Add( actor );
+
+  Property::Map attributes;
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+  application.SendNotification();
+  application.Render();
+
+  // Trigger count is 2 - resource ready and animation finished
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION );
+
+  Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+  Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+  DALI_TEST_EQUALS( value->Get< int >(), 0, TEST_LOCATION );  // Should be the first frame because of auto reverse
+
+  // Change stop behavior
+  attributes.Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::CURRENT_FRAME );
+
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+  // Play again
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+  application.SendNotification();
+  application.Render();
+
+  // Trigger count is 1 - animation finished
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+  value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+  DALI_TEST_EQUALS( value->Get< int >(), 0, TEST_LOCATION );  // Should be the first frame
+
+  // Change looping mode
+  attributes.Add( DevelImageVisual::Property::LOOPING_MODE, DevelImageVisual::LoopingMode::RESTART );
+
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+  // Play again
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+  application.SendNotification();
+  application.Render();
+
+  // Trigger count is 1 - animation finished
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  Property::Value* value1 = map.Find( DevelImageVisual::Property::TOTAL_FRAME_NUMBER );
+  int totalFrameNumber = value1->Get< int >();
+
+  map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+  value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+  DALI_TEST_EQUALS( value->Get< int >(), totalFrameNumber - 1, TEST_LOCATION );  // Should be the last frame
+
+  END_TEST;
+}
index 9968b5c..306880b 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_DEVEL_API_VISUALS_IMAGE_VISUAL_PROPERTIES_DEVEL_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ enum Type
   ORIENTATION_CORRECTION = Dali::Toolkit::ImageVisual::Property::ORIENTATION_CORRECTION,
 
   /**
-   * @brief Overlays the auxiliary iamge on top of an NPatch image.
+   * @brief Overlays the auxiliary image on top of an NPatch image.
    *
    * The resulting visual image will be at least as large as the
    * smallest possible n-patch or the auxiliary image, whichever is
@@ -97,7 +97,7 @@ enum Type
 
   /**
    * @brief The playing state the AnimatedVectorImageVisual will use.
-   * @details Name "playState", type PlayState (Property::INTEGER)
+   * @details Name "playState", Type PlayState::Type (Property::INTEGER)
    * @note This property is read-only.
    */
   PLAY_STATE = ORIENTATION_CORRECTION + 5,
@@ -114,7 +114,21 @@ enum Type
    * @details Name "totalFrameNumber", Type Property::INTEGER.
    * @note This property is read-only.
    */
-  TOTAL_FRAME_NUMBER = ORIENTATION_CORRECTION + 7
+  TOTAL_FRAME_NUMBER = ORIENTATION_CORRECTION + 7,
+
+  /**
+   * @brief  The stop behavior the AnimatedVectorImageVisual will use.
+   * @details Name "stopBehavior", Type StopBehavior::Type (Property::INTEGER)
+   * @note Default value is StopBehavior::CURRENT_FRAME.
+   */
+  STOP_BEHAVIOR = ORIENTATION_CORRECTION + 8,
+
+  /**
+   * @brief  The looping mode the AnimatedVectorImageVisual will use.
+   * @details Name "loopingMode", Type LoopingMode::Type (Property::INTEGER)
+   * @note Default value is LoopingMode::RESTART.
+   */
+  LOOPING_MODE = ORIENTATION_CORRECTION + 9
 };
 
 } //namespace Property
@@ -122,13 +136,47 @@ enum Type
 /**
  * @brief Enumeration for what state the animation is in.
  */
-enum class PlayState
+namespace PlayState
+{
+
+enum Type
 {
   STOPPED,   ///< Animation has stopped
   PLAYING,   ///< The animation is playing
   PAUSED     ///< The animation is paused
 };
 
+} // namespace PlayState
+
+/**
+ * @brief Enumeration for what to do when the animation is stopped.
+ */
+namespace StopBehavior
+{
+
+enum Type
+{
+  CURRENT_FRAME,  ///< When the animation is stopped, the current frame is shown.
+  FIRST_FRAME,    ///< When the animation is stopped, the first frame is shown.
+  LAST_FRAME      ///< When the animation is stopped, the last frame is shown.
+};
+
+} // namespace StopBehavoir
+
+/**
+ * @brief Enumeration for what looping mode is in.
+ */
+namespace LoopingMode
+{
+
+enum Type
+{
+  RESTART,      ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning.
+  AUTO_REVERSE  ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again.
+};
+
+} // namespace LoopingMode
+
 } // namespace DevelImageVisual
 
 } // namespace Toolkit
index fbb727b..c70c37b 100644 (file)
@@ -52,10 +52,25 @@ const Dali::Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
 // Flags for re-sending data to the rasterize thread
 enum Flags
 {
-  RESEND_PLAY_RANGE  = 1 << 0,
-  RESEND_LOOP_COUNT  = 1 << 1
+  RESEND_PLAY_RANGE    = 1 << 0,
+  RESEND_LOOP_COUNT    = 1 << 1,
+  RESEND_STOP_BEHAVIOR = 1 << 2,
+  RESEND_LOOPING_MODE  = 1 << 3
 };
 
+// stop behavior
+DALI_ENUM_TO_STRING_TABLE_BEGIN( STOP_BEHAVIOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::StopBehavior, CURRENT_FRAME )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::StopBehavior, FIRST_FRAME )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::StopBehavior, LAST_FRAME )
+DALI_ENUM_TO_STRING_TABLE_END( STOP_BEHAVIOR )
+
+// looping mode
+DALI_ENUM_TO_STRING_TABLE_BEGIN( LOOPING_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::LoopingMode, RESTART )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::LoopingMode, AUTO_REVERSE )
+DALI_ENUM_TO_STRING_TABLE_END( LOOPING_MODE )
+
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_VECTOR_ANIMATION" );
 #endif
@@ -88,7 +103,9 @@ AnimatedVectorImageVisual::AnimatedVectorImageVisual( VisualFactoryCache& factor
   mStartFrame( 0 ),
   mEndFrame( 0 ),
   mResendFlag( 0 ),
-  mActionStatus( DevelAnimatedVectorImageVisual::Action::STOP )
+  mActionStatus( DevelAnimatedVectorImageVisual::Action::STOP ),
+  mStopBehavior( DevelImageVisual::StopBehavior::CURRENT_FRAME ),
+  mLoopingMode( DevelImageVisual::LoopingMode::RESTART )
 {
   // the rasterized image is with pre-multiplied alpha format
   mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
@@ -144,6 +161,9 @@ void AnimatedVectorImageVisual::DoCreatePropertyMap( Property::Map& map ) const
   map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int >( mVectorRasterizeThread.GetPlayState() ) );
   map.Insert( Toolkit::DevelImageVisual::Property::CURRENT_FRAME_NUMBER, static_cast< int32_t >( mVectorRasterizeThread.GetCurrentFrameNumber() ) );
   map.Insert( Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, static_cast< int32_t >( mVectorRasterizeThread.GetTotalFrameNumber() ) );
+
+  map.Insert( Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, mStopBehavior );
+  map.Insert( Toolkit::DevelImageVisual::Property::LOOPING_MODE, mLoopingMode );
 }
 
 void AnimatedVectorImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
@@ -171,6 +191,14 @@ void AnimatedVectorImageVisual::DoSetProperties( const Property::Map& propertyMa
        {
           DoSetProperty( Toolkit::DevelImageVisual::Property::PLAY_RANGE, keyValue.second );
        }
+       else if( keyValue.first == STOP_BEHAVIOR_NAME )
+       {
+          DoSetProperty( Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, keyValue.second );
+       }
+       else if( keyValue.first == LOOPING_MODE_NAME )
+       {
+          DoSetProperty( Toolkit::DevelImageVisual::Property::LOOPING_MODE, keyValue.second );
+       }
     }
   }
 }
@@ -216,6 +244,22 @@ void AnimatedVectorImageVisual::DoSetProperty( Property::Index index, const Prop
       }
       break;
     }
+    case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR:
+    {
+      int32_t stopBehavior;
+      Scripting::GetEnumerationProperty( value, STOP_BEHAVIOR_TABLE, STOP_BEHAVIOR_TABLE_COUNT, stopBehavior );
+      mStopBehavior = DevelImageVisual::StopBehavior::Type( stopBehavior );
+      mResendFlag |= RESEND_STOP_BEHAVIOR;
+      break;
+    }
+    case Toolkit::DevelImageVisual::Property::LOOPING_MODE:
+    {
+      int32_t loopingMode;
+      Scripting::GetEnumerationProperty( value, LOOPING_MODE_TABLE, LOOPING_MODE_TABLE_COUNT, loopingMode );
+      mLoopingMode = DevelImageVisual::LoopingMode::Type( loopingMode );
+      mResendFlag |= RESEND_LOOPING_MODE;
+      break;
+    }
   }
 }
 
@@ -438,6 +482,16 @@ void AnimatedVectorImageVisual::SendAnimationData()
       mVectorRasterizeThread.SetPlayRange( mStartFrame, mEndFrame );
     }
 
+    if( mResendFlag & RESEND_STOP_BEHAVIOR )
+    {
+      mVectorRasterizeThread.SetStopBehavior( mStopBehavior );
+    }
+
+    if( mResendFlag & RESEND_LOOPING_MODE )
+    {
+      mVectorRasterizeThread.SetLoopingMode( mLoopingMode );
+    }
+
     if( IsOnStage() )
     {
       if( isPlaying )
index 8a8e7a9..23705d8 100644 (file)
@@ -178,6 +178,8 @@ private:
   int32_t                                      mEndFrame;
   uint32_t                                     mResendFlag;
   DevelAnimatedVectorImageVisual::Action::Type mActionStatus;
+  DevelImageVisual::StopBehavior::Type         mStopBehavior;
+  DevelImageVisual::LoopingMode::Type          mLoopingMode;
 };
 
 } // namespace Internal
index 038b608..70a3302 100644 (file)
@@ -44,12 +44,13 @@ constexpr auto NANOSECONDS_PER_SECOND( 1e+9 );
 Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_VECTOR_ANIMATION" );
 #endif
 
-inline void ResetToStart( bool& updated, uint32_t& value, uint32_t startValue, ConditionalWait& conditionalWait )
+inline void ResetValue( bool& updated, uint32_t& value, uint32_t newValue, ConditionalWait& conditionalWait )
 {
   ConditionalWait::ScopedLock lock( conditionalWait );
   if( !updated )
   {
-    value = startValue;
+    value = newValue;
+    updated = true;
   }
 }
 
@@ -61,7 +62,9 @@ VectorRasterizeThread::VectorRasterizeThread( const std::string& url )
   mConditionalWait(),
   mResourceReadyTrigger(),
   mAnimationFinishedTrigger(),
-  mPlayState( DevelImageVisual::PlayState::STOPPED ),
+  mPlayState( PlayState::STOPPED ),
+  mStopBehavior( DevelImageVisual::StopBehavior::CURRENT_FRAME ),
+  mLoopingMode( DevelImageVisual::LoopingMode::RESTART ),
   mFrameDurationNanoSeconds( 0 ),
   mFrameRate( 60.0f ),
   mCurrentFrame( 0 ),
@@ -76,6 +79,8 @@ VectorRasterizeThread::VectorRasterizeThread( const std::string& url )
   mDestroyThread( false ),
   mResourceReady( false ),
   mCurrentFrameUpdated( false ),
+  mForward( true ),
+  mUpdateFrameNumber( false ),
   mLogFactory( Dali::Adaptor::Get().GetLogFactory() )
 {
   Initialize();
@@ -140,24 +145,25 @@ void VectorRasterizeThread::PlayAnimation()
 {
   ConditionalWait::ScopedLock lock( mConditionalWait );
 
-  if( mPlayState != DevelImageVisual::PlayState::PLAYING )
+  if( mPlayState != PlayState::PLAYING )
   {
-    mPlayState = DevelImageVisual::PlayState::PLAYING;
+    mNeedRender = true;
+    mUpdateFrameNumber = false;
+    mPlayState = PlayState::PLAYING;
     mConditionalWait.Notify( lock );
 
-    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PlayAnimation: Start\n" );
+    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PlayAnimation: Play\n" );
   }
 }
 
 void VectorRasterizeThread::StopAnimation()
 {
   ConditionalWait::ScopedLock lock( mConditionalWait );
-  if( mPlayState != DevelImageVisual::PlayState::STOPPED )
+  if( mPlayState != PlayState::STOPPED && mPlayState != PlayState::STOPPING )
   {
-    mPlayState = DevelImageVisual::PlayState::STOPPED;
-
-    mCurrentFrame = mStartFrame;
-    mCurrentFrameUpdated = true;
+    mNeedRender = true;
+    mPlayState = PlayState::STOPPING;
+    mConditionalWait.Notify( lock );
 
     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StopAnimation: Stop\n" );
   }
@@ -166,9 +172,9 @@ void VectorRasterizeThread::StopAnimation()
 void VectorRasterizeThread::PauseAnimation()
 {
   ConditionalWait::ScopedLock lock( mConditionalWait );
-  if( mPlayState == DevelImageVisual::PlayState::PLAYING )
+  if( mPlayState == PlayState::PLAYING )
   {
-    mPlayState = DevelImageVisual::PlayState::PAUSED;
+    mPlayState = PlayState::PAUSED;
 
     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PauseAnimation: Pause\n" );
   }
@@ -252,6 +258,38 @@ void VectorRasterizeThread::SetPlayRange( uint32_t startFrame, uint32_t endFrame
   }
 }
 
+DevelImageVisual::PlayState::Type VectorRasterizeThread::GetPlayState() const
+{
+  DevelImageVisual::PlayState::Type state = DevelImageVisual::PlayState::STOPPED;
+
+  switch( mPlayState )
+  {
+    case PlayState::PLAYING:
+    {
+      state = DevelImageVisual::PlayState::PLAYING;
+      break;
+    }
+    case PlayState::PAUSED:
+    {
+      state = DevelImageVisual::PlayState::PAUSED;
+      break;
+    }
+    case PlayState::STOPPING:
+    case PlayState::STOPPED:
+    {
+      state = DevelImageVisual::PlayState::STOPPED;
+      break;
+    }
+  }
+
+  return state;
+}
+
+bool VectorRasterizeThread::IsResourceReady() const
+{
+  return mResourceReady;
+}
+
 void VectorRasterizeThread::SetCurrentFrameNumber( uint32_t frameNumber )
 {
   ConditionalWait::ScopedLock lock( mConditionalWait );
@@ -263,7 +301,7 @@ void VectorRasterizeThread::SetCurrentFrameNumber( uint32_t frameNumber )
 
     mResourceReady = false;
 
-    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetCurrentFrameNumber: frame number = %f (%d)\n", mCurrentFrame );
+    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetCurrentFrameNumber: frame number = %d\n", mCurrentFrame );
   }
   else
   {
@@ -286,14 +324,20 @@ void VectorRasterizeThread::GetDefaultSize( uint32_t& width, uint32_t& height )
   mVectorRenderer.GetDefaultSize( width, height );
 }
 
-DevelImageVisual::PlayState VectorRasterizeThread::GetPlayState() const
+void VectorRasterizeThread::SetStopBehavior( DevelImageVisual::StopBehavior::Type stopBehavior )
 {
-  return mPlayState;
+  ConditionalWait::ScopedLock lock( mConditionalWait );
+  mStopBehavior = stopBehavior;
+
+  DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetStopBehavior: stop behavor = %d\n", mStopBehavior );
 }
 
-bool VectorRasterizeThread::IsResourceReady() const
+void VectorRasterizeThread::SetLoopingMode( DevelImageVisual::LoopingMode::Type loopingMode )
 {
-  return mResourceReady;
+  ConditionalWait::ScopedLock lock( mConditionalWait );
+  mLoopingMode = loopingMode;
+
+  DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetLoopingMode: looping mode = %d\n", mLoopingMode );
 }
 
 void VectorRasterizeThread::Initialize()
@@ -302,7 +346,7 @@ void VectorRasterizeThread::Initialize()
 
   mTotalFrame = mVectorRenderer.GetTotalFrameNumber();
 
-  mEndFrame = mTotalFrame;
+  mEndFrame = mTotalFrame - 1;
 
   mFrameRate = mVectorRenderer.GetFrameRate();
   mFrameDurationNanoSeconds = NANOSECONDS_PER_SECOND / mFrameRate;
@@ -317,74 +361,96 @@ void VectorRasterizeThread::Initialize()
 
 void VectorRasterizeThread::Rasterize()
 {
-  bool resourceReady;
+  bool resourceReady, stopped = false;
   uint32_t currentFrame, startFrame, endFrame;
   int32_t loopCount;
-  DevelImageVisual::PlayState playState;
 
   {
     ConditionalWait::ScopedLock lock( mConditionalWait );
 
-    if( mPlayState != DevelImageVisual::PlayState::PLAYING && !mNeedRender && !mDestroyThread )
+    if( ( mPlayState == PlayState::PAUSED || mPlayState == PlayState::STOPPED ) && !mNeedRender && !mDestroyThread )
     {
       DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Wait\n" );
-
-      if( mPlayState == DevelImageVisual::PlayState::STOPPED )
-      {
-        // Reset the current loop
-        mCurrentLoop = 0;
-      }
       mConditionalWait.Wait( lock );
     }
 
+    if( mPlayState == PlayState::PLAYING && mUpdateFrameNumber )
+    {
+      mCurrentFrame = mForward ? mCurrentFrame + 1 : mCurrentFrame - 1;
+    }
+
     resourceReady = mResourceReady;
-    currentFrame = mCurrentFrame++;
+    currentFrame = mCurrentFrame;
     startFrame = mStartFrame;
     endFrame = mEndFrame;
     loopCount = mLoopCount;
-    playState = mPlayState;
 
     mNeedRender = false;
     mResourceReady = true;
     mCurrentFrameUpdated = false;
+    mUpdateFrameNumber = true;
   }
 
   auto currentFrameStartTime = std::chrono::system_clock::now();
 
-  // Rasterize
-  mVectorRenderer.Render( currentFrame );
+  if( mPlayState == PlayState::STOPPING )
+  {
+    currentFrame = GetStoppedFrame( startFrame, endFrame, currentFrame );
+    ResetValue( mCurrentFrameUpdated, mCurrentFrame, currentFrame, mConditionalWait );
 
-  if( playState == DevelImageVisual::PlayState::PLAYING )
+    stopped = true;
+  }
+  else if( mPlayState == PlayState::PLAYING )
   {
-    if( currentFrame >= endFrame )
+    bool animationFinished = false;
+
+    if( currentFrame >= endFrame )  // last frame
     {
-      if( loopCount < 0 )
+      if( mLoopingMode == DevelImageVisual::LoopingMode::AUTO_REVERSE )
       {
-        // repeat forever
-        ResetToStart( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait );  // If the current frame is changed in the event thread, don't overwrite it.
+        mForward = false;
       }
       else
       {
-        mCurrentLoop++;
-        if( mCurrentLoop >= loopCount )
+        if( loopCount < 0 || ++mCurrentLoop < loopCount )   // repeat forever or before the last loop
         {
-          mPlayState = DevelImageVisual::PlayState::STOPPED;
-
-          ResetToStart( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait );
-
-          // Animation is finished
-          mAnimationFinishedTrigger->Trigger();
-
-          DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished\n" );
+          ResetValue( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait );  // If the current frame is changed in the event thread, don't overwrite it.
+          mUpdateFrameNumber = false;
         }
         else
         {
-          ResetToStart( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait );
+          animationFinished = true;   // end of animation
         }
       }
     }
+    else if( currentFrame == startFrame && !mForward )  // first frame
+    {
+      if( loopCount < 0 || ++mCurrentLoop < loopCount )   // repeat forever or before the last loop
+      {
+        mForward = true;
+      }
+      else
+      {
+        animationFinished = true;   // end of animation
+      }
+    }
+
+    if( animationFinished )
+    {
+      if( mStopBehavior == DevelImageVisual::StopBehavior::CURRENT_FRAME )
+      {
+        stopped = true;
+      }
+      else
+      {
+        mPlayState = PlayState::STOPPING;
+      }
+    }
   }
 
+  // Rasterize
+  mVectorRenderer.Render( currentFrame );
+
   if( !resourceReady )
   {
     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Resource ready trigger\n" );
@@ -392,6 +458,18 @@ void VectorRasterizeThread::Rasterize()
     mResourceReadyTrigger->Trigger();
   }
 
+  if( stopped )
+  {
+    mPlayState = PlayState::STOPPED;
+    mForward = true;
+    mCurrentLoop = 0;
+
+    // Animation is finished
+    mAnimationFinishedTrigger->Trigger();
+
+    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished\n" );
+  }
+
   auto timeToSleepUntil = currentFrameStartTime + std::chrono::nanoseconds( mFrameDurationNanoSeconds );
 
 #if defined(DEBUG_ENABLED)
@@ -403,6 +481,39 @@ void VectorRasterizeThread::Rasterize()
   std::this_thread::sleep_until( timeToSleepUntil );
 }
 
+uint32_t VectorRasterizeThread::GetStoppedFrame( uint32_t startFrame, uint32_t endFrame, uint32_t currentFrame )
+{
+  uint32_t frame = currentFrame;
+
+  switch( mStopBehavior )
+  {
+    case DevelImageVisual::StopBehavior::FIRST_FRAME:
+    {
+      frame = startFrame;
+      break;
+    }
+    case DevelImageVisual::StopBehavior::LAST_FRAME:
+    {
+      if( mLoopingMode == DevelImageVisual::LoopingMode::AUTO_REVERSE )
+      {
+        frame = startFrame;
+      }
+      else
+      {
+        frame = endFrame;
+      }
+      break;
+    }
+    case DevelImageVisual::StopBehavior::CURRENT_FRAME:
+    {
+      frame = currentFrame;
+      break;
+    }
+  }
+
+  return frame;
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index c1c9c0b..ef262bd 100644 (file)
@@ -123,7 +123,7 @@ public:
    * @brief Get the play state
    * @return The play state
    */
-  DevelImageVisual::PlayState GetPlayState() const;
+  DevelImageVisual::PlayState::Type GetPlayState() const;
 
   /**
    * @brief Queries whether the resource is ready.
@@ -155,6 +155,19 @@ public:
    */
   void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
 
+  /**
+   * @brief Sets the stop behavior of the animation. This is performed when the animation is stopped.
+   * @param[in] stopBehavior The stop behavior
+   */
+  void SetStopBehavior( DevelImageVisual::StopBehavior::Type stopBehavior );
+
+  /**
+   * @brief Sets the looping mode.
+   * Animation plays forwards and then restarts from the beginning or runs backwards again.
+   * @param[in] loopingMode The looping mode
+   */
+  void SetLoopingMode( DevelImageVisual::LoopingMode::Type loopingMode );
+
 protected:
 
   /**
@@ -166,15 +179,20 @@ protected:
 private:
 
   /**
-   * @brief Initialize the vector renderer.
+   * @brief Initializes the vector renderer.
    */
   void Initialize();
 
   /**
-   * @brief Rasterize the current frame.
+   * @brief Rasterizes the current frame.
    */
   void Rasterize();
 
+  /**
+   * @brief Gets the frame number when the animation is stopped according to the stop behavior.
+   */
+  uint32_t GetStoppedFrame( uint32_t startFrame, uint32_t endFrame, uint32_t currentFrame );
+
   // Undefined
   VectorRasterizeThread( const VectorRasterizeThread& thread ) = delete;
 
@@ -183,13 +201,23 @@ private:
 
 private:
 
+  enum class PlayState
+  {
+    STOPPING,  ///< The animation is stopping
+    STOPPED,   ///< The animation has stopped
+    PLAYING,   ///< The animation is playing
+    PAUSED     ///< The animation is paused
+  };
+
   std::string                 mUrl;
   VectorAnimationRenderer     mVectorRenderer;
   ConditionalWait             mConditionalWait;
   std::unique_ptr< EventThreadCallback > mResourceReadyTrigger;
   std::unique_ptr< EventThreadCallback > mAnimationFinishedTrigger;
   Vector2                     mPlayRange;
-  DevelImageVisual::PlayState mPlayState;
+  PlayState                   mPlayState;
+  DevelImageVisual::StopBehavior::Type mStopBehavior;
+  DevelImageVisual::LoopingMode::Type mLoopingMode;
   int64_t                     mFrameDurationNanoSeconds;
   float                       mFrameRate;
   uint32_t                    mCurrentFrame;
@@ -204,6 +232,8 @@ private:
   bool                        mDestroyThread;  ///< Whether the thread be destroyed
   bool                        mResourceReady;
   bool                        mCurrentFrameUpdated;
+  bool                        mForward;
+  bool                        mUpdateFrameNumber;
   const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
 
 };
index 71545cc..af16305 100644 (file)
@@ -104,6 +104,8 @@ const char * const PLAY_RANGE_NAME( "playRange" );
 const char * const PLAY_STATE_NAME( "playState" );
 const char * const CURRENT_FRAME_NUMBER_NAME( "currentFrameNumber" );
 const char * const TOTAL_FRAME_NUMBER_NAME( "totalFrameNumber" );
+const char * const STOP_BEHAVIOR_NAME( "stopBehavior" );
+const char * const LOOPING_MODE_NAME( "loopingMode" );
 
 // Text visual
 const char * const TEXT_PROPERTY( "text" );
index 728a48e..fff497f 100644 (file)
@@ -89,6 +89,8 @@ extern const char * const PLAY_RANGE_NAME;
 extern const char * const PLAY_STATE_NAME;
 extern const char * const CURRENT_FRAME_NUMBER_NAME;
 extern const char * const TOTAL_FRAME_NUMBER_NAME;
+extern const char * const STOP_BEHAVIOR_NAME;
+extern const char * const LOOPING_MODE_NAME;
 
 // Text visual
 extern const char * const TEXT_PROPERTY;