[dali_2.3.20] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visuals / animated-vector-image-visual-actions-devel.h
1 #ifndef DALI_TOOLKIT_DEVEL_API_VISUALS_ANIMATED_VECTOR_IMAGE_VISUAL_ACTIONS_DEVEL_H
2 #define DALI_TOOLKIT_DEVEL_API_VISUALS_ANIMATED_VECTOR_IMAGE_VISUAL_ACTIONS_DEVEL_H
3
4 /*
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali-toolkit/devel-api/toolkit-action-index-ranges.h>
23 #include <dali-toolkit/devel-api/visuals/animated-image-visual-actions-devel.h>
24 #include <dali-toolkit/devel-api/visuals/image-visual-actions-devel.h>
25 #include <dali/public-api/signals/callback.h>
26 #include <string>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32 namespace DevelAnimatedVectorImageVisual
33 {
34 /**
35  * @brief Actions that the animated vector image visual can perform.  These actions are called through the Visual::Base::DoAction API.
36  */
37 namespace Action
38 {
39 /**
40  * @brief The available actions for this visual
41  */
42 enum Type
43 {
44   // Shared actions with AnimatedImageVisual
45   PLAY    = DevelAnimatedImageVisual::Action::PLAY,    ///< Play the animated vector image.
46   PAUSE   = DevelAnimatedImageVisual::Action::PAUSE,   ///< Pause the animated vector image.
47   STOP    = DevelAnimatedImageVisual::Action::STOP,    ///< Stop the animated vector image. This is also Default playback mode.
48   JUMP_TO = DevelAnimatedImageVisual::Action::JUMP_TO, ///< Jump to the specified frame. Property::INTEGER value should be passed.
49
50   // AnimatedVectorImageVisual only actions
51   SET_DYNAMIC_PROPERTY = DevelAnimatedImageVisual::Action::ANIMATED_IMAGE_VISUAL_ACTION_END_INDEX, ///< Set the dynamic property.
52
53   FLUSH, ///< Flush animation data. It will make ensure that changeness of animated vector image properties flushed.
54 };
55
56 } // namespace Action
57
58 /**
59  * @brief The dynamic property info
60  *
61  * @note A callback of the following type may be used:
62  * @code
63  *   Property::Value MyFunction(int32_t id, VectorAnimationRenderer::VectorProperty property, uint32_t frameNumber);
64  * @endcode
65  *
66  * id  The id to specify the callback.
67  * property The property that represent what you are trying to change.
68  * frameNumber The current frame number.
69  * It returns a Property::Value to set according to the property type.
70  *
71  * The callback will be called on the worker thread. You MUST not call other DALi methods in the callback.
72  * And the object must still be alive when the callback occurs if you make the callback from a class member function.
73  */
74 struct DynamicPropertyInfo
75 {
76   int32_t       id;       ///< The Id to specify the callback. It should be unique and will be passed when the callback is called.
77   std::string   keyPath;  ///< The key path used to target a specific content or a set of contents that will be updated.
78   int32_t       property; ///< The property to set.
79   CallbackBase* callback; ///< The callback that gets called every time the animation is rendered. Ownership of the callback is passed onto the visual.
80 };
81
82 } // namespace DevelAnimatedVectorImageVisual
83
84 } // namespace Toolkit
85
86 } // namespace Dali
87
88 #endif // DALI_TOOLKIT_DEVEL_API_VISUALS_ANIMATED_VECTOR_IMAGE_VISUAL_ACTIONS_DEVEL_H