|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: SVG Implementation header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _INC_CSVGANIMTIMECONTROLLER_ |
|
20 #define _INC_CSVGANIMTIMECONTROLLER_ |
|
21 |
|
22 #if !defined(__E32BASE_H__) |
|
23 #include <e32base.h> |
|
24 #endif |
|
25 #include "GfxFloatFixPt.h" |
|
26 |
|
27 #include "SVGEngineImpl.h" |
|
28 #include "SVGEvent.h" |
|
29 |
|
30 |
|
31 |
|
32 const TInt KTimeMax = 255; |
|
33 const TUint32 KTimeIndefinite = 0x7fffffff; |
|
34 typedef TUint8 TAnimCalcMode; |
|
35 const TAnimCalcMode KAnimCalcModeDiscrete = 0; |
|
36 const TAnimCalcMode KAnimCalcModeLinear = 1; |
|
37 const TAnimCalcMode KAnimCalcModePaced = 2; |
|
38 const TAnimCalcMode KAnimCalcModeSpline = 3; |
|
39 |
|
40 /** |
|
41 * Class description goes here. |
|
42 * |
|
43 * @lib SVGEngine.lib |
|
44 * @since 1.0 |
|
45 */ |
|
46 class CSvgAnimTimeController : public CBase |
|
47 { |
|
48 public: |
|
49 void AddToInitialList(TInt aBeginTime); |
|
50 |
|
51 void SetBeginTimeList(RArray<TInt32>*& aList); |
|
52 |
|
53 /** |
|
54 * Need method description |
|
55 * |
|
56 * @since 1.0 |
|
57 * @param |
|
58 * @return |
|
59 */ |
|
60 static CSvgAnimTimeController* CSvgAnimTimeController::NewL(); |
|
61 |
|
62 /** |
|
63 * Need method description |
|
64 * |
|
65 * @since 1.0 |
|
66 * @param |
|
67 * @return |
|
68 */ |
|
69 ~CSvgAnimTimeController(); |
|
70 private: |
|
71 |
|
72 /** |
|
73 * Need method description |
|
74 * |
|
75 * @since 1.0 |
|
76 * @param |
|
77 * @return |
|
78 */ |
|
79 CSvgAnimTimeController(); |
|
80 |
|
81 /** |
|
82 * Need method description |
|
83 * |
|
84 * @since 1.0 |
|
85 * @param |
|
86 * @return |
|
87 */ |
|
88 void ConstructL(); |
|
89 |
|
90 public: |
|
91 |
|
92 |
|
93 //For Dur as media for audio and vedio elements |
|
94 void SetOrgDurationTime(TInt32 aValue); |
|
95 |
|
96 |
|
97 |
|
98 /** |
|
99 * Need method description |
|
100 * |
|
101 * @since 1.0 |
|
102 * @param |
|
103 * @return |
|
104 */ |
|
105 void SetBeginTime( TInt32 aBeginTime ); |
|
106 |
|
107 /** |
|
108 * Need method description |
|
109 * |
|
110 * @since 1.0 |
|
111 * @param |
|
112 * @return |
|
113 */ |
|
114 void ResetBeginTime( TInt32 aBeginTime ); |
|
115 |
|
116 /** |
|
117 * Need method description |
|
118 * |
|
119 * @since 1.0 |
|
120 * @param |
|
121 * @return |
|
122 */ |
|
123 void SetDurationTime( TInt32 aDurationTime ); |
|
124 |
|
125 /** |
|
126 * Need method description |
|
127 * |
|
128 * Himanshu: added to adjust the duration time in case there is a negative begin time |
|
129 * |
|
130 * |
|
131 */ |
|
132 TInt32 GetDurationTime( ); |
|
133 |
|
134 /** |
|
135 * Need method description |
|
136 * |
|
137 * Himanshu: added to adjust the end time in case there is a negative begin time |
|
138 * |
|
139 * |
|
140 */ |
|
141 TInt32 GetEndTime( ); |
|
142 /** |
|
143 * Need method description |
|
144 * |
|
145 * @since 1.0 |
|
146 * @param |
|
147 * @return |
|
148 */ |
|
149 void SetEndTime( TInt32 aEndTime ); |
|
150 |
|
151 /** |
|
152 * Need method description |
|
153 * |
|
154 * @since 1.0 |
|
155 * @param |
|
156 * @return |
|
157 */ |
|
158 void SetRepeatDurationTime( TUint32 aRepeatDurationTime ); |
|
159 |
|
160 /** |
|
161 * Need method description |
|
162 * |
|
163 * @since 1.0 |
|
164 * @param |
|
165 * @return |
|
166 */ |
|
167 void SetCalMode( TAnimCalcMode aCalcMode ) |
|
168 { |
|
169 iCalcMode = aCalcMode; |
|
170 } |
|
171 |
|
172 /** |
|
173 * Need method description |
|
174 * |
|
175 * @since 1.0 |
|
176 * @param |
|
177 * @return |
|
178 */ |
|
179 void ResetKeyTime() |
|
180 { |
|
181 iKeyTime->Reset(); |
|
182 } |
|
183 |
|
184 /** |
|
185 * Need method description |
|
186 * |
|
187 * @since 1.0 |
|
188 * @param |
|
189 * @return |
|
190 */ |
|
191 void CreateKeyTime( TInt32 aKeyTimeCount ); |
|
192 void CreateKeyTimeForEnumeration( TInt32 aKeyTimeCount ); |
|
193 |
|
194 /** |
|
195 * Need method description |
|
196 * |
|
197 * @since 1.0 |
|
198 * @param |
|
199 * @return |
|
200 */ |
|
201 void PrepareTimeL( const RArray<TFloatFixPt>* aValues ); |
|
202 |
|
203 |
|
204 /** |
|
205 * Need method description |
|
206 * |
|
207 * @since 1.0 |
|
208 * @param |
|
209 * @return |
|
210 */ |
|
211 TUint32 BeginTime() |
|
212 { |
|
213 return iBeginTime; |
|
214 } |
|
215 |
|
216 /** |
|
217 * Need method description |
|
218 * |
|
219 * @since 1.0 |
|
220 * @param |
|
221 * @return |
|
222 */ |
|
223 TUint32 DurationTime() |
|
224 { |
|
225 return iDurationTime; |
|
226 } |
|
227 |
|
228 /** |
|
229 * Need method description |
|
230 * |
|
231 * @since 1.0 |
|
232 * @param |
|
233 * @return |
|
234 */ |
|
235 |
|
236 |
|
237 TUint32 EndTime() |
|
238 { |
|
239 return iEndTime; |
|
240 } |
|
241 |
|
242 /** |
|
243 * Need method description |
|
244 * |
|
245 * @since 1.0 |
|
246 * @param |
|
247 * @return |
|
248 */ |
|
249 TUint32 RepeatDurationTime() |
|
250 { |
|
251 return iRepeatDurationTime; |
|
252 } |
|
253 |
|
254 /** |
|
255 * Need method description |
|
256 * |
|
257 * @since 1.0 |
|
258 * @param |
|
259 * @return |
|
260 */ |
|
261 TAnimCalcMode CalMode() |
|
262 { |
|
263 return iCalcMode; |
|
264 } |
|
265 |
|
266 |
|
267 void CalculateAnimTimes(); |
|
268 |
|
269 |
|
270 /** |
|
271 * Need method description |
|
272 * |
|
273 * @since 1.0 |
|
274 * @param |
|
275 * @return |
|
276 */ |
|
277 void AddBeginTime( TInt32 aBeginTime ); |
|
278 void AddEndTime( TInt32 aEndTime ); |
|
279 void GetNextEndTime(TInt32 aBeginTime); |
|
280 void SetNextBeginTime(TInt32 aCurTime); |
|
281 /** |
|
282 * Need method description |
|
283 * |
|
284 * @since 1.0 |
|
285 * @param |
|
286 * @return |
|
287 */ |
|
288 TUint32 GetBeginTime( TInt32 aIndex ); |
|
289 |
|
290 /** |
|
291 * Need method description |
|
292 * |
|
293 * @since 1.0 |
|
294 * @param |
|
295 * @return |
|
296 */ |
|
297 TInt BeginTimesCount(); |
|
298 |
|
299 |
|
300 /** |
|
301 * Need method description |
|
302 * |
|
303 * @since 1.0 |
|
304 * @param |
|
305 * @return |
|
306 */ |
|
307 // void AddBeginEvent( TSvgEvent aBeginEvent ); |
|
308 |
|
309 /** |
|
310 * Need method description |
|
311 * |
|
312 * @since 1.0 |
|
313 * @param |
|
314 * @return |
|
315 */ |
|
316 // TSvgEvent GetBeginEvent( TInt32 aIndex ); |
|
317 |
|
318 |
|
319 /** |
|
320 * Need method description |
|
321 * |
|
322 * @since 1.0 |
|
323 * @param |
|
324 * @return |
|
325 */ |
|
326 void AddKeyTime( TFloatFixPt aTimerTime ); |
|
327 |
|
328 /** |
|
329 * Need method description |
|
330 * |
|
331 * @since 1.0 |
|
332 * @param |
|
333 * @return |
|
334 */ |
|
335 void AddKeySplineL( TFloatFixPt aX1, TFloatFixPt aY1, TFloatFixPt aX2, TFloatFixPt aY2 ); |
|
336 |
|
337 /** |
|
338 * Need method description |
|
339 * |
|
340 * @since 1.0 |
|
341 * @param |
|
342 * @return |
|
343 */ |
|
344 void GetAnimTime( TInt32 aTimerTime, |
|
345 TInt32& aAnimTime, |
|
346 TInt32& aValueIndex, |
|
347 TInt32& aSubAnimTime ); |
|
348 void GetAnimTimeForEnumeration( TInt32 aTimerTime, |
|
349 TInt32& aAnimTime, |
|
350 TInt32& aValueIndex, |
|
351 TBool aKeyTimesPresent |
|
352 ); |
|
353 |
|
354 void CopyL(CSvgAnimTimeController* newElement); |
|
355 void SetEndTimesIndefinite(); |
|
356 TUint32 GetOriginalEndTime(); |
|
357 void ReInitializeForSeek(); |
|
358 |
|
359 /** |
|
360 * Sets the calc mode to spline mode |
|
361 * |
|
362 * @since S60 v3.1 |
|
363 * @param aIsSplineCalcMode Indicates whether the |
|
364 * calcMode is of type "spline" |
|
365 * @return none. |
|
366 */ |
|
367 void SetIsSplineCalcMode( TBool aIsSplineCalcMode ); |
|
368 |
|
369 /** |
|
370 * Returns ETrue if the calc mode is in spline mode |
|
371 * |
|
372 * @since S60 v3.1 |
|
373 * @return TBool ETrue if spline mode, EFalse otherwise. |
|
374 */ |
|
375 TBool IsSplineCalcMode() const; |
|
376 |
|
377 /** |
|
378 * Sets the spline parameter string for later processing |
|
379 * (when calc mode is set) |
|
380 * |
|
381 * @since S60 v3.1 |
|
382 * @param aIsSplineCalcMode Indicates whether the |
|
383 * calcMode is of type "spline" |
|
384 * @return none. |
|
385 */ |
|
386 void SetSplineValueL( const TDesC& aSplineValue ); |
|
387 |
|
388 /** |
|
389 * Returns the string corresponding to the Spline parameters. |
|
390 * |
|
391 * @since S60 v3.1 |
|
392 * @return TPtrC Pointer to Spline param string. |
|
393 */ |
|
394 TPtrC SplineValue() const; |
|
395 #if defined(__WINS__) |
|
396 public: |
|
397 CSvgEngineImpl* iEngine; |
|
398 #endif |
|
399 |
|
400 |
|
401 class TKeyTime |
|
402 { |
|
403 public: |
|
404 TUint16 iY; |
|
405 TUint16 iX; |
|
406 }; |
|
407 |
|
408 private: |
|
409 |
|
410 TAnimCalcMode iCalcMode; |
|
411 |
|
412 TUint32 iBeginTime; |
|
413 TUint32 iInitialBeginTime; |
|
414 TUint32 iDurationTime; |
|
415 TUint32 iOrgDurationTime; |
|
416 TUint32 iEndTime; |
|
417 TUint32 iInitialEndTime; |
|
418 TUint32 iOrgEndTime; |
|
419 TUint32 iRepeatDurationTime; |
|
420 TUint32 iNewActiveDurationTime; |
|
421 |
|
422 // Key time |
|
423 RArray<TKeyTime>* iKeyTime; |
|
424 RArray<TUint32>* iAnimTime; |
|
425 TUint16 iSplineIndex; |
|
426 |
|
427 RArray<TInt32>* iBeginTimeList; |
|
428 RArray<TInt32>* iInitialBeginTimeList; |
|
429 RArray<TInt32>* iEndTimeList; |
|
430 RArray<TInt32>* iInitialEndTimeList; |
|
431 |
|
432 TUint32 iModifiedEndTime; |
|
433 // Indicates whether the calc mode is spline or otherwise |
|
434 TBool iIsSplineCalcMode; |
|
435 // Stores the spline parameters as a string |
|
436 HBufC* iSplines; |
|
437 |
|
438 public: |
|
439 // for decoder. |
|
440 void SetKeyTimeArray(RArray<TKeyTime>*& aArray); |
|
441 void SetAnimTimeArray(RArray<TUint32>*& aArray); |
|
442 // for DOM tree Reusage |
|
443 void SetOriginalValues_DOMReuse(); |
|
444 void ReInitialize(); |
|
445 |
|
446 void SetModifiedEndTime(TUint32 aTime); |
|
447 |
|
448 void Reset(); |
|
449 void SaveBeginTime(); |
|
450 void SaveEndTime(); |
|
451 void ResetBeginTime(); |
|
452 void ResetEndTime(); |
|
453 TInt32 LastEndTime(); |
|
454 TInt32 LastBeginTime(); |
|
455 }; |
|
456 |
|
457 |
|
458 #endif //_INC_CSvgAnimTimeController_ |