Merge "Add OffscreenApplication" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / vector-image-renderer.h
1 #ifndef DALI_VECTOR_IMAGE_RENDERER_H
2 #define DALI_VECTOR_IMAGE_RENDERER_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 <dali/public-api/object/base-handle.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/dali-adaptor-common.h>
26 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
27
28 namespace Dali
29 {
30 /**
31  * @addtogroup dali_adaptor_framework
32  * @{
33  */
34
35 namespace Internal DALI_INTERNAL
36 {
37 namespace Adaptor
38 {
39 class VectorImageRenderer;
40 }
41 }
42
43 /**
44  * @brief Used for rendering a vector image file (SVG)
45  */
46 class DALI_ADAPTOR_API VectorImageRenderer : public BaseHandle
47 {
48 public:
49
50   /**
51    * @brief Creates an initialized handle to a new VectorImageRenderer.
52    *
53    * @return A handle to a newly allocated VectorImageRenderer
54    */
55   static VectorImageRenderer New();
56
57
58   /**
59    * @brief Creates an empty handle.
60    * Use VectorImageRenderer::New() to create an initialized object.
61    */
62   VectorImageRenderer();
63
64   /**
65    * @brief Destructor.
66    */
67   ~VectorImageRenderer();
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   VectorImageRenderer( const VectorImageRenderer& handle ) = default;
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   VectorImageRenderer& operator=( const VectorImageRenderer& rhs ) = default;
83
84   /**
85    * @brief Sets the target buffer.
86    *
87    * @param[in] buffer The target buffer
88    */
89   void SetBuffer( Dali::Devel::PixelBuffer &buffer );
90
91   /**
92    * @brief Renders the content to the target buffer synchronously.
93    *
94    * @param[in] scale The target image scale
95    * @return True if the rendering success, false otherwise.
96    */
97   bool Render( float scale );
98
99   /**
100    * @brief Load vector image data form url.
101    *
102    * @param[in] url The url of the vector image file
103    * @return True if the rendering success, false otherwise.
104    */
105   bool Load( const std::string& url );
106
107   /**
108    * @brief Load vector image data directly.
109    *
110    * @param[in] data The memory data of vector image
111    * @param[in] size The size of memory data
112    * @return True if the load success, false otherwise.
113    */
114   bool Load( const char *data, uint32_t size );
115
116   /**
117    * @brief Gets the default size of the file.
118    *
119    * @param[out] width The default width of the file
120    * @param[out] height The default height of the file
121    */
122   void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
123
124 public: // Not intended for application developers
125
126   /// @cond internal
127   /**
128    * @brief The constructor.
129    * @note  Not intended for application developers.
130    *
131    * @param[in] pointer A pointer to a newly allocated VectorImageRenderer
132    */
133   explicit DALI_INTERNAL VectorImageRenderer( Internal::Adaptor::VectorImageRenderer* internal );
134   /// @endcond
135
136 };
137
138 /**
139  * @}
140  */
141 } // namespace Dali
142
143 #endif // DALI_VECTOR_IMAGE_RENDERER_H