|
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_CSVGANIMATEMOTIONELEMENTIMPL_ |
|
20 #define _INC_CSVGANIMATEMOTIONELEMENTIMPL_ |
|
21 |
|
22 #include "SVGAnimateTransformElementImpl.h" |
|
23 |
|
24 |
|
25 |
|
26 #include "GfxAffineTransform.h" |
|
27 #include "GfxLine2D.h" |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 const TInt16 KAnimMotionRotateAuto = -100; |
|
34 const TInt16 KAnimMotionRotateAutoReverse = -200; |
|
35 |
|
36 |
|
37 class CSvgDocumentImpl; |
|
38 class CGfxGeneralPath; |
|
39 class CGfxFlatteningPathIterator; |
|
40 |
|
41 |
|
42 |
|
43 /** |
|
44 * Class description goes here. |
|
45 * |
|
46 * @lib SVGEngine.lib |
|
47 * @since 1.0 |
|
48 */ |
|
49 class CSvgAnimateMotionElementImpl : public CSvgAnimationBase |
|
50 { |
|
51 public: |
|
52 |
|
53 // Constructor/deconstructor |
|
54 |
|
55 TBool DoAnimProcL(MSvgEvent* aEvent); |
|
56 void SetAnimRotate(TInt16 aRotate); |
|
57 void SetAccumulateValuesForSetMediaTime(); |
|
58 |
|
59 TInt SetAttributePathRef( const TInt aNameId, |
|
60 CGfxGeneralPath*& aValue ); |
|
61 /** |
|
62 * Need method description |
|
63 * |
|
64 * @since 1.0 |
|
65 * @param |
|
66 * @return |
|
67 */ |
|
68 static CSvgAnimateMotionElementImpl*NewL( const TUint8 aElemID, |
|
69 CSvgDocumentImpl* aDoc ); |
|
70 |
|
71 |
|
72 /** |
|
73 * Need method description |
|
74 * |
|
75 * @since 1.0 |
|
76 * @param |
|
77 * @return |
|
78 */ |
|
79 static CSvgAnimateMotionElementImpl*NewLC( const TUint8 aElemID, |
|
80 CSvgDocumentImpl* aDoc ); |
|
81 |
|
82 // Dom Reuse |
|
83 void ReInitializeAnimation(); |
|
84 |
|
85 void SetOriginalValues_DOMReuse(); |
|
86 CGfxGeneralPath* GetPathAttribute(TInt aAttributeId); |
|
87 void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle); |
|
88 |
|
89 private: |
|
90 |
|
91 |
|
92 /** |
|
93 * Need method description |
|
94 * |
|
95 * @since 1.0 |
|
96 * @param |
|
97 * @return |
|
98 */ |
|
99 void ConstructL( const TUint8 aElemID ); |
|
100 |
|
101 |
|
102 |
|
103 public: |
|
104 /** |
|
105 * Need method description |
|
106 * |
|
107 * @since 1.0 |
|
108 * @param |
|
109 * @return |
|
110 */ |
|
111 virtual ~CSvgAnimateMotionElementImpl(); |
|
112 |
|
113 private: |
|
114 |
|
115 |
|
116 /** |
|
117 * Need method description |
|
118 * |
|
119 * @since 1.0 |
|
120 * @param |
|
121 * @return |
|
122 */ |
|
123 CSvgAnimateMotionElementImpl( CSvgDocumentImpl* aDoc ); |
|
124 |
|
125 |
|
126 public: |
|
127 |
|
128 void Reset(MSvgEvent* aEvent); |
|
129 void DeactivateAnimation(); |
|
130 /** |
|
131 * Need method description |
|
132 * |
|
133 * @since 1.0 |
|
134 * @param |
|
135 * @return |
|
136 */ |
|
137 TInt SetAttributeIntL( const TInt aNameId, const TInt32 aValue); |
|
138 /** |
|
139 * Need method description |
|
140 * |
|
141 * @since 1.0 |
|
142 * @param |
|
143 * @return |
|
144 */ |
|
145 TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue ); |
|
146 /** |
|
147 * Need method description |
|
148 * |
|
149 * @since 1.0 |
|
150 * @param |
|
151 * @return |
|
152 */ |
|
153 TInt SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue ); |
|
154 /** |
|
155 * Need method description |
|
156 * |
|
157 * @since 1.0 |
|
158 * @param |
|
159 * @return |
|
160 */ |
|
161 TInt GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue ); |
|
162 // From MXmlElement API |
|
163 |
|
164 |
|
165 /** |
|
166 * Need method description |
|
167 * |
|
168 * @since 1.0 |
|
169 * @param |
|
170 * @return |
|
171 */ |
|
172 TInt SetAttributeL( const TDesC& aName, |
|
173 const TDesC& aValue ); |
|
174 |
|
175 // From MEventReceiver |
|
176 |
|
177 /** |
|
178 * Need method description |
|
179 * |
|
180 * @since 1.0 |
|
181 * @param |
|
182 * @return |
|
183 */ |
|
184 TBool ReceiveEventL( MSvgEvent* aEvent ); |
|
185 // From MEventReceiver |
|
186 |
|
187 /** |
|
188 * Need method description |
|
189 * |
|
190 * @since 1.0 |
|
191 * @param |
|
192 * @return |
|
193 */ |
|
194 void ResetReferenceElementL(); |
|
195 |
|
196 // From CSvgAnimationBaseImpl |
|
197 |
|
198 /** |
|
199 * Need method description |
|
200 * |
|
201 * @since 1.0 |
|
202 * @param |
|
203 * @return |
|
204 */ |
|
205 virtual TInt GetAttributePath( const TInt aNameId, |
|
206 CGfxGeneralPath*& aValue ); |
|
207 |
|
208 /** |
|
209 * Need method description |
|
210 * |
|
211 * @since 1.0 |
|
212 * @param |
|
213 * @return |
|
214 */ |
|
215 virtual TInt SetAttributePathL( const TInt aNameId, |
|
216 CGfxGeneralPath* aValue ); |
|
217 |
|
218 /** |
|
219 * Need method description |
|
220 * |
|
221 * @since 1.0 |
|
222 * @param |
|
223 * @return |
|
224 */ |
|
225 MXmlElement* CloneL(MXmlElement* aParentElement); |
|
226 |
|
227 /** |
|
228 * Need method description |
|
229 * |
|
230 * @since 1.0 |
|
231 * @param |
|
232 * @return |
|
233 */ |
|
234 void CopyL(CSvgAnimateMotionElementImpl* aDestElement ); |
|
235 |
|
236 void Print( TBool aIsEncodeOn ); |
|
237 |
|
238 protected: |
|
239 |
|
240 /** |
|
241 * Need method description |
|
242 * |
|
243 * @since 1.0 |
|
244 * @param |
|
245 * @return |
|
246 */ |
|
247 virtual void SetAccumulateValues(); |
|
248 |
|
249 /** |
|
250 * Need method description |
|
251 * |
|
252 * @since 1.0 |
|
253 * @param |
|
254 * @return |
|
255 */ |
|
256 void ApplyAccumulateValuesL(); |
|
257 |
|
258 TGfxAffineTransform iFillMatrix; |
|
259 |
|
260 private: |
|
261 |
|
262 // From CSvgAnimationBase |
|
263 |
|
264 /** |
|
265 * Need method description |
|
266 * |
|
267 * @since 1.0 |
|
268 * @param |
|
269 * @return |
|
270 */ |
|
271 virtual TBool AnimProcL( MSvgTimerEvent* aEvent ); |
|
272 |
|
273 |
|
274 /** |
|
275 * Need method description |
|
276 * |
|
277 * @since 1.0 |
|
278 * @param |
|
279 * @return |
|
280 */ |
|
281 virtual void InitAnimationL(); |
|
282 |
|
283 /** |
|
284 * Need method description |
|
285 * |
|
286 * @since 1.0 |
|
287 * @param |
|
288 * @return |
|
289 */ |
|
290 virtual void SetToOriginalL(); |
|
291 |
|
292 /** |
|
293 * Need method description |
|
294 * |
|
295 * @since 1.0 |
|
296 * @param |
|
297 * @return |
|
298 */ |
|
299 virtual void SetFillValueL(); |
|
300 |
|
301 /** |
|
302 * Need method description |
|
303 * |
|
304 * @since 1.0 |
|
305 * @param |
|
306 * @return |
|
307 */ |
|
308 virtual void ResetAnimationL(); |
|
309 |
|
310 /** |
|
311 * Need method description |
|
312 * |
|
313 * @since 1.0 |
|
314 * @param |
|
315 * @return |
|
316 */ |
|
317 virtual void SetToInitialValueL(); |
|
318 |
|
319 /** |
|
320 * Need method description |
|
321 * |
|
322 * @since 1.0 |
|
323 * @param |
|
324 * @return |
|
325 */ |
|
326 virtual void SetToEndValueL(); |
|
327 |
|
328 private: |
|
329 CGfxGeneralPath* iMotionPath; |
|
330 CGfxFlatteningPathIterator* iPathIterator; |
|
331 TGfxAffineTransform iIdentTransform; |
|
332 |
|
333 TFloatFixPt iSubLength; |
|
334 TFloatFixPt iCurrentPos; |
|
335 TFloatFixPt iSubPos; |
|
336 TGfxLine2D iCurrentSeg; |
|
337 TInt16 iAnimMotionRotate; |
|
338 TGfxAffineTransform iEndMatrix; |
|
339 //TBool iIsValues; |
|
340 TFloatFixPt iToFloatX; |
|
341 TFloatFixPt iToFloatY; |
|
342 TFloatFixPt iFromFloatX; |
|
343 TFloatFixPt iFromFloatY; |
|
344 TFloatFixPt iOrgFromFloatX; |
|
345 TFloatFixPt iOrgFromFloatY; |
|
346 // for DOM Reuse |
|
347 TFloatFixPt iOrgToFloatX; |
|
348 TFloatFixPt iOrgToFloatY; |
|
349 // Used to remember that Path values have been set |
|
350 TBool iPathSeen; |
|
351 public: |
|
352 TBool iIsMotionPath; |
|
353 |
|
354 |
|
355 TReal32 iPrevRotate; |
|
356 }; |
|
357 |
|
358 |
|
359 #endif /* _INC_CSvgAnimateMotionElementImpl_ */ |