(Android Build) Use the sysroot defined by the system
[platform/core/uifw/dali-adaptor.git] / dali / internal / vector-image / common / vector-image-renderer-plugin-proxy.h
1 #ifndef DALI_INTERNAL_VECTOR_IMAGE_RENDERER_PLUGIN_PROXY_H
2 #define DALI_INTERNAL_VECTOR_IMAGE_RENDERER_PLUGIN_PROXY_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 // INTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/vector-image-renderer-plugin.h>
23 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 namespace Adaptor
32 {
33
34 /**
35  * Proxy class to dynamically load, use and unload vector image renderer plugin.
36  */
37 class VectorImageRendererPluginProxy
38 {
39 public:
40
41   /**
42    * @brief Constructor
43    */
44   VectorImageRendererPluginProxy( std::string sharedObjectName );
45
46   /**
47    * @brief Destructor
48    */
49   ~VectorImageRendererPluginProxy();
50
51   /**
52    * @brief Query whether the plugin is valid or not.
53    * @return True if valid, false otherwise
54    */
55   bool IsValid() const;
56
57   /**
58    * @copydoc Dali::VectorImageRendererPlugin::Load()
59    */
60   bool Load(const Vector<uint8_t>& data);
61
62   /**
63    * @copydoc Dali::VectorImageRendererPlugin::Rasterize()
64    */
65   bool Rasterize(Dali::Devel::PixelBuffer& buffer, float scale);
66
67   /**
68    * @copydoc Dali::VectorImageRendererPlugin::GetDefaultSize()
69    */
70   void GetDefaultSize(uint32_t& width, uint32_t& height) const;
71
72   // Not copyable or movable
73   VectorImageRendererPluginProxy( const VectorImageRendererPluginProxy& ) = delete; ///< Deleted copy constructor
74   VectorImageRendererPluginProxy( VectorImageRendererPluginProxy&& ) = delete; ///< Deleted move constructor
75   VectorImageRendererPluginProxy& operator=( const VectorImageRendererPluginProxy& ) = delete; ///< Deleted copy assignment operator
76   VectorImageRendererPluginProxy& operator=( VectorImageRendererPluginProxy&& ) = delete; ///< Deleted move assignment operator
77
78 private:
79
80   /**
81    * Dynamically loads the plugin.
82    */
83   void InitializePlugin();
84
85 private:
86
87   using CreateVectorImageRendererFunction = Dali::VectorImageRendererPlugin* (*)();
88
89   std::string                        mSharedObjectName;   ///< Shared object name
90   void*                              mLibHandle;          ///< Handle for the loaded library
91   Dali::VectorImageRendererPlugin*   mPlugin;             ///< Plugin handle
92
93   CreateVectorImageRendererFunction  mCreateVectorImageRendererPtr;   ///< Function pointer called in adaptor to create a plugin instance
94
95 };
96
97 } // namespace Adaptor
98
99 } // namespace Internal
100
101 } // namespace Dali
102
103 #endif // DALI_INTERNAL_VECTOR_IMAGE_RENDERER_PLUGIN_PROXY_H