|
1 /* |
|
2 * Copyright (c) 2003-2006 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: Smiltransitionfactory implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include "smiltransitionfactory.h" |
|
22 |
|
23 #include <gdi.h> |
|
24 #include <fbs.h> |
|
25 #include <w32std.h> |
|
26 |
|
27 #include "slidewipetransitionfilter.h" |
|
28 #include "pushwipetransitionfilter.h" |
|
29 #include "fadetransitionfilter.h" |
|
30 #include "barwipetransitionfilter.h" |
|
31 #include "clockwipetransitionfilter.h" |
|
32 #include "iriswipetransitionfilter.h" |
|
33 #include "matrixwipetransitionfilter.h" |
|
34 |
|
35 #include "smiltransitioncommondefs.h" |
|
36 |
|
37 // EXTERNAL DATA STRUCTURES |
|
38 |
|
39 // EXTERNAL FUNCTION PROTOTYPES |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 // MACROS |
|
44 |
|
45 // LOCAL CONSTANTS AND MACROS |
|
46 |
|
47 // MODULE DATA STRUCTURES |
|
48 |
|
49 // LOCAL FUNCTION PROTOTYPES |
|
50 |
|
51 // FORWARD DECLARATIONS |
|
52 |
|
53 // ============================= LOCAL FUNCTIONS =============================== |
|
54 |
|
55 // ============================ MEMBER FUNCTIONS =============================== |
|
56 |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CSmilTransitionFactory::CSmilTransitionFactory |
|
60 // C++ default constructor can NOT contain any code, that |
|
61 // might leave. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C CSmilTransitionFactory::CSmilTransitionFactory( CFbsBitmap* aBuffer ) |
|
65 { |
|
66 iBuf = aBuffer; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CSmilTransitionFactory::~CSmilTransitionFactory |
|
71 // Destructor. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CSmilTransitionFactory::~CSmilTransitionFactory() |
|
75 { |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CSmilTransitionFactory::CreateFilterL |
|
80 // Create correct filter, can leave. |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 CSmilTransitionFilter* CSmilTransitionFactory::CreateFilterL( CSmilTransition* aTransition, |
|
84 MSmilMedia* aMedia) |
|
85 { |
|
86 if ( aTransition && iBuf ) |
|
87 { |
|
88 if ( aTransition->Type() == KFade ) |
|
89 { |
|
90 // create a FadeTransitionFilter |
|
91 return CFadeTransitionFilter::NewL( aTransition, iBuf, aMedia ); |
|
92 } |
|
93 else if ( aTransition->Type() == KSlideWipe ) |
|
94 { |
|
95 // create a SlideWipeTransitionFilter |
|
96 return CSlideWipeTransitionFilter::NewL( aTransition, iBuf, aMedia ); |
|
97 } |
|
98 else if ( aTransition->Type() == KPushWipe ) |
|
99 { |
|
100 // create a PushWipeTransitionFilter |
|
101 return CPushWipeTransitionFilter::NewL( aTransition, iBuf, aMedia ); |
|
102 } |
|
103 else if ( aTransition->Type() == KBarWipe ) |
|
104 { |
|
105 // create BarWipeTransitionFilter |
|
106 return CBarWipeTransitionFilter::NewL( aTransition, iBuf, aMedia ); |
|
107 } |
|
108 else if ( aTransition->Type() == KClockWipe ) |
|
109 { |
|
110 // create ClockWipeTransitionFilter |
|
111 return CClockWipeTransitionFilter::NewL( aTransition, iBuf, aMedia ); |
|
112 } |
|
113 else if ( aTransition->Type()==KIrisWipe || |
|
114 aTransition->Type()==KTriangleWipe || |
|
115 aTransition->Type()==KArrowHeadWipe || |
|
116 aTransition->Type()==KEllipseWipe || |
|
117 aTransition->Type()==KMiscShapeWipe || |
|
118 aTransition->Type()==KStarWipe || |
|
119 aTransition->Type()==KEyeWipe || |
|
120 aTransition->Type()==KHexagonWipe || |
|
121 aTransition->Type()==KRoundRectWipe || |
|
122 aTransition->Type()==KPentagonWipe ) |
|
123 { |
|
124 return CIrisWipeTransitionFilter::NewL( aTransition, iBuf, aMedia ); |
|
125 } |
|
126 else if ( aTransition->Type() == KSnakeWipe || |
|
127 aTransition->Type() == KSpiralWipe) |
|
128 { |
|
129 return CMatrixWipeTransitionFilter::NewL( aTransition, iBuf, aMedia ); |
|
130 } |
|
131 } |
|
132 |
|
133 return NULL; |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CSmilTransitionFactory::IsSupportedType |
|
138 // Check if transition is supported, returns ETrue if so. |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 TBool CSmilTransitionFactory::IsSupportedType( const TDesC& aTransitionName ) const |
|
142 { |
|
143 if ( aTransitionName == KFade || |
|
144 aTransitionName == KSlideWipe || |
|
145 aTransitionName == KPushWipe || |
|
146 aTransitionName == KBarWipe || |
|
147 aTransitionName == KIrisWipe || |
|
148 aTransitionName == KTriangleWipe || |
|
149 aTransitionName == KArrowHeadWipe || |
|
150 aTransitionName == KPentagonWipe || |
|
151 aTransitionName == KEllipseWipe || |
|
152 aTransitionName == KMiscShapeWipe || |
|
153 aTransitionName == KStarWipe || |
|
154 aTransitionName == KEyeWipe || |
|
155 aTransitionName == KRoundRectWipe || |
|
156 aTransitionName == KHexagonWipe || |
|
157 aTransitionName == KSnakeWipe || |
|
158 aTransitionName == KSpiralWipe || |
|
159 aTransitionName == KClockWipe ) |
|
160 { |
|
161 return ETrue; |
|
162 } |
|
163 |
|
164 return EFalse; |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CSmilTransitionFactory::IsSupportedType |
|
169 // Check if transition subtype is supported, returns ETrue if so. |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 TBool CSmilTransitionFactory::IsSupportedSubtype( const TDesC& aTransitionName, |
|
173 const TDesC& aSubtypeName ) const |
|
174 { |
|
175 if ( aTransitionName == KFade ) |
|
176 { |
|
177 if ( aSubtypeName == KFadeToColor || |
|
178 aSubtypeName == KFadeFromColor || |
|
179 aSubtypeName == KCrossfade ) |
|
180 { |
|
181 return ETrue; |
|
182 } |
|
183 } |
|
184 else if ( aTransitionName == KSlideWipe ) |
|
185 { |
|
186 if ( aSubtypeName == KFromRight || |
|
187 aSubtypeName == KFromLeft || |
|
188 aSubtypeName == KFromTop || |
|
189 aSubtypeName == KFromBottom ) |
|
190 { |
|
191 return ETrue; |
|
192 } |
|
193 } |
|
194 else if ( aTransitionName == KPushWipe ) |
|
195 { |
|
196 if ( aSubtypeName == KFromRight || |
|
197 aSubtypeName == KFromLeft || |
|
198 aSubtypeName == KFromTop || |
|
199 aSubtypeName==KFromBottom ) |
|
200 { |
|
201 return ETrue; |
|
202 } |
|
203 } |
|
204 else if ( aTransitionName == KBarWipe ) |
|
205 { |
|
206 if( aSubtypeName == KTopToBottom || |
|
207 aSubtypeName == KLeftToRight ) |
|
208 { |
|
209 return ETrue; |
|
210 } |
|
211 } |
|
212 else if ( aTransitionName == KIrisWipe ) |
|
213 { |
|
214 if ( aSubtypeName == KDiamond || |
|
215 aSubtypeName == KRectangle ) |
|
216 { |
|
217 return ETrue; |
|
218 } |
|
219 } |
|
220 else if ( aTransitionName == KTriangleWipe ) |
|
221 { |
|
222 if ( aSubtypeName == KRight || |
|
223 aSubtypeName == KDown || |
|
224 aSubtypeName == KLeft || |
|
225 aSubtypeName == KUp ) |
|
226 { |
|
227 return ETrue; |
|
228 } |
|
229 } |
|
230 else if ( aTransitionName == KArrowHeadWipe ) |
|
231 { |
|
232 if ( aSubtypeName == KRight || |
|
233 aSubtypeName == KDown || |
|
234 aSubtypeName == KLeft || |
|
235 aSubtypeName == KUp ) |
|
236 { |
|
237 return ETrue; |
|
238 } |
|
239 } |
|
240 else if ( aTransitionName == KPentagonWipe ) |
|
241 { |
|
242 if ( aSubtypeName == KUp || |
|
243 aSubtypeName == KDown ) |
|
244 { |
|
245 return ETrue; |
|
246 } |
|
247 } |
|
248 else if ( aTransitionName == KHexagonWipe ) |
|
249 { |
|
250 if ( aSubtypeName == KVertical || |
|
251 aSubtypeName == KHorizontal ) |
|
252 { |
|
253 return ETrue; |
|
254 } |
|
255 } |
|
256 else if ( aTransitionName == KEllipseWipe ) |
|
257 { |
|
258 if ( aSubtypeName == KVertical || |
|
259 aSubtypeName == KHorizontal || |
|
260 aSubtypeName == KCircle ) |
|
261 { |
|
262 return ETrue; |
|
263 } |
|
264 } |
|
265 else if ( aTransitionName == KEyeWipe ) |
|
266 { |
|
267 if ( aSubtypeName == KVertical || |
|
268 aSubtypeName == KHorizontal ) |
|
269 { |
|
270 return ETrue; |
|
271 } |
|
272 } |
|
273 else if ( aTransitionName == KRoundRectWipe ) |
|
274 { |
|
275 if ( aSubtypeName == KVertical || |
|
276 aSubtypeName == KHorizontal ) |
|
277 { |
|
278 return ETrue; |
|
279 } |
|
280 } |
|
281 else if ( aTransitionName == KStarWipe ) |
|
282 { |
|
283 if ( aSubtypeName == KFivePoint || |
|
284 aSubtypeName == KSixPoint || |
|
285 aSubtypeName == KFourPoint ) |
|
286 { |
|
287 return ETrue; |
|
288 } |
|
289 } |
|
290 else if ( aTransitionName == KMiscShapeWipe ) |
|
291 { |
|
292 if ( aSubtypeName == KKeyhole || |
|
293 aSubtypeName == KHeart ) |
|
294 { |
|
295 return ETrue; |
|
296 } |
|
297 } |
|
298 else if ( aTransitionName == KSpiralWipe ) |
|
299 { |
|
300 if ( aSubtypeName == KTopRightClockwise || |
|
301 aSubtypeName == KBottomRightClockwise || |
|
302 aSubtypeName == KBottomLeftClockwise || |
|
303 aSubtypeName == KTopLeftCounterClockwise || |
|
304 aSubtypeName == KTopRightCounterClockwise || |
|
305 aSubtypeName == KBottomLeftCounterClockwise || |
|
306 aSubtypeName == KBottomRightCounterClockwise || |
|
307 aSubtypeName == KTopLeftClockwise ) |
|
308 { |
|
309 return ETrue; |
|
310 } |
|
311 } |
|
312 else if ( aTransitionName == KSnakeWipe ) |
|
313 { |
|
314 if ( aSubtypeName == KTopLeftVertical || |
|
315 aSubtypeName == KTopLeftDiagonal || |
|
316 aSubtypeName == KTopRightDiagonal || |
|
317 aSubtypeName == KBottomLeftDiagonal || |
|
318 aSubtypeName ==KBottomRightDiagonal || |
|
319 aSubtypeName == KTopLeftHorizontal ) |
|
320 { |
|
321 return ETrue; |
|
322 } |
|
323 } |
|
324 else if ( aTransitionName == KClockWipe ) |
|
325 { |
|
326 if ( aSubtypeName == KClockwiseThree || |
|
327 aSubtypeName == KClockwiseSix || |
|
328 aSubtypeName == KClockwiseNine ) |
|
329 { |
|
330 return ETrue; |
|
331 } |
|
332 } |
|
333 |
|
334 return EFalse; |
|
335 } |
|
336 |
|
337 // End of file |