[4.0] Add Vector animation renderer
[platform/core/uifw/dali-adaptor.git] / adaptors / devel-api / adaptor-framework / vector-animation-renderer.h
1 #ifndef DALI_VECTOR_ANIMATION_RENDERER_H
2 #define DALI_VECTOR_ANIMATION_RENDERER_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-handle.h>
23 #include <dali/public-api/rendering/renderer.h>
24
25 namespace Dali
26 {
27 /**
28  * @addtogroup dali_adaptor_framework
29  * @{
30  */
31
32 namespace Internal DALI_INTERNAL
33 {
34 namespace Adaptor
35 {
36 class VectorAnimationRenderer;
37 }
38 }
39
40 /**
41  * @brief Used for rendering a vector animation file
42  */
43 class DALI_IMPORT_API VectorAnimationRenderer : public BaseHandle
44 {
45 public:
46
47   /**
48    * @brief Creates an initialized handle to a new VectorAnimationRenderer.
49    *
50    * @param[in] url The url of the vector animation file
51    * @param[in] renderer The renderer used to render the image
52    * @param[in] width The width of the content
53    * @param[in] height The height of the content
54    * @return A handle to a newly allocated VectorAnimationRenderer
55    */
56   static VectorAnimationRenderer New( const std::string& url, Renderer renderer, uint32_t width, uint32_t height );
57
58   /**
59    * @brief Creates an empty handle.
60    * Use VectorAnimationRenderer::New() to create an initialized object.
61    */
62   VectorAnimationRenderer();
63
64   /**
65    * @brief Destructor.
66    */
67   ~VectorAnimationRenderer();
68
69   /**
70    * @brief This copy constructor is required for (smart) pointer semantics.
71    *
72    * @param[in] handle A reference to the copied handle
73    */
74   VectorAnimationRenderer( const VectorAnimationRenderer& handle );
75
76   /**
77    * @brief This assignment operator is required for (smart) pointer semantics.
78    *
79    * @param[in] rhs A reference to the copied handle
80    * @return A reference to this
81    */
82   VectorAnimationRenderer& operator=( const VectorAnimationRenderer& rhs );
83
84   /**
85    * @brief Starts the rendering.
86    *
87    * @return True if the renderer is successfully started, false otherwise.
88    */
89   bool StartRender();
90
91   /**
92    * @brief Stops the rendering.
93    */
94   void StopRender();
95
96   /**
97    * @brief Renders the content to the target buffer synchronously.
98    *
99    * @param[in] frameNumber The frame number to be rendered
100    */
101   void Render( uint32_t frameNumber );
102
103   /**
104    * @brief Gets the total number of frames of the file
105    *
106    * @return The total number of frames
107    */
108   uint32_t GetTotalFrameNumber();
109
110 public: // Signals
111
112 public: // Not intended for application developers
113
114   /// @cond internal
115   /**
116    * @brief The constructor.
117    * @note  Not intended for application developers.
118    *
119    * @param[in] pointer A pointer to a newly allocated VectorAnimationRenderer
120    */
121   explicit DALI_INTERNAL VectorAnimationRenderer( Internal::Adaptor::VectorAnimationRenderer* internal );
122   /// @endcond
123
124 };
125
126 /**
127  * @}
128  */
129 } // namespace Dali
130
131 #endif // DALI_VECTOR_ANIMATION_RENDERER_H