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 void Constraint::SetApplyTime( TimePeriod timePeriod )
47 GetImplementation(*this).SetApplyTime( timePeriod );
50 TimePeriod Constraint::GetApplyTime() const
52 return GetImplementation(*this).GetApplyTime();
55 void Constraint::SetRemoveTime( TimePeriod timePeriod )
57 GetImplementation(*this).SetRemoveTime( timePeriod );
60 TimePeriod Constraint::GetRemoveTime() const
62 return GetImplementation(*this).GetRemoveTime();
65 void Constraint::SetAlphaFunction( AlphaFunction func )
67 GetImplementation(*this).SetAlphaFunction( func );
70 AlphaFunction Constraint::GetAlphaFunction()
72 return GetImplementation(*this).GetAlphaFunction();
75 void Constraint::SetRemoveAction(Constraint::RemoveAction action)
77 GetImplementation(*this).SetRemoveAction(action);
80 Constraint::RemoveAction Constraint::GetRemoveAction() const
82 return GetImplementation(*this).GetRemoveAction();
85 void Constraint::SetTag( const unsigned int tag )
87 GetImplementation(*this).SetTag( tag );
90 unsigned int Constraint::GetTag() const
92 return GetImplementation(*this).GetTag();
99 Constraint Constraint::New( Property::Index target,
100 Property::Type targetType,
102 AnyFunction interpolator )
104 Internal::SourceContainer sources; // empty
106 return Constraint( new Internal::Constraint( target,
113 Constraint Constraint::New( Property::Index target,
114 Property::Type targetType,
115 ConstraintSource source1,
117 AnyFunction interpolator )
119 Internal::SourceContainer sources;
120 sources.push_back( Internal::Source( source1 ) );
122 return Constraint( new Internal::Constraint( target,
129 Constraint Constraint::New( Property::Index target,
130 Property::Type targetType,
131 ConstraintSource source1,
132 ConstraintSource source2,
134 AnyFunction interpolator )
136 Internal::SourceContainer sources;
137 sources.push_back( Internal::Source( source1 ) );
138 sources.push_back( Internal::Source( source2 ) );
140 return Constraint( new Internal::Constraint( target,
147 Constraint Constraint::New( Property::Index target,
148 Property::Type targetType,
149 ConstraintSource source1,
150 ConstraintSource source2,
151 ConstraintSource source3,
153 AnyFunction interpolator )
155 Internal::SourceContainer sources;
156 sources.push_back( Internal::Source( source1 ) );
157 sources.push_back( Internal::Source( source2 ) );
158 sources.push_back( Internal::Source( source3 ) );
160 return Constraint( new Internal::Constraint( target,
167 Constraint Constraint::New( Property::Index target,
168 Property::Type targetType,
169 ConstraintSource source1,
170 ConstraintSource source2,
171 ConstraintSource source3,
172 ConstraintSource source4,
174 AnyFunction interpolator )
176 Internal::SourceContainer sources;
177 sources.push_back( Internal::Source( source1 ) );
178 sources.push_back( Internal::Source( source2 ) );
179 sources.push_back( Internal::Source( source3 ) );
180 sources.push_back( Internal::Source( source4 ) );
182 return Constraint( new Internal::Constraint( target,
189 Constraint Constraint::New( Property::Index target,
190 Property::Type targetType,
191 ConstraintSource source1,
192 ConstraintSource source2,
193 ConstraintSource source3,
194 ConstraintSource source4,
195 ConstraintSource source5,
197 AnyFunction interpolator )
199 Internal::SourceContainer sources;
200 sources.push_back( Internal::Source( source1 ) );
201 sources.push_back( Internal::Source( source2 ) );
202 sources.push_back( Internal::Source( source3 ) );
203 sources.push_back( Internal::Source( source4 ) );
204 sources.push_back( Internal::Source( source5 ) );
206 return Constraint( new Internal::Constraint( target,
213 Constraint Constraint::New( Property::Index target,
214 Property::Type targetType,
215 ConstraintSource source1,
216 ConstraintSource source2,
217 ConstraintSource source3,
218 ConstraintSource source4,
219 ConstraintSource source5,
220 ConstraintSource source6,
222 AnyFunction interpolator )
224 Internal::SourceContainer sources;
225 sources.push_back( Internal::Source( source1 ) );
226 sources.push_back( Internal::Source( source2 ) );
227 sources.push_back( Internal::Source( source3 ) );
228 sources.push_back( Internal::Source( source4 ) );
229 sources.push_back( Internal::Source( source5 ) );
230 sources.push_back( Internal::Source( source6 ) );
232 return Constraint( new Internal::Constraint( target,
239 Constraint Constraint::DownCast( BaseHandle handle )
241 return Constraint( dynamic_cast<Dali::Internal::Constraint*>(handle.GetObjectPtr()) );