2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/animation/constraint.h>
22 #include <dali/public-api/animation/time-period.h>
23 #include <dali/internal/event/animation/constraint-impl.h>
24 #include <dali/internal/event/animation/constraint-source-impl.h>
29 const AlphaFunction Constraint::DEFAULT_ALPHA_FUNCTION = AlphaFunctions::Linear;
30 const Constraint::RemoveAction Constraint::DEFAULT_REMOVE_ACTION = Constraint::Bake;
32 Constraint::Constraint()
36 Constraint::Constraint(Internal::Constraint* constraint)
37 : BaseHandle(constraint)
41 Constraint::~Constraint()
45 Constraint::Constraint(const Constraint& handle)
50 Constraint& Constraint::operator=(const Constraint& rhs)
52 BaseHandle::operator=(rhs);
56 void Constraint::SetApplyTime( TimePeriod timePeriod )
58 GetImplementation(*this).SetApplyTime( timePeriod );
61 TimePeriod Constraint::GetApplyTime() const
63 return GetImplementation(*this).GetApplyTime();
66 void Constraint::SetAlphaFunction( AlphaFunction func )
68 GetImplementation(*this).SetAlphaFunction( func );
71 AlphaFunction Constraint::GetAlphaFunction()
73 return GetImplementation(*this).GetAlphaFunction();
76 void Constraint::SetRemoveAction(Constraint::RemoveAction action)
78 GetImplementation(*this).SetRemoveAction(action);
81 Constraint::RemoveAction Constraint::GetRemoveAction() const
83 return GetImplementation(*this).GetRemoveAction();
86 void Constraint::SetTag( const unsigned int tag )
88 GetImplementation(*this).SetTag( tag );
91 unsigned int Constraint::GetTag() const
93 return GetImplementation(*this).GetTag();
100 Constraint Constraint::New( Property::Index target,
101 Property::Type targetType,
103 AnyFunction interpolator )
105 Internal::SourceContainer sources; // empty
107 return Constraint( new Internal::Constraint( target,
114 Constraint Constraint::New( Property::Index target,
115 Property::Type targetType,
116 ConstraintSource source1,
118 AnyFunction interpolator )
120 Internal::SourceContainer sources;
121 sources.push_back( Internal::Source( source1 ) );
123 return Constraint( new Internal::Constraint( target,
130 Constraint Constraint::New( Property::Index target,
131 Property::Type targetType,
132 ConstraintSource source1,
133 ConstraintSource source2,
135 AnyFunction interpolator )
137 Internal::SourceContainer sources;
138 sources.push_back( Internal::Source( source1 ) );
139 sources.push_back( Internal::Source( source2 ) );
141 return Constraint( new Internal::Constraint( target,
148 Constraint Constraint::New( Property::Index target,
149 Property::Type targetType,
150 ConstraintSource source1,
151 ConstraintSource source2,
152 ConstraintSource source3,
154 AnyFunction interpolator )
156 Internal::SourceContainer sources;
157 sources.push_back( Internal::Source( source1 ) );
158 sources.push_back( Internal::Source( source2 ) );
159 sources.push_back( Internal::Source( source3 ) );
161 return Constraint( new Internal::Constraint( target,
168 Constraint Constraint::New( Property::Index target,
169 Property::Type targetType,
170 ConstraintSource source1,
171 ConstraintSource source2,
172 ConstraintSource source3,
173 ConstraintSource source4,
175 AnyFunction interpolator )
177 Internal::SourceContainer sources;
178 sources.push_back( Internal::Source( source1 ) );
179 sources.push_back( Internal::Source( source2 ) );
180 sources.push_back( Internal::Source( source3 ) );
181 sources.push_back( Internal::Source( source4 ) );
183 return Constraint( new Internal::Constraint( target,
190 Constraint Constraint::New( Property::Index target,
191 Property::Type targetType,
192 ConstraintSource source1,
193 ConstraintSource source2,
194 ConstraintSource source3,
195 ConstraintSource source4,
196 ConstraintSource source5,
198 AnyFunction interpolator )
200 Internal::SourceContainer sources;
201 sources.push_back( Internal::Source( source1 ) );
202 sources.push_back( Internal::Source( source2 ) );
203 sources.push_back( Internal::Source( source3 ) );
204 sources.push_back( Internal::Source( source4 ) );
205 sources.push_back( Internal::Source( source5 ) );
207 return Constraint( new Internal::Constraint( target,
214 Constraint Constraint::New( Property::Index target,
215 Property::Type targetType,
216 ConstraintSource source1,
217 ConstraintSource source2,
218 ConstraintSource source3,
219 ConstraintSource source4,
220 ConstraintSource source5,
221 ConstraintSource source6,
223 AnyFunction interpolator )
225 Internal::SourceContainer sources;
226 sources.push_back( Internal::Source( source1 ) );
227 sources.push_back( Internal::Source( source2 ) );
228 sources.push_back( Internal::Source( source3 ) );
229 sources.push_back( Internal::Source( source4 ) );
230 sources.push_back( Internal::Source( source5 ) );
231 sources.push_back( Internal::Source( source6 ) );
233 return Constraint( new Internal::Constraint( target,
240 Constraint Constraint::DownCast( BaseHandle handle )
242 return Constraint( dynamic_cast<Dali::Internal::Constraint*>(handle.GetObjectPtr()) );