|
1 /* |
|
2 * Copyright (c) 2004-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: Bump-mapping for effects. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSRLEFFECTPLUGINBUMPMAP_H |
|
20 #define AKNSRLEFFECTPLUGINBUMPMAP_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "AknsRlEffectPlugin.h" |
|
24 #include <AknsRlEffect.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // Effect plugin UID |
|
29 const TInt KAknsRlEffectPluginBumpMapUID = 0x10204ADF; |
|
30 |
|
31 // Constants for parameter names |
|
32 _LIT( KAknsRlEffectBumpMapAzimuth, "a" ); |
|
33 _LIT( KAknsRlEffectBumpMapElevation, "e" ); |
|
34 _LIT( KAknsRlEffectBumpMapDepth, "d" ); |
|
35 |
|
36 _LIT( KAknsRlEffectBumpMapBlendMode, "m" ); |
|
37 |
|
38 _LIT( KAknsRlEffectBumpMapBlendFactor, "f" ); |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Bump-map combines generic embossing with channel blending, the result is "an |
|
44 * image bump-mapped with itself". Bump-mapping is done in three phases: |
|
45 * 1. Grayscaled version of the original image is created. |
|
46 * 2. The grayscaled image is embossed |
|
47 * 3. The original image is blended on top of the embossed image (and the result |
|
48 * of that is put to the target). |
|
49 * |
|
50 * @since 2.8 |
|
51 */ |
|
52 NONSHARABLE_CLASS(CAknsRlEffectPluginBumpMap): |
|
53 public CAknsRlEffectPlugin, |
|
54 public MAknsRlEffect |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 /** |
|
59 * Default constructor. |
|
60 * |
|
61 * @since 2.8 |
|
62 */ |
|
63 CAknsRlEffectPluginBumpMap(); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 * |
|
68 * @since 2.8 |
|
69 */ |
|
70 virtual ~CAknsRlEffectPluginBumpMap(); |
|
71 |
|
72 public: // Implementation of CAknsEffectPlugin |
|
73 |
|
74 TUid EffectUid() const; |
|
75 MAknsRlEffect* Effect( const TInt aInterface ); |
|
76 |
|
77 public: // Implementation of MAknsRlEffect |
|
78 |
|
79 void InitializeL(); |
|
80 void Release(); |
|
81 |
|
82 void ActivateL( MAknsRlEffectContext* aContext ); |
|
83 void Deactivate(); |
|
84 |
|
85 /** |
|
86 * Accepted named parameters: |
|
87 * - "a", integer, range [0, 360] in degrees, azimuth. |
|
88 * - "e", integer, range [0, 180] in degrees, elevation. |
|
89 * - "d", integer, > 1, depth |
|
90 * - "m", integer, channel blend mode enumeration |
|
91 * - "f", integer, normal range [0, 255], blend factor. |
|
92 * |
|
93 * Azimuth: |
|
94 * Defines the direction of light used in embossing. The imaginary light |
|
95 * is directional and changing azimuth gives the impression of light |
|
96 * rotating around the center of the image. Values outside range [0,360] |
|
97 * will cause leave. |
|
98 * |
|
99 * Elevation: |
|
100 * Together azimuth and elevation define an imaginary hemishpere (on top |
|
101 * of the image). Elevation defines an angle at which the light points |
|
102 * at the bitmap above the xy-plane. Elevation value 90 would result in |
|
103 * light that comes straight above the image. Values outside range |
|
104 * [0,180] will cause leave. |
|
105 * |
|
106 * Depth: |
|
107 * Also known as relief or width45. Increasing the depth will make the |
|
108 * embossing effect look deeper. Values <= 0 will cause leave. |
|
109 * |
|
110 * Blend mode: |
|
111 * Blend mode defines the way the original image is rendered atop of the |
|
112 * embossed image. See AknsRlEffectPluginChannelBlend.h for more details |
|
113 * (no masking is used with bump-mapping). |
|
114 * |
|
115 * Blend factor: |
|
116 * Blend factor controls the resulting opacity of the applied effect. |
|
117 * Normal value range is [0, 255] but values outside will also work. |
|
118 * - Value 0 will result in the original image. |
|
119 * - Value 255 will result in the filtered image. |
|
120 * - Values outside range [0, 255] will result in underexposure or |
|
121 * overexposure. |
|
122 * |
|
123 * The default parameter values are: |
|
124 * - "a" = 0 |
|
125 * - "e" = 34 |
|
126 * - "d" = 10 |
|
127 * - "m" = EAknsRlChannelBlendNormal |
|
128 * - "f" = 255, full filter opacity |
|
129 */ |
|
130 void SetParametersL( MAknsRlParameterIterator& aParameters ); |
|
131 |
|
132 /** |
|
133 * Supported modes: |
|
134 * - EColor64K -> EColor64K |
|
135 * - EColor16MU -> EColor16MU |
|
136 * |
|
137 * Masks are ignored. Target layer and input layer A are both required. |
|
138 */ |
|
139 void GetCapabilities( TAknsRlEffectCaps& aCaps ); |
|
140 |
|
141 TInt Render( const TAknsRlRenderOpParam& aParam ); |
|
142 |
|
143 private: |
|
144 |
|
145 MAknsRlEffectContext* iContext; |
|
146 |
|
147 TReal iAzimuth; |
|
148 TReal iElevation; |
|
149 TInt iDepth; |
|
150 TInt iBlendMode; |
|
151 TInt iBlendFactor; |
|
152 |
|
153 /// Intermediate array for the grayscaled image |
|
154 TUint8* iGrayscale; |
|
155 }; |
|
156 |
|
157 #endif // AKNSRLEFFECTPLUGINBUMPMAP_H |
|
158 |
|
159 // End of File |
|
160 |