Merge "Add OffscreenApplication" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / vector-image-renderer-plugin.h
1 #ifndef DALI_VECTOR_IMAGE_RENDERER_PLUGIN_H
2 #define DALI_VECTOR_IMAGE_RENDERER_PLUGIN_H
3
4 /*
5  * Copyright (c) 2020 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 <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
26 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
27
28 namespace Dali
29 {
30
31 /**
32  * VectorImageRendererPlugin is an abstract interface, used by dali-adaptor to render a vector image(SVG).
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 VectorImageRendererPlugin
37 {
38 public:
39   /**
40    * @brief Constructor
41    */
42   VectorImageRendererPlugin() {}
43
44   /**
45    * @brief Destructor
46    */
47   virtual ~VectorImageRendererPlugin() {}
48
49   /**
50    * @brief Second-phase constructor.
51    */
52   virtual bool Initialize() = 0;
53
54   /**
55    * @brief Sets the target buffer.
56    *
57    * @param[in] buffer The target buffer
58    */
59   virtual void SetBuffer( Dali::Devel::PixelBuffer &buffer ) = 0;
60
61   /**
62    * @brief Renders the content to the target buffer synchronously.
63    *
64    * @param[in] scale The target image scale
65    * @return True if the rendering success, false otherwise.
66    */
67   virtual bool Render(float scale) = 0;
68
69   /**
70    * @brief Load vector image data form url.
71    *
72    * @param[in] url The url of the vector image file
73    * @return True if the load success, false otherwise.
74    */
75   virtual bool Load( const std::string& url ) = 0;
76
77   /**
78    * @brief Load vector image data directly.
79    *
80    * @param[in] data The memory data of vector image
81    * @param[in] size The size of memory data
82    * @return True if the load success, false otherwise.
83    */
84   virtual bool Load( const char *data, uint32_t size ) = 0;
85
86   /**
87    * @brief Gets the default size of the file.
88    *
89    * @param[out] width The default width of the file
90    * @param[out] height The default height of the file
91    */
92   virtual void GetDefaultSize( uint32_t& width, uint32_t& height ) const = 0;
93
94   /**
95    * @brief Function pointer called in adaptor to create a plugin instance.
96    */
97   using CreateVectorImageRendererFunction = VectorImageRendererPlugin* (*)();
98 };
99
100 } // namespace Dali
101 #endif // DALI_VECTOR_IMAGE_RENDERER_PLUGIN_H