Revert "[Tizen] Add DALi Autofill implementation"
[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 // INTERNAL INCLUDES
26 #include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
27
28 namespace Dali
29 {
30
31 /**
32  * VectorAnimationRendererPlugin is an abstract interface, used by dali-adaptor to render a vector animation.
33  * A concrete implementation must be created for each platform and provided as a dynamic library which
34  * will be loaded at run time by the adaptor.
35  */
36 class VectorAnimationRendererPlugin
37 {
38 public:
39
40   using UploadCompletedSignalType = Dali::VectorAnimationRenderer::UploadCompletedSignalType;
41
42   /**
43    * @brief Constructor
44    */
45   VectorAnimationRendererPlugin() {}
46
47   /**
48    * @brief Destructor
49    */
50   virtual ~VectorAnimationRendererPlugin() {}
51
52   /**
53    * @brief Second-phase constructor.
54    *
55    * @param[in] url The url of the animation file
56    */
57   virtual bool Initialize( const std::string& url ) = 0;
58
59   /**
60    * @brief Finalizes the renderer. It will be called in the main thread.
61    */
62   virtual void Finalize() = 0;
63
64   /**
65    * @brief Sets the renderer used to display the result image.
66    *
67    * @param[in] renderer The renderer used to display the result image
68    */
69   virtual void SetRenderer( Renderer renderer ) = 0;
70
71   /**
72    * @brief Sets the target image size.
73    *
74    * @param[in] width The target image width
75    * @param[in] height The target image height
76    */
77   virtual void SetSize( uint32_t width, uint32_t height ) = 0;
78
79   /**
80    * @brief Renders the content to the target buffer synchronously.
81    *
82    * @param[in] frameNumber The frame number to be rendered
83    * @return True if the rendering success, false otherwise.
84    */
85   virtual bool Render( uint32_t frameNumber ) = 0;
86
87   /**
88    * @brief Gets the total number of frames of the file.
89    *
90    * @return The total number of frames
91    */
92   virtual uint32_t GetTotalFrameNumber() const = 0;
93
94   /**
95    * @brief Gets the frame rate of the file.
96    *
97    * @return The frame rate of the file
98    */
99   virtual float GetFrameRate() const = 0;
100
101   /**
102    * @brief Gets the default size of the file.
103    *
104    * @param[out] width The default width of the file
105    * @param[out] height The default height of the file
106    */
107   virtual void GetDefaultSize( uint32_t& width, uint32_t& height ) const = 0;
108
109   /**
110    * @brief Gets the layer information of all the child layers.
111    *
112    * @param[out] map The layer information
113    */
114   virtual void GetLayerInfo( Property::Map& map ) const = 0;
115
116   /**
117    * @brief Gets the start frame and the end frame number of the composition marker.
118    *
119    * @param[in] marker The composition marker of the file
120    * @param[out] startFrame The start frame number of the specified marker
121    * @param[out] endFrame The end frame number of the specified marker
122    * @return True if the marker is found in the file, false otherwise.
123    *
124    * @note https://helpx.adobe.com/after-effects/using/layer-markers-composition-markers.html
125    * Markers exported from AfterEffect are used to describe a segment of an animation {comment/tag , startFrame, endFrame}
126    * Marker can be use to devide a resource in to separate animations by tagging the segment with comment string,
127    * start frame and duration of that segment.
128    */
129   virtual bool GetMarkerInfo( const std::string& marker, uint32_t& startFrame, uint32_t& endFrame ) const = 0;
130
131   /**
132    * @brief Ignores a rendered frame which is not shown yet.
133    */
134   virtual void IgnoreRenderedFrame() = 0;
135
136   /**
137    * @brief Connect to this signal to be notified when the texture upload is completed.
138    *
139    * @return The signal to connect to.
140    */
141   virtual UploadCompletedSignalType& UploadCompletedSignal() = 0;
142
143   /**
144    * @brief Function pointer called in adaptor to create a plugin instance.
145    */
146   using CreateVectorAnimationRendererFunction = VectorAnimationRendererPlugin* (*)();
147 };
148
149 } // namespace Dali
150
151 #endif // DALI_VECTOR_ANIMATION_RENDERER_PLUGIN_H