1 #ifndef DALI_VECTOR_ANIMATION_RENDERER_PLUGIN_H
2 #define DALI_VECTOR_ANIMATION_RENDERER_PLUGIN_H
5 * Copyright (c) 2021 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/rendering/renderer.h>
26 #include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
31 * VectorAnimationRendererPlugin is an abstract interface, used by dali-adaptor to render a vector animation.
32 * A concrete implementation must be created for each platform and provided as a dynamic library which
33 * will be loaded at run time by the adaptor.
35 class VectorAnimationRendererPlugin
38 using UploadCompletedSignalType = Dali::VectorAnimationRenderer::UploadCompletedSignalType;
43 VectorAnimationRendererPlugin()
50 virtual ~VectorAnimationRendererPlugin()
55 * @brief Finalizes the renderer. It will be called in the main thread.
57 virtual void Finalize() = 0;
60 * @brief Loads the animation file.
62 * @param[in] url The url of the vector animation file
63 * @return True if loading success, false otherwise.
65 virtual bool Load(const std::string& url) = 0;
68 * @brief Sets the renderer used to display the result image.
70 * @param[in] renderer The renderer used to display the result image
72 virtual void SetRenderer(Renderer renderer) = 0;
75 * @brief Sets the target image size.
77 * @param[in] width The target image width
78 * @param[in] height The target image height
80 virtual void SetSize(uint32_t width, uint32_t height) = 0;
83 * @brief Renders the content to the target buffer synchronously.
85 * @param[in] frameNumber The frame number to be rendered
86 * @return True if the rendering success, false otherwise.
88 virtual bool Render(uint32_t frameNumber) = 0;
91 * @brief Gets the total number of frames of the file.
93 * @return The total number of frames
95 virtual uint32_t GetTotalFrameNumber() const = 0;
98 * @brief Gets the frame rate of the file.
100 * @return The frame rate of the file
102 virtual float GetFrameRate() const = 0;
105 * @brief Gets the default size of the file.
107 * @param[out] width The default width of the file
108 * @param[out] height The default height of the file
110 virtual void GetDefaultSize(uint32_t& width, uint32_t& height) const = 0;
113 * @brief Gets the layer information of all the child layers.
115 * @param[out] map The layer information
117 virtual void GetLayerInfo(Property::Map& map) const = 0;
120 * @brief Gets the start frame and the end frame number of the composition marker.
122 * @param[in] marker The composition marker of the file
123 * @param[out] startFrame The start frame number of the specified marker
124 * @param[out] endFrame The end frame number of the specified marker
125 * @return True if the marker is found in the file, false otherwise.
127 * @note https://helpx.adobe.com/after-effects/using/layer-markers-composition-markers.html
128 * Markers exported from AfterEffect are used to describe a segment of an animation {comment/tag , startFrame, endFrame}
129 * Marker can be use to devide a resource in to separate animations by tagging the segment with comment string,
130 * start frame and duration of that segment.
132 virtual bool GetMarkerInfo(const std::string& marker, uint32_t& startFrame, uint32_t& endFrame) const = 0;
135 * @brief Ignores a rendered frame which is not shown yet.
137 virtual void IgnoreRenderedFrame() = 0;
140 * @brief Connect to this signal to be notified when the texture upload is completed.
142 * @return The signal to connect to.
144 virtual UploadCompletedSignalType& UploadCompletedSignal() = 0;
147 * @brief Function pointer called in adaptor to create a plugin instance.
149 using CreateVectorAnimationRendererFunction = VectorAnimationRendererPlugin* (*)();
154 #endif // DALI_VECTOR_ANIMATION_RENDERER_PLUGIN_H