#define DALI_VECTOR_IMAGE_RENDERER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/base-handle.h>
// INTERNAL INCLUDES
-#include <dali/public-api/dali-adaptor-common.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/public-api/dali-adaptor-common.h>
namespace Dali
{
* @{
*/
-namespace Internal DALI_INTERNAL
-{
-namespace Adaptor
+namespace Internal::Adaptor
{
class VectorImageRenderer;
-}
-}
+} // namespace Internal::Adaptor
/**
* @brief Used for rendering a vector image file (SVG)
class DALI_ADAPTOR_API VectorImageRenderer : public BaseHandle
{
public:
-
/**
* @brief Creates an initialized handle to a new VectorImageRenderer.
*
*/
static VectorImageRenderer New();
-
/**
* @brief Creates an empty handle.
* Use VectorImageRenderer::New() to create an initialized object.
*
* @param[in] handle A reference to the copied handle
*/
- VectorImageRenderer( const VectorImageRenderer& handle ) = default;
+ VectorImageRenderer(const VectorImageRenderer& handle) = default;
/**
* @brief This assignment operator is required for (smart) pointer semantics.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- VectorImageRenderer& operator=( const VectorImageRenderer& rhs ) = default;
+ VectorImageRenderer& operator=(const VectorImageRenderer& rhs) = default;
/**
- * @brief Sets the target buffer.
- *
- * @param[in] buffer The target buffer
- */
- void SetBuffer( Dali::Devel::PixelBuffer &buffer );
-
- /**
- * @brief Renders the content to the target buffer synchronously.
+ * @brief Load vector image data directly.
*
- * @param[in] scale The target image scale
- * @return True if the rendering success, false otherwise.
+ * @param[in] data SVG image data to load.
+ * @param[in] dpi The DPI of the screen.
+ * @return True if the load success, false otherwise.
*/
- bool Render( float scale );
+ bool Load(const Vector<uint8_t>& data, float dpi);
/**
- * @brief Load vector image data form url.
+ * @brief Query whether the vector image is loaded.
*
- * @param[in] url The url of the vector image file
- * @return True if the rendering success, false otherwise.
+ * @return True if the image is loaded, false other wise.
*/
- bool Load( const std::string& url );
+ bool IsLoaded() const;
/**
- * @brief Load vector image data directly.
+ * @brief Rasterizes the content to the pixel buffer synchronously.
*
- * @param[in] data The memory data of vector image
- * @param[in] size The size of memory data
- * @return True if the load success, false otherwise.
+ * @param[in] width The pixel buffer width
+ * @param[in] height The pixel buffer height
+ * @return The handle to the rasterized PixelBuffer object or an empty handle in case failed.
*/
- bool Load( const char *data, uint32_t size );
+ Dali::Devel::PixelBuffer Rasterize(uint32_t width, uint32_t height);
/**
* @brief Gets the default size of the file.
* @param[out] width The default width of the file
* @param[out] height The default height of the file
*/
- void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
+ void GetDefaultSize(uint32_t& width, uint32_t& height) const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief The constructor.
*
* @param[in] pointer A pointer to a newly allocated VectorImageRenderer
*/
- explicit DALI_INTERNAL VectorImageRenderer( Internal::Adaptor::VectorImageRenderer* internal );
+ explicit DALI_INTERNAL VectorImageRenderer(Internal::Adaptor::VectorImageRenderer* internal);
/// @endcond
-
};
/**