#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.
*
*
* @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 Load vector image data directly.
bool Load(const Vector<uint8_t>& data, float dpi);
/**
- * @brief Rasterizes the content to the target buffer synchronously.
+ * @brief Query whether the vector image is loaded.
+ *
+ * @return True if the image is loaded, false other wise.
+ */
+ bool IsLoaded() const;
+
+ /**
+ * @brief Rasterizes the content to the pixel buffer synchronously.
*
- * @param[in] buffer The target buffer
- * @param[in] scale The target image scale factor
- * @return True if the rendering succeeds, 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 Rasterize(Dali::Devel::PixelBuffer& buffer, float scale);
+ Dali::Devel::PixelBuffer Rasterize(uint32_t width, uint32_t height);
/**
* @brief Gets the default size of the file.
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
-
};
/**