X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-vector-image%2Fvector-rasterize-thread.h;h=3c8879e76fde7678d4f57ff79e64d94761ec9f50;hb=31b36444ed21fdf36b641ba9de528cc154b332ee;hp=f05f8b6c39b8c9cfec641b29242a627614d86ab8;hpb=3ca7994488b0b5e21bbb0d262c5fa2e4c731308b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.h b/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.h index f05f8b6..3c8879e 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.h +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.h @@ -25,6 +25,10 @@ #include #include #include +#include + +// INTERNAL INCLUDES +#include namespace Dali { @@ -46,11 +50,8 @@ public: * @brief Constructor. * * @param[in] url The url of the vector animation file - * @param[in] renderer The renderer used to render the image - * @param[in] width The width of the content - * @param[in] height The height of the content */ - VectorRasterizeThread( const std::string& url, Renderer renderer, uint32_t width, uint32_t height ); + VectorRasterizeThread( const std::string& url ); /** * @brief Destructor. @@ -58,6 +59,13 @@ public: virtual ~VectorRasterizeThread(); /** + * @brief Sets the renderer used to display the result image. + * + * @param[in] renderer The renderer used to display the result image + */ + void SetRenderer( Renderer renderer ); + + /** * @brief Sets the target image size. * * @param[in] width The target image width @@ -68,7 +76,7 @@ public: /** * @brief Play the vector animation. */ - void StartAnimation(); + void PlayAnimation(); /** * @brief Stop the vector animation. @@ -81,11 +89,6 @@ public: void PauseAnimation(); /** - * @brief Resume the vector animation. - */ - void ResumeAnimation(); - - /** * @brief Render one frame. The current frame number will be increased. */ void RenderFrame(); @@ -97,10 +100,22 @@ public: void SetResourceReadyCallback( EventThreadCallback* callback ); /** + * @brief This callback is called after the animation is finished. + * @param[in] callback The animation finished callback + */ + void SetAnimationFinishedCallback( EventThreadCallback* callback ); + + /** * @brief Enable looping for 'count' repeats. -1 means to repeat forever. * @param[in] count The number of times to loop */ - void SetLoopCount( int16_t count ); + 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. @@ -109,6 +124,36 @@ public: */ void SetPlayRange( Vector2 range ); + /** + * @brief Gets the playing range. + * @return The play range defined for the animation + */ + Vector2 GetPlayRange() const; + + /** + * @brief Get the play state + * @return The play state + */ + DevelImageVisual::PlayState GetPlayState() const; + + /** + * @brief Queries whether the resource is ready. + * @return true if ready, false otherwise + */ + 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. + */ + void SetCurrentProgress( float progress ); + + /** + * @brief Retrieves the current progress of the animation. + * @return The current progress as a normalized value between [0,1] + */ + float GetCurrentProgress() const; + protected: /** @@ -143,25 +188,28 @@ private: private: - std::string mUrl; - VectorAnimationRenderer mVectorRenderer; - ConditionalWait mConditionalWait; - Dali::Mutex mMutex; - EventThreadCallback* mResourceReadyTrigger; - Vector2 mPlayRange; - uint32_t mCurrentFrame; - uint32_t mTotalFrame; - uint32_t mStartFrame; - uint32_t mEndFrame; - uint32_t mWidth; - uint32_t mHeight; - int16_t mLoopCount; - int16_t mCurrentLoop; - bool mNeedRender; - bool mPlaying; - bool mPaused; - bool mDestroyThread; ///< Whether the thread be destroyed - bool mResourceReady; + std::string mUrl; + VectorAnimationRenderer mVectorRenderer; + ConditionalWait mConditionalWait; + Dali::Mutex mMutex; + std::unique_ptr< EventThreadCallback > mResourceReadyTrigger; + std::unique_ptr< EventThreadCallback > mAnimationFinishedTrigger; + Vector2 mPlayRange; + DevelImageVisual::PlayState mPlayState; + int64_t mFrameDurationNanoSeconds; + float mProgress; + float mFrameRate; + uint32_t mCurrentFrame; + uint32_t mTotalFrame; + uint32_t mStartFrame; + uint32_t mEndFrame; + uint32_t mWidth; + uint32_t mHeight; + int32_t mLoopCount; + int32_t mCurrentLoop; + bool mNeedRender; + bool mDestroyThread; ///< Whether the thread be destroyed + bool mResourceReady; const Dali::LogFactoryInterface& mLogFactory; ///< The log factory };