1 #ifndef DALI_VECTOR_ANIMATION_RENDERER_H
2 #define DALI_VECTOR_ANIMATION_RENDERER_H
5 * Copyright (c) 2019 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>
23 #include <dali/public-api/rendering/renderer.h>
26 #include <dali/public-api/dali-adaptor-common.h>
31 * @addtogroup dali_adaptor_framework
35 namespace Internal DALI_INTERNAL
39 class VectorAnimationRenderer;
44 * @brief Used for rendering a vector animation file
46 class DALI_ADAPTOR_API VectorAnimationRenderer : public BaseHandle
50 /// @brief UploadCompleted signal type.
51 using UploadCompletedSignalType = Signal< void () >;
54 * @brief Creates an initialized handle to a new VectorAnimationRenderer.
56 * @param[in] url The url of the vector animation file
57 * @return A handle to a newly allocated VectorAnimationRenderer
59 static VectorAnimationRenderer New( const std::string& url );
62 * @brief Creates an empty handle.
63 * Use VectorAnimationRenderer::New() to create an initialized object.
65 VectorAnimationRenderer();
70 ~VectorAnimationRenderer();
73 * @brief This copy constructor is required for (smart) pointer semantics.
75 * @param[in] handle A reference to the copied handle
77 VectorAnimationRenderer( const VectorAnimationRenderer& handle );
80 * @brief This assignment operator is required for (smart) pointer semantics.
82 * @param[in] rhs A reference to the copied handle
83 * @return A reference to this
85 VectorAnimationRenderer& operator=( const VectorAnimationRenderer& rhs );
88 * @brief Sets the renderer used to display the result image.
90 * @param[in] renderer The renderer used to display the result image
92 void SetRenderer( Renderer renderer );
95 * @brief Sets the target image size.
97 * @param[in] width The target image width
98 * @param[in] height The target image height
100 void SetSize( uint32_t width, uint32_t height );
103 * @brief Renders the content to the target buffer synchronously.
105 * @param[in] frameNumber The frame number to be rendered
106 * @return True if the rendering success, false otherwise.
108 bool Render( uint32_t frameNumber );
111 * @brief Gets the total number of frames of the file
113 * @return The total number of frames
115 uint32_t GetTotalFrameNumber() const;
118 * @brief Gets the frame rate of the file.
120 * @return The frame rate of the file
122 float GetFrameRate() const;
125 * @brief Gets the default size of the file.
127 * @param[out] width The default width of the file
128 * @param[out] height The default height of the file
130 void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
133 * @brief Gets the layer information of all the child layers.
135 * @param[out] map The layer information
137 void GetLayerInfo( Property::Map& map ) const;
142 * @brief Connect to this signal to be notified when the texture upload is completed.
144 * @return The signal to connect to.
146 UploadCompletedSignalType& UploadCompletedSignal();
148 public: // Not intended for application developers
152 * @brief The constructor.
153 * @note Not intended for application developers.
155 * @param[in] pointer A pointer to a newly allocated VectorAnimationRenderer
157 explicit DALI_INTERNAL VectorAnimationRenderer( Internal::Adaptor::VectorAnimationRenderer* internal );
167 #endif // DALI_VECTOR_ANIMATION_RENDERER_H