X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fadaptor-framework%2Fvector-animation-renderer.h;h=37cb2146cc733ade9945f03afd3e3c986de9cc85;hb=87bc33f1fbbedcc4fbabfecc37b9030d8a8dfae5;hp=f7faf2143e44c1c292ad8bc6f3e0ddde85714feb;hpb=c629506bc2ce7fcb2ae232570dbeb9c3b2e40b07;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/devel-api/adaptor-framework/vector-animation-renderer.h b/dali/devel-api/adaptor-framework/vector-animation-renderer.h old mode 100755 new mode 100644 index f7faf21..37cb214 --- a/dali/devel-api/adaptor-framework/vector-animation-renderer.h +++ b/dali/devel-api/adaptor-framework/vector-animation-renderer.h @@ -2,7 +2,7 @@ #define DALI_VECTOR_ANIMATION_RENDERER_H /* - * Copyright (c) 2018 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. @@ -38,7 +38,7 @@ namespace Adaptor { class VectorAnimationRenderer; } -} +} // namespace DALI_INTERNAL /** * @brief Used for rendering a vector animation file @@ -46,14 +46,29 @@ class VectorAnimationRenderer; 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; /** * @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. @@ -71,7 +86,7 @@ public: * * @param[in] handle A reference to the copied handle */ - VectorAnimationRenderer( const VectorAnimationRenderer& handle ); + VectorAnimationRenderer(const VectorAnimationRenderer& handle); /** * @brief This assignment operator is required for (smart) pointer semantics. @@ -79,41 +94,43 @@ public: * @param[in] rhs A reference to the copied handle * @return A reference to this */ - VectorAnimationRenderer& operator=( const VectorAnimationRenderer& rhs ); + VectorAnimationRenderer& operator=(const VectorAnimationRenderer& rhs); /** - * @brief Sets the renderer used to display the result image. - * - * @param[in] renderer The renderer used to display the result image + * @brief Finalizes the renderer. */ - void SetRenderer( Renderer renderer ); + void Finalize(); /** - * @brief Sets the target image size. + * @brief Loads the animation file. * - * @param[in] width The target image width - * @param[in] height The target image height + * @param[in] url The url of the vector animation file + * @return True if loading success, false otherwise. */ - void SetSize( uint32_t width, uint32_t height ); + bool Load(const std::string& url); /** - * @brief Starts the rendering. + * @brief Sets the renderer used to display the result image. * - * @return True if the renderer is successfully started, false otherwise. + * @param[in] renderer The renderer used to display the result image */ - bool StartRender(); + void SetRenderer(Renderer renderer); /** - * @brief Stops the rendering. + * @brief Sets the target image size. + * + * @param[in] width The target image width + * @param[in] height The target image height */ - void StopRender(); + void SetSize(uint32_t width, uint32_t height); /** * @brief Renders the content to the target buffer synchronously. * * @param[in] frameNumber The frame number to be rendered + * @return True if the rendering success, false otherwise. */ - void Render( uint32_t frameNumber ); + bool Render(uint32_t frameNumber); /** * @brief Gets the total number of frames of the file @@ -129,10 +146,75 @@ public: */ float GetFrameRate() const; + /** + * @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; + + /** + * @brief Gets the layer information of all the child layers. + * + * @param[out] map The layer information + */ + void GetLayerInfo(Property::Map& map) const; + + /** + * @brief Gets the start frame and the end frame number of the composition marker. + * + * @param[in] marker The composition marker of the file + * @param[out] startFrame The start frame number of the specified marker + * @param[out] endFrame The end frame number of the specified marker + * @return True if the marker is found in the file, false otherwise. + * + * @note https://helpx.adobe.com/after-effects/using/layer-markers-composition-markers.html + * Markers exported from AfterEffect are used to describe a segment of an animation {comment/tag , startFrame, endFrame} + * Marker can be use to devide a resource in to separate animations by tagging the segment with comment string, + * start frame and duration of that segment. + */ + bool GetMarkerInfo(const std::string& marker, uint32_t& startFrame, uint32_t& endFrame) const; + + /** + * @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 AddPropertyValueCallback(const std::string& keyPath, VectorProperty property, CallbackBase* callback, int32_t id); + public: // Signals + /** + * @brief Connect to this signal to be notified when the texture upload is completed. + * + * @return The signal to connect to. + */ + UploadCompletedSignalType& UploadCompletedSignal(); public: // Not intended for application developers - /// @cond internal /** * @brief The constructor. @@ -140,9 +222,8 @@ public: // Not intended for application developers * * @param[in] pointer A pointer to a newly allocated VectorAnimationRenderer */ - explicit DALI_INTERNAL VectorAnimationRenderer( Internal::Adaptor::VectorAnimationRenderer* internal ); + explicit DALI_INTERNAL VectorAnimationRenderer(Internal::Adaptor::VectorAnimationRenderer* internal); /// @endcond - }; /**