3669695001586f44450e052a26b3524687fc63cd
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / vector-animation-renderer-plugin.h
1 #ifndef DALI_VECTOR_ANIMATION_RENDERER_PLUGIN_H
2 #define DALI_VECTOR_ANIMATION_RENDERER_PLUGIN_H
3
4 /*
5  * Copyright (c) 2019 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/rendering/renderer.h>
23 #include <string>
24
25 namespace Dali
26 {
27
28 /**
29  * VectorAnimationRendererPlugin is an abstract interface, used by dali-adaptor to render a vector animation.
30  * A concrete implementation must be created for each platform and provided as a dynamic library which
31  * will be loaded at run time by the adaptor.
32  */
33 class VectorAnimationRendererPlugin
34 {
35 public:
36
37   /**
38    * @brief Constructor
39    */
40   VectorAnimationRendererPlugin() {}
41
42   /**
43    * @brief Destructor
44    */
45   virtual ~VectorAnimationRendererPlugin() {}
46
47   /**
48    * @brief Second-phase constructor.
49    *
50    * @param[in] url The url of the animation file
51    */
52   virtual bool Initialize( const std::string& url ) = 0;
53
54   /**
55    * @brief Sets the renderer used to display the result image.
56    *
57    * @param[in] renderer The renderer used to display the result image
58    */
59   virtual void SetRenderer( Renderer renderer ) = 0;
60
61   /**
62    * @brief Sets the target image size.
63    *
64    * @param[in] width The target image width
65    * @param[in] height The target image height
66    */
67   virtual void SetSize( uint32_t width, uint32_t height ) = 0;
68
69   /**
70    * @brief Renders the content to the target buffer synchronously.
71    *
72    * @param[in] frameNumber The frame number to be rendered
73    * @return True if the rendering success, false otherwise.
74    */
75   virtual bool Render( uint32_t frameNumber ) = 0;
76
77   /**
78    * @brief Gets the total number of frames of the file.
79    *
80    * @return The total number of frames
81    */
82   virtual uint32_t GetTotalFrameNumber() const = 0;
83
84   /**
85    * @brief Gets the frame rate of the file.
86    *
87    * @return The frame rate of the file
88    */
89   virtual float GetFrameRate() const = 0;
90
91   /**
92    * @brief Gets the default size of the file,.
93    *
94    * @return The default size of the file
95    */
96   virtual void GetDefaultSize( uint32_t& width, uint32_t& height ) const = 0;
97
98   /**
99    * @brief Function pointer called in adaptor to create a plugin instance.
100    */
101   using CreateVectorAnimationRendererFunction = VectorAnimationRendererPlugin* (*)();
102 };
103
104 } // namespace Dali
105
106 #endif // DALI_VECTOR_ANIMATION_RENDERER_PLUGIN_H