[dali_2.3.25] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / devel-api / animation / key-frames-devel.h
1 #ifndef DALI_KEY_FRAMES_DEVEL_H
2 #define DALI_KEY_FRAMES_DEVEL_H
3
4 /*
5  * Copyright (c) 2024 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 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/key-frames.h>
23 #include <dali/public-api/common/constants.h>
24
25 namespace Dali
26 {
27 namespace DevelKeyFrames
28 {
29 using ValueConvertor = Property::Value (*)(const Property::Value& input);
30
31 /**
32  * @brief Get the number of key frames.
33  * @param[in] keyFrames The KeyFrames object to perform this operation on
34  * @return Total number of key frames
35  */
36 DALI_CORE_API std::size_t GetKeyFrameCount(KeyFrames keyFrames);
37
38 /**
39  * Get a key frame.
40  * @param[in] keyFrames The KeyFrames object to perform this operation on
41  * @param[in] index The index of the key frame to fetch
42  * @param[out] time The progress of the given key frame
43  * @param[out] value The value of the given key frame
44  */
45 DALI_CORE_API void GetKeyFrame(KeyFrames keyFrames, std::size_t index, float& time, Property::Value& value);
46
47 /**
48  * Set a key frame.
49  * @param[in] keyFrames The KeyFrames object to perform this operation on
50  * @param[in] index The index of the key frame to set
51  * @param[in] value The value of the given key frame
52  */
53 DALI_CORE_API void SetKeyFrameValue(KeyFrames keyFrames, std::size_t index, const Property::Value& value);
54
55 /**
56  * Optimize keyframes. Remove some frames what we can remove that might show same result.
57  * If two keyframe has same progress, we will remain only latest one.
58  * @warning It will be works well only if we use keyFrames animate as Dali::Animation::LINEAR interpolation
59  * @param[in] keyFrames The KeyFrames object to perform this operation on.
60  * @return True if keyframe optimized. False otherwise.
61  */
62 DALI_CORE_API bool OptimizeKeyFramesLinear(KeyFrames keyFrames);
63
64 } // namespace DevelKeyFrames
65
66 } // namespace Dali
67
68 #endif // DALI_KEY_FRAMES_DEVEL_H