(VectorAnimationRenderer) Add GetFrameRate method
[platform/core/uifw/dali-adaptor.git] / dali / internal / vector-animation / common / vector-animation-renderer-impl.h
1 #ifndef DALI_INTERNAL_VECTOR_ANIMATION_RENDERER_IMPL_H
2 #define DALI_INTERNAL_VECTOR_ANIMATION_RENDERER_IMPL_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
26 #include <dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace Adaptor
35 {
36
37 class VectorAnimationRenderer;
38 using VectorAnimationRendererPtr = IntrusivePtr< VectorAnimationRenderer >;
39
40 /**
41  * Dali internal VectorAnimationRenderer.
42  */
43 class VectorAnimationRenderer : public BaseObject
44 {
45 public:
46
47   /**
48    * @brief Creates a VectorAnimationRenderer object.
49    *
50    * @param[in] url The url of the vector animation file
51    */
52   static VectorAnimationRendererPtr New();
53
54   /**
55    * @brief Initializes member data.
56    */
57   void Initialize( const std::string& url );
58
59   /**
60    * @copydoc Dali::VectorAnimationRenderer::SetRenderer()
61    */
62   void SetRenderer( Dali::Renderer renderer );
63
64   /**
65    * @copydoc Dali::VectorAnimationRenderer::SetSize()
66    */
67   void SetSize( uint32_t width, uint32_t height );
68
69   /**
70    * @copydoc Dali::VectorAnimationRenderer::StartRender()
71    */
72   bool StartRender();
73
74   /**
75    * @copydoc Dali::VectorAnimationRenderer::StopRender()
76    */
77   void StopRender();
78
79   /**
80    * @copydoc Dali::VectorAnimationRenderer::Render()
81    */
82   void Render( uint32_t frameNumber );
83
84   /**
85    * @copydoc Dali::VectorAnimationRenderer::GetTotalFrameNumber()
86    */
87   uint32_t GetTotalFrameNumber() const;
88
89   /**
90    * @copydoc Dali::VectorAnimationRenderer::GetFrameRate()
91    */
92   float GetFrameRate() const;
93
94 private:
95
96   /**
97    * @brief Constructor
98    */
99   VectorAnimationRenderer();
100
101   /**
102    * @brief Destructor.
103    */
104   ~VectorAnimationRenderer();
105
106 private:
107
108   VectorAnimationRenderer( const VectorAnimationRenderer& ) = delete;
109   VectorAnimationRenderer& operator=( VectorAnimationRenderer& )  = delete;
110
111 private:
112
113   VectorAnimationRendererPluginProxy mPlugin;
114 };
115
116 } // namespace Adaptor
117
118 } // namespace Internal
119
120 inline static Internal::Adaptor::VectorAnimationRenderer& GetImplementation( Dali::VectorAnimationRenderer& renderer )
121 {
122   DALI_ASSERT_ALWAYS( renderer && "VectorAnimationRenderer handle is empty." );
123
124   BaseObject& handle = renderer.GetBaseObject();
125
126   return static_cast< Internal::Adaptor::VectorAnimationRenderer& >( handle );
127 }
128
129 inline static const Internal::Adaptor::VectorAnimationRenderer& GetImplementation( const Dali::VectorAnimationRenderer& renderer )
130 {
131   DALI_ASSERT_ALWAYS( renderer && "VectorAnimationRenderer handle is empty." );
132
133   const BaseObject& handle = renderer.GetBaseObject();
134
135   return static_cast< const Internal::Adaptor::VectorAnimationRenderer& >( handle );
136 }
137
138 } // namespace Dali
139
140 #endif // DALI_INTERNAL_VECTOR_ANIMATION_RENDERER_IMPL_H