#define DALI_VECTOR_ANIMATION_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.
class DALI_ADAPTOR_API VectorAnimationRenderer : public BaseHandle
{
public:
+ enum class VectorProperty
+ {
+ FILL_COLOR, ///< Fill color of the object, Type Property::VECTOR3
+ FILL_OPACITY, ///< Fill opacity of the object, Type Property::FLOAT
+ STROKE_COLOR, ///< Stroke color of the object, Type Property::VECTOR3
+ STROKE_OPACTY, ///< Stroke opacity of the object, Type Property::FLOAT
+ STROKE_WIDTH, ///< Stroke width of the object, Type Property::FLOAT
+ TRANSFORM_ANCHOR, ///< Transform anchor of the Layer and Group object, Type Property::VECTOR2
+ TRANSFORM_POSITION, ///< Transform position of the Layer and Group object, Type Property::VECTOR2
+ TRANSFORM_SCALE, ///< Transform scale of the Layer and Group object, Type Property::VECTOR2 [0..100]
+ TRANSFORM_ROTATION, ///< Transform rotation of the Layer and Group object, Type Property::FLOAT [0..360] in degrees
+ TRANSFORM_OPACITY ///< Transform opacity of the Layer and Group object, Type Property::FLOAT
+ };
+
/// @brief UploadCompleted signal type.
using UploadCompletedSignalType = Signal<void()>;
/**
* @brief Creates an initialized handle to a new VectorAnimationRenderer.
*
- * @param[in] url The url of the vector animation file
* @return A handle to a newly allocated VectorAnimationRenderer
*/
- static VectorAnimationRenderer New(const std::string& url);
+ static VectorAnimationRenderer New();
/**
* @brief Creates an empty handle.
void Finalize();
/**
+ * @brief Loads the animation file.
+ *
+ * @param[in] url The url of the vector animation file
+ * @return True if loading success, false otherwise.
+ */
+ bool Load(const std::string& url);
+
+ /**
* @brief Sets the renderer used to display the result image.
*
* @param[in] renderer The renderer used to display the result image
bool GetMarkerInfo(const std::string& marker, uint32_t& startFrame, uint32_t& endFrame) const;
/**
- * @brief Ignores a rendered frame which is not shown yet.
+ * @brief Invalidates the rendered buffer.
+ * @note The upload completed signal will be emitted again.
+ */
+ void InvalidateBuffer();
+
+ /**
+ * @brief Sets property value for the specified keyPath. This keyPath can resolve to multiple contents.
+ * In that case, the callback's value will apply to all of them.
+ *
+ * @param[in] keyPath The key path used to target a specific content or a set of contents that will be updated.
+ * @param[in] property The property to set.
+ * @param[in] callback The callback that gets called every time the animation is rendered.
+ * @param[in] id The Id to specify the callback. It should be unique and will be passed when the callback is called.
+ *
+ * @note A callback of the following type may be used:
+ * id The id to specify the callback.
+ * property The property that represent what you are trying to change.
+ * frameNumber The current frame number.
+ * It returns a Property::Value to set according to the property type.
+ *
+ * @code
+ * Property::Value MyFunction(int32_t id, VectorProperty property, uint32_t frameNumber);
+ * @endcode
+ *
+ * The keypath should contain object names separated by (.) and can handle globe(**) or wildchar(*).
+ * Ownership of the callback is passed onto this class.
*/
- void IgnoreRenderedFrame();
+ void AddPropertyValueCallback(const std::string& keyPath, VectorProperty property, CallbackBase* callback, int32_t id);
public: // Signals
/**