ed7cd1fa4730ce0622fce82283ded660ebde0893
[platform/core/uifw/dali-core.git] / capi / dali / public-api / animation / constraint-functions.h
1 #ifndef __DALI_CONSTRAINT_FUNCTIONS_H__
2 #define __DALI_CONSTRAINT_FUNCTIONS_H__
3
4 /*
5  * Copyright (c) 2014 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 /**
22  * @addtogroup CAPI_DALI_ANIMATION_MODULE
23  * @{
24  */
25
26 // EXTERNAL INCLUDES
27 #include <boost/function.hpp>
28
29 namespace Dali
30 {
31
32 struct Vector3;
33 struct Vector4;
34 class Quaternion;
35
36 /**
37  * @brief Constraints can be used to adjust an Actor property, after animations have been applied.
38  *
39  * A local-constraint function is based on local properties of the Actor.
40  */
41 namespace LocalConstraint DALI_IMPORT_API
42 {
43
44 /**
45  * @brief A function which constrains a Vector3 property, based on the local properties of an Actor.
46  *
47  * @param[in] size     The actor's current size.
48  * @param[in] position The actor's current position.
49  * @param[in] scale    The actor's current rotation.
50  * @param[in] rotation The actor's current scale.
51  * @param[in] color    The actor's current color.
52  * @return The constrained property value.
53  */
54 typedef boost::function<Vector3 (const Vector3&    size,
55                                  const Vector3&    position,
56                                  const Quaternion& rotation,
57                                  const Vector3&    scale,
58                                  const Vector4&    color)> Vector3Function;
59
60 /**
61  * @brief A function which constrains a Vector4 property, based on the local properties of an Actor.
62  *
63  * @param[in] size     The actor's current size.
64  * @param[in] position The actor's current position.
65  * @param[in] scale    The actor's current rotation.
66  * @param[in] rotation The actor's current scale.
67  * @param[in] color    The actor's current color.
68  * @return The constrained property value.
69  */
70 typedef boost::function<Vector4 (const Vector3&    size,
71                                  const Vector3&    position,
72                                  const Quaternion& rotation,
73                                  const Vector3&    scale,
74                                  const Vector4&    color)> Vector4Function;
75
76 /**
77  * @brief A function which constrains a Quaternion property, based on the local properties of an Actor.
78  *
79  * @param[in] size     The actor's current size.
80  * @param[in] position The actor's current position.
81  * @param[in] scale    The actor's current rotation.
82  * @param[in] rotation The actor's current scale.
83  * @param[in] color    The actor's current color.
84  * @return The constrained property value.
85  */
86 typedef boost::function<Quaternion (const Vector3&    size,
87                                     const Vector3&    position,
88                                     const Quaternion& rotation,
89                                     const Vector3&    scale,
90                                     const Vector4&    color)> QuaternionFunction;
91
92 /**
93  * @brief A function which constrains a boolean property, based on the local properties of an Actor.
94  *
95  * @param[in] size     The actor's current size.
96  * @param[in] position The actor's current position.
97  * @param[in] scale    The actor's current rotation.
98  * @param[in] rotation The actor's current scale.
99  * @param[in] color    The actor's current color.
100  * @return The constrained property value.
101  */
102 typedef boost::function<bool (const Vector3&    size,
103                               const Vector3&    position,
104                               const Quaternion& rotation,
105                               const Vector3&    scale,
106                               const Vector4&    color)> BoolFunction;
107
108 } // LocalConstraint
109
110 /**
111  * @brief A parent-constraint function is based on properties related to the Actor's parent.
112  */
113 namespace ParentConstraint DALI_IMPORT_API
114 {
115
116 /**
117  * @brief A function which constrains a Vector3 property, based on properties related to the Actor's parent.
118  *
119  * @param[in] current The current value of the property to be constrained.
120  * @param[in] parentOrigin The actor's current parent-origin.
121  * @param[in] anchorPoint The actor's current anchor-point.
122  * @param[in] parentSize The parent's current size.
123  * @param[in] parentPosition The parent's current position.
124  * @param[in] parentRotation The parent's current rotation.
125  * @param[in] parentScale The parent's current scale.
126  * @return The constrained property value.
127  */
128 typedef boost::function<Vector3 (const Vector3&    current,
129                                  const Vector3&    parentOrigin,
130                                  const Vector3&    anchorPoint,
131                                  const Vector3&    parentSize,
132                                  const Vector3&    parentPosition,
133                                  const Quaternion& parentRotation,
134                                  const Vector3&    parentScale)> Vector3Function;
135
136 /**
137  * @brief A function which constrains a Vector4 property, based on properties related to the Actor's parent.
138  *
139  * @param[in] current The current value of the property to be constrained.
140  * @param[in] parentOrigin The actor's current parent-origin.
141  * @param[in] anchorPoint The actor's current anchor-point.
142  * @param[in] parentSize The parent's current size.
143  * @param[in] parentPosition The parent's current position.
144  * @param[in] parentRotation The parent's current rotation.
145  * @param[in] parentScale The parent's current scale.
146  * @return The constrained property value.
147  */
148 typedef boost::function<Vector4 (const Vector4&    current,
149                                  const Vector3&    parentOrigin,
150                                  const Vector3&    anchorPoint,
151                                  const Vector3&    parentSize,
152                                  const Vector3&    parentPosition,
153                                  const Quaternion& parentRotation,
154                                  const Vector3&    parentScale)> Vector4Function;
155
156 /**
157  * @brief A function which constrains a Quaternion property, based on properties related to the Actor's parent.
158  *
159  * @param[in] parentOrigin The actor's current parent-origin.
160  * @param[in] anchorPoint The actor's current anchor-point.
161  * @param[in] parentSize The parent's current size.
162  * @param[in] parentPosition The parent's current position.
163  * @param[in] parentRotation The parent's current rotation.
164  * @param[in] parentScale The parent's current scale.
165  * @return The constrained property value.
166  */
167 typedef boost::function<Quaternion (const Quaternion& current,
168                                     const Vector3&    parentOrigin,
169                                     const Vector3&    anchorPoint,
170                                     const Vector3&    parentSize,
171                                     const Vector3&    parentPosition,
172                                     const Quaternion& parentRotation,
173                                     const Vector3&    parentScale)> QuaternionFunction;
174
175 /**
176  * @brief A function which constrains a boolean property, based on properties related to the Actor's parent.
177  *
178  * @param[in] progress A progress value in the range 0->1, where 1 means that the constraint is fully applied.
179  * @param[in] parentOrigin The actor's current parent-origin.
180  * @param[in] anchorPoint The actor's current anchor-point.
181  * @param[in] parentSize The parent's current size.
182  * @param[in] parentPosition The parent's current position.
183  * @param[in] parentRotation The parent's current rotation.
184  * @param[in] parentScale The parent's current scale.
185  * @return The constrained property value.
186  */
187 typedef boost::function<bool (const bool&       current,
188                               const Vector3&    parentOrigin,
189                               const Vector3&    anchorPoint,
190                               const Vector3&    parentSize,
191                               const Vector3&    parentPosition,
192                               const Quaternion& parentRotation,
193                               const Vector3&    parentScale)> BoolFunction;
194
195 } // ParentConstraint
196
197 } // namespace Dali
198
199 /**
200  * @}
201  */
202 #endif // __DALI_CONSTRAINT_FUNCTIONS_H__