{
}
-void Adaptor::SetUseHardwareVSync(bool useHardware)
-{
-}
-
Adaptor& Adaptor::Get()
{
return Internal::Adaptor::Adaptor::Get();
ToolkitTestApplication application;
tet_infoline( "UtcDaliVisualFactoryGetAnimatedVectorImageVisual03: 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( 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, Vector2( 0.2f, 0.8f ) );
+ .Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
ToolkitTestApplication application;
tet_infoline( "UtcDaliAnimatedVectorImageVisualGetPropertyMap01" );
- Vector2 playRange( 0.2f, 0.8f );
+ int startFrame = 1, endFrame = 3;
+ Property::Array playRange;
+ playRange.PushBack( startFrame );
+ playRange.PushBack( endFrame );
Property::Map propertyMap;
propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get< int >() == 3 );
- value = resultMap.Find( DevelImageVisual::Property::PLAY_RANGE, Property::VECTOR2 );
+ value = resultMap.Find( DevelImageVisual::Property::PLAY_RANGE, Property::ARRAY );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get< Vector2 >() == playRange );
+
+ 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 );
// request AnimatedVectorImageVisual with an URL
Visual::Base visual2 = factory.CreateVisual( TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions() );
ToolkitTestApplication application;
tet_infoline( "UtcDaliAnimatedVectorImageVisualPlayRange" );
- Vector2 playRange( 0.8f, 0.2f );
+ int startFrame = 3, endFrame = 1;
+ Property::Array array;
+ array.PushBack( startFrame );
+ array.PushBack( endFrame );
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::PLAY_RANGE, playRange );
+ .Add( DevelImageVisual::Property::PLAY_RANGE, array );
Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
- DALI_TEST_EQUALS( value->Get< Vector2 >(), playRange, TEST_LOCATION );
+
+ int resultStartFrame, resultEndFrame;
+ Property::Array* result = value->GetArray();
+ result->GetElementAt( 0 ).Get( resultStartFrame );
+ result->GetElementAt( 1 ).Get( resultEndFrame );
+
+ DALI_TEST_EQUALS( startFrame, resultStartFrame, TEST_LOCATION );
+ DALI_TEST_EQUALS( endFrame, resultEndFrame, TEST_LOCATION );
+
+ // Set invalid play range
+ array.Clear();
+ array.PushBack( -1 );
+ array.PushBack( 100 );
+
+ attributes.Clear();
+ attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array );
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+ application.SendNotification();
+ application.Render();
+
+ map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
+
+ result = value->GetArray();
+ result->GetElementAt( 0 ).Get( resultStartFrame );
+ result->GetElementAt( 1 ).Get( resultEndFrame );
+
+ DALI_TEST_EQUALS( startFrame, resultStartFrame, TEST_LOCATION ); // Should not be changed
+ DALI_TEST_EQUALS( endFrame, resultEndFrame, TEST_LOCATION );
END_TEST;
}
END_TEST;
}
-int UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress(void)
+int UtcDaliAnimatedVectorImageVisualJumpTo(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress" );
+ tet_infoline( "UtcDaliAnimatedVectorImageVisualJumpTo" );
Property::Map propertyMap;
propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
- DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 0.6f );
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 2 );
application.SendNotification();
application.Render();
Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
- DALI_TEST_EQUALS( value->Get< float >(), 0.6f, TEST_LOCATION );
+ Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+ DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION );
- Vector2 playRange( 0.0f, 0.4f );
+ Property::Array array;
+ array.PushBack( 0 );
+ array.PushBack( 2 );
Property::Map attributes;
- attributes.Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
+ attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array );
DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
- DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 0.8f );
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3 );
application.SendNotification();
application.Render();
map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
- DALI_TEST_EQUALS( value->Get< float >(), 0.4f, TEST_LOCATION );
+ value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+ DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION );
// Change play range
attributes.Clear();
- attributes.Add( DevelImageVisual::Property::PLAY_RANGE, Vector2( 0.0f, 1.0f ) );
+ array.Clear();
+
+ array.PushBack( 0 );
+ array.PushBack( 4 );
+
+ attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array );
DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
attributes.Clear();
application.SendNotification();
application.Render();
- // Stop and jump to 0.2
+ // Stop and jump to 3
DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
- DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 0.2f );
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3 );
application.SendNotification();
application.Render();
map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
- DALI_TEST_EQUALS( value->Get< float >(), 0.2f, TEST_LOCATION );
+ value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
+ DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION );
END_TEST;
}
ToolkitTestApplication application;
tet_infoline( "UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress" );
- Vector2 playRange( 0.2f, 0.5f );
+ int startFrame = 1, endFrame = 3;
+ Property::Array playRange;
+ playRange.PushBack( startFrame );
+ playRange.PushBack( endFrame );
Property::Map propertyMap;
propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
Property::Value* value = map.Find( DevelImageVisual::Property::LOOP_COUNT );
DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION );
- value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
- DALI_TEST_EQUALS( value->Get< Vector2 >(), playRange, TEST_LOCATION );
+ value = map.Find( DevelImageVisual::Property::PLAY_RANGE, Property::ARRAY );
+ DALI_TEST_CHECK( value );
- Vector2 newPlayRange( 0.6f, 1.0f );
+ 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 );
+
+ playRange.Clear();
+ playRange.PushBack( 0 );
+ playRange.PushBack( 2 );
Property::Map attributes;
- attributes.Add( DevelImageVisual::Property::PLAY_RANGE, newPlayRange );
+ attributes.Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
attributes.Add( DevelImageVisual::Property::LOOP_COUNT, 5 );
DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
DALI_TEST_EQUALS( value->Get< int >(), 5, TEST_LOCATION );
value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
- DALI_TEST_EQUALS( value->Get< Vector2 >(), newPlayRange, TEST_LOCATION );
+ result = value->GetArray();
+ DALI_TEST_CHECK( result );
+
+ DALI_TEST_CHECK( result->GetElementAt( 0 ).Get< int >() == 0 );
+ DALI_TEST_CHECK( result->GetElementAt( 1 ).Get< int >() == 2 );
attributes.Clear();
+
+ playRange.Clear();
+ playRange.PushBack( startFrame );
+ playRange.PushBack( endFrame );
+
attributes.Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
- DALI_TEST_EQUALS( value->Get< Vector2 >(), playRange, TEST_LOCATION );
+
+ 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 );
END_TEST;
}
PLAY, ///< Play the animated vector image.
PAUSE, ///< Pause the animated vector image.
STOP, ///< Stop the animated vector image. This is also Default playback mode.
- JUMP_TO, ///< Jump to the specified frame. Property::FLOAT value should be passed.
+ JUMP_TO, ///< Jump to the specified frame. Property::INTEGER value should be passed.
UPDATE_PROPERTY ///< Update the properties of the animated vector image.
};
AUXILIARY_IMAGE_ALPHA = ORIENTATION_CORRECTION + 2,
/**
- * @brief The number of times the AnimatedImageVisual will be looped.
+ * @brief The number of times the AnimatedImageVisual or AnimatedVectorImageVisual will be looped.
* @details Name "loopCount", type Property::INTEGER.
* @note For Animated images only. Default -1. if < 0, loop unlimited. else, loop loopCount times.
*/
/**
* @brief The playing range the AnimatedVectorImageVisual will use.
*
- * Animation will play between the values specified. Both values should be between 0-1,
- * otherwise they will be ignored. If the range provided is not in proper order ( minimum,maximum ), it will be reordered.
+ * Animation will play between the values specified. The array can only have two values, and more will be ignored.
+ * Both values should be between 0 and the total frame number, otherwise they will be ignored.
+ * If the range provided is not in proper order ( minimum, maximum ), it will be reordered.
*
- * @details Name "playRange", Type Property::VECTOR2, between 0 and 1
- * @note Default 0 and 1
+ * @details Name "playRange", Type Property::ARRAY of Property::INTEGER
+ * @note Default 0 and the total frame number.
*/
PLAY_RANGE = ORIENTATION_CORRECTION + 4,
PLAY_STATE = ORIENTATION_CORRECTION + 5,
/**
- * @brief The animation progress the AnimatedVectorImageVisual will use.
- * @details Name "currentProgress", Type Property::FLOAT, between [0, 1] or between the play range if specified
+ * @brief The current frame number the AnimatedVectorImageVisual will use.
+ * @details Name "currentFrameNumber", Type Property::INTEGER, between [0, the maximum frame number] or between the play range if specified
* @note This property is read-only.
*/
- CURRENT_PROGRESS = ORIENTATION_CORRECTION + 6
+ CURRENT_FRAME_NUMBER = ORIENTATION_CORRECTION + 6,
+
+ /**
+ * @brief The total frame number the AnimatedVectorImageVisual will use.
+ * @details Name "totalFrameNumber", Type Property::INTEGER.
+ * @note This property is read-only.
+ */
+ TOTAL_FRAME_NUMBER = ORIENTATION_CORRECTION + 7
};
} //namespace Property
// Checks if the current character is supported by the selected font.
isValidFont = fontClient.IsCharacterSupportedByFont( fontId, character );
- // Emojis are present in many monochrome fonts; prefer color by default.
- if( isValidFont &&
- isEmojiScript )
- {
- const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
-
- // For color emojis, the font is valid if the glyph is a color glyph (the bitmap is RGBA).
- isValidFont = fontClient.IsColorGlyph( fontId, glyphIndex );
- }
-
// If there is a valid font, cache it.
if( isValidFont && !isCommonScript )
{
DefaultFonts* defaultFontsPerScript = NULL;
- // Emojis are present in many monochrome fonts; prefer color by default.
- const bool preferColor = ( TextAbstraction::EMOJI == script );
-
// Find a fallback-font.
fontId = fontClient.FindFallbackFont( character,
currentFontDescription,
currentFontPointSize,
- preferColor );
+ false );
if( 0u == fontId )
{
mUrl( imageUrl ),
mVectorRasterizeThread( imageUrl.GetUrl() ),
mVisualSize(),
- mPlayRange( 0.0f, 1.0f ),
mPlacementActor(),
mLoopCount( LOOP_FOREVER ),
+ mStartFrame( 0 ),
+ mEndFrame( 0 ),
mResendFlag( 0 ),
mActionStatus( DevelAnimatedVectorImageVisual::Action::STOP )
{
map.Insert( Toolkit::ImageVisual::Property::URL, mUrl.GetUrl() );
}
map.Insert( Toolkit::DevelImageVisual::Property::LOOP_COUNT, mLoopCount );
- map.Insert( Toolkit::DevelImageVisual::Property::PLAY_RANGE, mPlayRange );
+
+ Property::Array playRange;
+ playRange.PushBack( mStartFrame );
+ playRange.PushBack( mEndFrame );
+ map.Insert( Toolkit::DevelImageVisual::Property::PLAY_RANGE, playRange );
+
map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int >( mVectorRasterizeThread.GetPlayState() ) );
- map.Insert( Toolkit::DevelImageVisual::Property::CURRENT_PROGRESS, mVectorRasterizeThread.GetCurrentProgress() );
+ 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() ) );
}
void AnimatedVectorImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
}
case Toolkit::DevelImageVisual::Property::PLAY_RANGE:
{
- Vector2 range;
- if( value.Get( range ) )
+ Property::Array* array = value.GetArray();
+ if( array )
{
- mPlayRange = range;
- mResendFlag |= RESEND_PLAY_RANGE;
+ size_t count = array->Count();
+ if( count >= 2 )
+ {
+ int startFrame, endFrame;
+ int totalFrame = mVectorRasterizeThread.GetTotalFrameNumber();
+ array->GetElementAt( 0 ).Get( startFrame );
+ array->GetElementAt( 1 ).Get( endFrame );
+
+ if( startFrame >= 0 && startFrame < totalFrame && endFrame >= 0 && endFrame < totalFrame )
+ {
+ mStartFrame = startFrame;
+ mEndFrame = endFrame;
+ mResendFlag |= RESEND_PLAY_RANGE;
+ }
+ else
+ {
+ DALI_LOG_ERROR( "Invalid play range [%d, %d / %d]\n", startFrame, endFrame, totalFrame );
+ }
+ }
}
break;
}
}
case DevelAnimatedVectorImageVisual::Action::JUMP_TO:
{
- float progress;
- if( attributes.Get( progress ) )
+ int32_t frameNumber;
+ if( attributes.Get( frameNumber ) )
{
- mVectorRasterizeThread.SetCurrentProgress( progress );
+ mVectorRasterizeThread.SetCurrentFrameNumber( frameNumber );
if( IsOnStage() && mVectorRasterizeThread.GetPlayState() != DevelImageVisual::PlayState::PLAYING )
{
if( mResendFlag & RESEND_PLAY_RANGE )
{
- mVectorRasterizeThread.SetPlayRange( mPlayRange );
+ mVectorRasterizeThread.SetPlayRange( mStartFrame, mEndFrame );
}
if( IsOnStage() )
VisualUrl mUrl;
VectorRasterizeThread mVectorRasterizeThread;
Vector2 mVisualSize;
- Vector2 mPlayRange;
WeakHandle< Actor > mPlacementActor;
int32_t mLoopCount;
+ int32_t mStartFrame;
+ int32_t mEndFrame;
uint32_t mResendFlag;
DevelAnimatedVectorImageVisual::Action::Type mActionStatus;
};
/*
- * 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.
mConditionalWait(),
mResourceReadyTrigger(),
mAnimationFinishedTrigger(),
- mPlayRange( 0.0f, 1.0f ),
mPlayState( DevelImageVisual::PlayState::STOPPED ),
mFrameDurationNanoSeconds( 0 ),
- mProgress( 0.0f ),
mFrameRate( 60.0f ),
mCurrentFrame( 0 ),
mTotalFrame( 0 ),
}
}
-int32_t VectorRasterizeThread::GetLoopCount() const
+void VectorRasterizeThread::SetPlayRange( uint32_t startFrame, uint32_t endFrame )
{
- return mLoopCount;
-}
-
-void VectorRasterizeThread::SetPlayRange( Vector2 range )
-{
- // Make sure the range specified is between 0.0 and 1.0
- if( range.x >= 0.0f && range.x <= 1.0f && range.y >= 0.0f && range.y <= 1.0f )
+ // Make sure the range specified is between 0 and the total frame number
+ if( ( startFrame < mTotalFrame ) && ( endFrame < mTotalFrame ) )
{
- Vector2 orderedRange( range );
// If the range is not in order swap values
- if( range.x > range.y )
+ if( startFrame > endFrame )
{
- orderedRange = Vector2( range.y, range.x );
+ uint32_t temp = startFrame;
+ startFrame = endFrame;
+ endFrame = temp;
}
- if( mPlayRange != orderedRange )
+ if( startFrame != mStartFrame || endFrame != mEndFrame )
{
ConditionalWait::ScopedLock lock( mConditionalWait );
- mPlayRange = orderedRange;
-
- mStartFrame = static_cast< uint32_t >( mPlayRange.x * mTotalFrame + 0.5f );
- mEndFrame = static_cast< uint32_t >( mPlayRange.y * mTotalFrame + 0.5f );
+ mStartFrame = startFrame;
+ mEndFrame = endFrame;
// If the current frame is out of the range, change the current frame also.
if( mStartFrame > mCurrentFrame )
mResourceReady = false;
}
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetPlayRange: [%d, %d]\n", mStartFrame, mEndFrame );
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetPlayRangeInFrame: [%d, %d]\n", mStartFrame, mEndFrame );
}
}
}
-Vector2 VectorRasterizeThread::GetPlayRange() const
-{
- return mPlayRange;
-}
-
-void VectorRasterizeThread::SetCurrentProgress( float progress )
+void VectorRasterizeThread::SetCurrentFrameNumber( uint32_t frameNumber )
{
ConditionalWait::ScopedLock lock( mConditionalWait );
- if( progress >= mPlayRange.x && progress <= mPlayRange.y )
+ if( frameNumber >= mStartFrame && frameNumber <= mEndFrame )
{
- mProgress = progress;
-
- mCurrentFrame = static_cast< uint32_t >( mTotalFrame * progress + 0.5f );
+ mCurrentFrame = frameNumber;
mCurrentFrameUpdated = true;
mResourceReady = false;
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetCurrentProgress: progress = %f (%d)\n", progress, mCurrentFrame );
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetCurrentFrameNumber: frame number = %f (%d)\n", mCurrentFrame );
+ }
+ else
+ {
+ DALI_LOG_ERROR( "Invalid frame number [%d (%d, %d)]\n", frameNumber, mStartFrame, mEndFrame );
}
}
-float VectorRasterizeThread::GetCurrentProgress() const
+uint32_t VectorRasterizeThread::GetCurrentFrameNumber() const
{
- return ( static_cast< float >( mCurrentFrame ) / static_cast< float >( mTotalFrame ) );
+ return mCurrentFrame;
+}
+
+uint32_t VectorRasterizeThread::GetTotalFrameNumber() const
+{
+ return mTotalFrame;
}
void VectorRasterizeThread::GetDefaultSize( uint32_t& width, uint32_t& height ) const
mTotalFrame = mVectorRenderer.GetTotalFrameNumber();
- mStartFrame = static_cast< uint32_t >( mPlayRange.x * mTotalFrame + 0.5f );
- mEndFrame = static_cast< uint32_t >( mPlayRange.y * mTotalFrame + 0.5f );
-
- mCurrentFrame = std::max( static_cast< uint32_t >( mTotalFrame * mProgress + 0.5f ), mStartFrame );
+ mEndFrame = mTotalFrame;
mFrameRate = mVectorRenderer.GetFrameRate();
mFrameDurationNanoSeconds = NANOSECONDS_PER_SECOND / mFrameRate;
void SetLoopCount( int32_t count );
/**
- * @brief Gets the loop count. -1 means to repeat forever.
- * @return The number of times to loop
- */
- int32_t GetLoopCount() const;
-
- /**
- * @brief Set the playing range.
- * @param[in] range Two values between [0,1] to specify minimum and maximum progress.
+ * @brief Set the playing range in frame number.
+ * @param[in] startFrame The frame number to specify minimum progress.
+ * @param[in] endFrame The frame number to specify maximum progress.
* The animation will play between those values.
*/
- void SetPlayRange( Vector2 range );
-
- /**
- * @brief Gets the playing range.
- * @return The play range defined for the animation
- */
- Vector2 GetPlayRange() const;
+ void SetPlayRange( uint32_t startFrame, uint32_t endFrame );
/**
* @brief Get the play state
bool IsResourceReady() const;
/**
- * @brief Sets the progress of the animation.
- * @param[in] progress The new progress as a normalized value between [0,1] or between the play range if specified.
+ * @brief Sets the current frame number of the animation.
+ * @param[in] frameNumber The new frame number between [0, the maximum frame number] or between the play range if specified.
+ */
+ void SetCurrentFrameNumber( uint32_t frameNumber );
+
+ /**
+ * @brief Retrieves the current frame number of the animation.
+ * @return The current frame number
*/
- void SetCurrentProgress( float progress );
+ uint32_t GetCurrentFrameNumber() const;
/**
- * @brief Retrieves the current progress of the animation.
- * @return The current progress as a normalized value between [0,1]
+ * @brief Retrieves the total frame number of the animation.
+ * @return The total frame number
*/
- float GetCurrentProgress() const;
+ uint32_t GetTotalFrameNumber() const;
/**
* @brief Gets the default size of the file,.
Vector2 mPlayRange;
DevelImageVisual::PlayState mPlayState;
int64_t mFrameDurationNanoSeconds;
- float mProgress;
float mFrameRate;
uint32_t mCurrentFrame;
uint32_t mTotalFrame;
const char * const AUXILIARY_IMAGE_ALPHA_NAME("auxiliaryImageAlpha");
const char * const PLAY_RANGE_NAME( "playRange" );
const char * const PLAY_STATE_NAME( "playState" );
-const char * const CURRENT_PROGRESS_NAME( "currentProgress" );
+const char * const CURRENT_FRAME_NUMBER_NAME( "currentFrameNumber" );
+const char * const TOTAL_FRAME_NUMBER_NAME( "totalFrameNumber" );
// Text visual
const char * const TEXT_PROPERTY( "text" );
extern const char * const AUXILLARY_IMAGE_ALPHA_NAME;
extern const char * const PLAY_RANGE_NAME;
extern const char * const PLAY_STATE_NAME;
-extern const char * const CURRENT_PROGRESS_NAME;
+extern const char * const CURRENT_FRAME_NUMBER_NAME;
+extern const char * const TOTAL_FRAME_NUMBER_NAME;
// Text visual
extern const char * const TEXT_PROPERTY;
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 25;
+const unsigned int TOOLKIT_MICRO_VERSION = 26;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.4.25
+Version: 1.4.26
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT