|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef HUIFXEFFECTPARSER_H_ |
|
21 #define HUIFXEFFECTPARSER_H_ |
|
22 |
|
23 #include <f32file.h> |
|
24 #include <gmxmlparser.h> |
|
25 #include "HuiFxEngine.h" |
|
26 #include "HuiFxFilter.h" |
|
27 |
|
28 //FORWARD DECLARATIONS |
|
29 class CMDXMLNode; |
|
30 class CMDXMLDocument; |
|
31 class CMDXMLParser; |
|
32 class CHuiVisual; |
|
33 class CHuiFxLayer; |
|
34 class MAlfGfxEffectObserver; |
|
35 |
|
36 class MHuiFxParsingEndedObserver |
|
37 { |
|
38 public: |
|
39 virtual void ParsingEnded(TInt aHandle) =0; |
|
40 }; |
|
41 |
|
42 |
|
43 class CHuiFxEffectParser : public CActive, public MMDXMLParserObserver |
|
44 { |
|
45 public: // construction/destruction |
|
46 static CHuiFxEffectParser* NewL(CHuiFxEngine& aEngine, MHuiEffectable* aVisual = 0); |
|
47 static CHuiFxEffectParser* NewLC(CHuiFxEngine& aEngine, MHuiEffectable* aVisual = 0); |
|
48 virtual ~CHuiFxEffectParser(); |
|
49 |
|
50 public: // from MMDXMLParserObserver |
|
51 void ParseFileCompleteL(); |
|
52 |
|
53 public: // from CActive |
|
54 void RunL(); |
|
55 TInt RunError( TInt aError ); |
|
56 void DoCancel(); |
|
57 |
|
58 public: |
|
59 void ParseL( const TDesC& aFile, TRect aExtRect ); |
|
60 void Effect( CHuiFxEffect*& aEffect ); // effect ownership transferred to caller |
|
61 |
|
62 void SetEffectEndObserver( MAlfGfxEffectObserver* aEffectEndObserver, TInt aHandle ); |
|
63 void SetEffectFlags( TInt aFlags ); |
|
64 public: |
|
65 void SetParsingEndedObserver( MHuiFxParsingEndedObserver *aObserver, TInt aHandle ); |
|
66 |
|
67 protected: |
|
68 CHuiFxEffectParser(CHuiFxEngine& aEngine, MHuiEffectable* aVisual); |
|
69 |
|
70 private: |
|
71 enum TNodeType |
|
72 { |
|
73 ENodeTypeUnknown, |
|
74 ENodeTypeVisual, |
|
75 ENodeTypeGroup, |
|
76 ENodeTypeFilter, |
|
77 ENodeTypeBlending, |
|
78 ENodeTypeParam, |
|
79 ENodeTypeKeyFrame, |
|
80 ENodeTypeDuration, |
|
81 ENodeTypeStyle, |
|
82 ENodeTypeMarker, |
|
83 ENodeTypeStart, |
|
84 ENodeTypeEnd, |
|
85 }; |
|
86 |
|
87 void ConstructL(); |
|
88 void BuildEffectL(); |
|
89 void ParseNodeL( CMDXMLNode* aNode, CHuiFxLayer* aLayer = NULL ); |
|
90 CHuiFxEffectParser::TNodeType ResolveNode( CMDXMLNode* aNode ); |
|
91 void ResolveParamL( CMDXMLNode* aNode, CHuiFxLayer* aLayer ); |
|
92 THuiFxFilterType GetFilterTypeL( CMDXMLNode* aNode ); |
|
93 THuiFxReferencePoint GetReferencePointL( CMDXMLNode* aNode, TReal32& aRefValue, TBool& aNeedRefValue ); |
|
94 THuiFxVisualSrcType GetSrcTypeL( CMDXMLNode* aNode, TPtrC16& aBitmap ); |
|
95 TReal32 ParseFloatValueL(CMDXMLNode* aNode); |
|
96 TRgb ParseColorValueL(CMDXMLNode* aNode); |
|
97 TReal32 ParseFloatAttributeL(CMDXMLNode* aNode, const TDesC& aName, TBool aMustExist = ETrue); |
|
98 |
|
99 template <typename PARAM_TYPE, typename TIMELINE_TYPE, typename VALUE_TYPE> |
|
100 void ParseAnimationNodeL(CMDXMLNode* aNode, PARAM_TYPE& aParam, TIMELINE_TYPE& aTimeLine); |
|
101 |
|
102 template <typename VALUE_TYPE, typename TIMELINE_TYPE> |
|
103 VALUE_TYPE ParseAnimationKeyFrameValueL(CMDXMLNode* aNode, TIMELINE_TYPE& aTimeLine); |
|
104 |
|
105 void FailL(TInt aCode, TRefByValue<const TDesC> aFormat, ...); |
|
106 |
|
107 private: // members |
|
108 CHuiFxEffect* iEffect; |
|
109 CHuiFxEngine& iEngine; |
|
110 CMDXMLParser* iParser; |
|
111 CMDXMLDocument* iDoc; |
|
112 RFs iFs; |
|
113 MHuiEffectable* iVisual; |
|
114 TRect iExtRect; |
|
115 MAlfGfxEffectObserver* iEffectEndObserver; |
|
116 TInt iHandle; // handle for effect end observer |
|
117 TInt iFlags; // flags from caller that will go into the effect |
|
118 TBool iIsCancelled; |
|
119 MHuiFxParsingEndedObserver *iParsingEndedObserver; |
|
120 TInt iParsingEndedHandle; |
|
121 public: |
|
122 /*void LoadEffect(const TDesC& aFileName, Effect* aTemplateEffect);*/ |
|
123 private: |
|
124 }; |
|
125 |
|
126 #endif /*HUIFXEFFECTPARSER_H_*/ |