|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "fader.h" |
|
17 |
|
18 _LIT(CFaderName, "wsfader"); |
|
19 |
|
20 CFader* CFader::CreateL() |
|
21 { |
|
22 return new(ELeave) CFader; |
|
23 } |
|
24 |
|
25 void CFader::ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TDesC8& /*aData*/) |
|
26 { |
|
27 BaseConstructL(aEnv); |
|
28 //Default bitgdi fading parameters |
|
29 iBlackMap=128; |
|
30 iWhiteMap=255; |
|
31 } |
|
32 |
|
33 CFader::CFader() |
|
34 { |
|
35 } |
|
36 |
|
37 CFader::~CFader() |
|
38 { |
|
39 } |
|
40 |
|
41 //Default fading plugin simply uses bitgdi to perform fading |
|
42 void CFader::FadeArea(CFbsBitGc* aBitGc,const TRegion * aRegion) |
|
43 { |
|
44 aBitGc->Reset(); |
|
45 aBitGc->SetFadingParameters(iBlackMap,iWhiteMap); |
|
46 aBitGc->FadeArea(aRegion); |
|
47 } |
|
48 |
|
49 //Default fading plugin expects two TUint8's describing the black/white map |
|
50 //as possible fading parameters |
|
51 void CFader::SetFadingParameters(const TDesC8& aData) |
|
52 { |
|
53 TPckgBuf<TFadingParams> buf; |
|
54 buf.Copy(aData); |
|
55 TFadingParams parameters = buf(); |
|
56 |
|
57 iBlackMap = parameters.blackMap; |
|
58 iWhiteMap = parameters.whiteMap; |
|
59 } |
|
60 |
|
61 TAny* CFader::ResolveObjectInterface(TUint aTypeId) |
|
62 { |
|
63 switch (aTypeId) |
|
64 { |
|
65 case MWsFader::EWsObjectInterfaceId: |
|
66 return static_cast<MWsFader*>(this); |
|
67 } |
|
68 |
|
69 return NULL; |
|
70 } |
|
71 |
|
72 const TDesC& CFader::PluginName() const |
|
73 { |
|
74 return CFaderName; |
|
75 } |