1 #ifndef DALI_VECTOR_IMAGE_RENDERER_H
2 #define DALI_VECTOR_IMAGE_RENDERER_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/dali-adaptor-common.h>
26 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
31 * @addtogroup dali_adaptor_framework
35 namespace Internal DALI_INTERNAL
39 class VectorImageRenderer;
44 * @brief Used for rendering a vector image file (SVG)
46 class DALI_ADAPTOR_API VectorImageRenderer : public BaseHandle
51 * @brief Creates an initialized handle to a new VectorImageRenderer.
53 * @return A handle to a newly allocated VectorImageRenderer
55 static VectorImageRenderer New();
58 * @brief Creates an empty handle.
59 * Use VectorImageRenderer::New() to create an initialized object.
61 VectorImageRenderer();
66 ~VectorImageRenderer();
69 * @brief This copy constructor is required for (smart) pointer semantics.
71 * @param[in] handle A reference to the copied handle
73 VectorImageRenderer( const VectorImageRenderer& handle ) = default;
76 * @brief This assignment operator is required for (smart) pointer semantics.
78 * @param[in] rhs A reference to the copied handle
79 * @return A reference to this
81 VectorImageRenderer& operator=( const VectorImageRenderer& rhs ) = default;
84 * @brief Load vector image data directly.
86 * @param[in] data SVG image data to load.
87 * @param[in] dpi The DPI of the screen.
88 * @return True if the load success, false otherwise.
90 bool Load(const Vector<uint8_t>& data, float dpi);
93 * @brief Rasterizes the content to the target buffer synchronously.
95 * @param[in] buffer The target buffer
96 * @param[in] scale The target image scale factor
97 * @return True if the rendering succeeds, false otherwise.
99 bool Rasterize(Dali::Devel::PixelBuffer& buffer, float scale);
102 * @brief Gets the default size of the file.
104 * @param[out] width The default width of the file
105 * @param[out] height The default height of the file
107 void GetDefaultSize(uint32_t& width, uint32_t& height) const;
109 public: // Not intended for application developers
113 * @brief The constructor.
114 * @note Not intended for application developers.
116 * @param[in] pointer A pointer to a newly allocated VectorImageRenderer
118 explicit DALI_INTERNAL VectorImageRenderer( Internal::Adaptor::VectorImageRenderer* internal );
128 #endif // DALI_VECTOR_IMAGE_RENDERER_H