1 #ifndef __DALI_CONSTRAINT_FUNCTIONS_H__
2 #define __DALI_CONSTRAINT_FUNCTIONS_H__
5 * Copyright (c) 2014 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 * @addtogroup CAPI_DALI_ANIMATION_MODULE
27 #include <boost/function.hpp>
37 * @brief Constraints can be used to adjust an Actor property, after animations have been applied.
39 * A local-constraint function is based on local properties of the Actor.
41 namespace LocalConstraint DALI_IMPORT_API
45 * @brief A function which constrains a Vector3 property, based on the local properties of an Actor.
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.
54 typedef boost::function<Vector3 (const Vector3& size,
55 const Vector3& position,
56 const Quaternion& rotation,
58 const Vector4& color)> Vector3Function;
61 * @brief A function which constrains a Vector4 property, based on the local properties of an Actor.
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.
70 typedef boost::function<Vector4 (const Vector3& size,
71 const Vector3& position,
72 const Quaternion& rotation,
74 const Vector4& color)> Vector4Function;
77 * @brief A function which constrains a Quaternion property, based on the local properties of an Actor.
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.
86 typedef boost::function<Quaternion (const Vector3& size,
87 const Vector3& position,
88 const Quaternion& rotation,
90 const Vector4& color)> QuaternionFunction;
93 * @brief A function which constrains a boolean property, based on the local properties of an Actor.
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.
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;
111 * @brief A parent-constraint function is based on properties related to the Actor's parent.
113 namespace ParentConstraint DALI_IMPORT_API
117 * @brief A function which constrains a Vector3 property, based on properties related to the Actor's parent.
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.
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;
137 * @brief A function which constrains a Vector4 property, based on properties related to the Actor's parent.
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.
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;
157 * @brief A function which constrains a Quaternion property, based on properties related to the Actor's parent.
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.
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;
176 * @brief A function which constrains a boolean property, based on properties related to the Actor's parent.
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.
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;
195 } // ParentConstraint
202 #endif // __DALI_CONSTRAINT_FUNCTIONS_H__