|
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: Handles channel adjustments. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSRLEFFECTPLUGINADJUSTCHANNELS_H |
|
20 #define AKNSRLEFFECTPLUGINADJUSTCHANNELS_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "AknsRlEffectPlugin.h" |
|
24 #include <AknsRlEffect.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // Effect plugin UID |
|
29 const TInt KAknsRlEffectPluginAdjustChannelsUID = 0x10204ADC; |
|
30 |
|
31 // Constants for channel sources |
|
32 const TInt KAknsRlEffectAdjustChannelsRed = 0; |
|
33 const TInt KAknsRlEffectAdjustChannelsGreen = 1; |
|
34 const TInt KAknsRlEffectAdjustChannelsBlue = 2; |
|
35 |
|
36 // Constants for parameter names |
|
37 _LIT( KAknsRlEffectAdjustChannelsSourceRed, "r" ); |
|
38 _LIT( KAknsRlEffectAdjustChannelsSourceGreen, "g" ); |
|
39 _LIT( KAknsRlEffectAdjustChannelsSourceBlue, "b" ); |
|
40 |
|
41 _LIT( KAknsRlEffectAdjustChannelsFactorRed, "fr" ); |
|
42 _LIT( KAknsRlEffectAdjustChannelsFactorGreen, "fg" ); |
|
43 _LIT( KAknsRlEffectAdjustChannelsFactorBlue, "fb" ); |
|
44 |
|
45 _LIT( KAknsRlEffectAdjustChannelsBlendFactor, "f" ); |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 /** |
|
50 * Adjust channels provides functionality to scale and reconfigure color |
|
51 * channels on a bitmap image. For example the next operations are possible: |
|
52 * - reordering color channels (e.g. [r,g,b] -> [g,r,b]) |
|
53 * - dropping color channels (e.g. [r,g,b] -> [r,g,r]) |
|
54 * - scaling color channels (e.g. [r,g,b] -> [ 0.5 * r, 0.3 * g, 0.1 * b]) |
|
55 * |
|
56 * @since 2.8 |
|
57 */ |
|
58 NONSHARABLE_CLASS(CAknsRlEffectPluginAdjustChannels): |
|
59 public CAknsRlEffectPlugin, |
|
60 public MAknsRlEffect |
|
61 { |
|
62 public: // Constructors and destructor |
|
63 |
|
64 /** |
|
65 * Default constructor. |
|
66 * |
|
67 * @since 2.8 |
|
68 */ |
|
69 CAknsRlEffectPluginAdjustChannels(); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 * |
|
74 * @since 2.8 |
|
75 */ |
|
76 virtual ~CAknsRlEffectPluginAdjustChannels(); |
|
77 |
|
78 public: // Implementation of CAknsEffectPlugin |
|
79 |
|
80 TUid EffectUid() const; |
|
81 MAknsRlEffect* Effect( const TInt aInterface ); |
|
82 |
|
83 public: // Implementation of MAknsRlEffect |
|
84 |
|
85 void InitializeL(); |
|
86 void Release(); |
|
87 |
|
88 void ActivateL( MAknsRlEffectContext* aContext ); |
|
89 void Deactivate(); |
|
90 |
|
91 /** |
|
92 * Accepted named parameters: |
|
93 * |
|
94 * Source channel: |
|
95 * - "r", integer, range [0, 2], red source channel. |
|
96 * - "g", integer, range [0, 2], green source channel. |
|
97 * - "b", integer, range [0, 2], blue source channel. |
|
98 * Channel factor: |
|
99 * - "fr", integer, red factor, scales the red channel. |
|
100 * - "fg", integer, green factor, scales the green channel. |
|
101 * - "fb", integer, blue factor, scales the blue channel. |
|
102 * Blend factor: |
|
103 * - "f", integer, normal range [0, 255], blend factor. |
|
104 * |
|
105 * Source channel: |
|
106 * Source channel parameters define the source channel for the resulting |
|
107 * channel. Sources are defined in range [0,2], use constants |
|
108 * KAknsRlEffectAdjustChannels{ Red| Green | Blue }. For example, "r" = |
|
109 * 1 would use green channel for the resulting red channel. Values |
|
110 * outside range [0,2] will cause leave. |
|
111 * |
|
112 * Channel factor: |
|
113 * Scales the resulting channel by the factor. Factor range [0, 255] |
|
114 * equals floating point range [0, 1]. Values outside range [0, 255] |
|
115 * work as expected. |
|
116 * |
|
117 * Blend factor: |
|
118 * Blend factor controls the resulting opacity of the applied effect. |
|
119 * Normal value range is [0, 255] but values outside will also work. |
|
120 * - Value 0 will result in the original image. |
|
121 * - Value 255 will result in the filtered image. |
|
122 * - Values outside range [0, 255] will result in underexposure or |
|
123 * overexposure. |
|
124 * |
|
125 * The default parameter values are: |
|
126 * - "r" = 0, red |
|
127 * - "g" = 1, green |
|
128 * - "b" = 2, blue |
|
129 * - "fr" = 255, resulting red channel not adjusted |
|
130 * - "fg" = 255, resulting green channel not adjusted |
|
131 * - "fb" = 255, resulting blue channel not adjusted |
|
132 * - "f" = 255, full filter opacity |
|
133 * |
|
134 * With default parameters the filter will basically produce the |
|
135 * original image. |
|
136 */ |
|
137 void SetParametersL( MAknsRlParameterIterator& aParameters ); |
|
138 |
|
139 /** |
|
140 * Supported modes: |
|
141 * - EColor64K -> EColor64K |
|
142 * - EColor16MU -> EColor16MU |
|
143 * |
|
144 * Masks are ignored. Target layer and input layer A are both required. |
|
145 */ |
|
146 void GetCapabilities( TAknsRlEffectCaps& aCaps ); |
|
147 |
|
148 TInt Render( const TAknsRlRenderOpParam& aParam ); |
|
149 |
|
150 private: |
|
151 |
|
152 MAknsRlEffectContext* iContext; |
|
153 |
|
154 TUint8 iSourceRed; |
|
155 TUint8 iSourceGreen; |
|
156 TUint8 iSourceBlue; |
|
157 |
|
158 TInt iFactorRed; |
|
159 TInt iFactorGreen; |
|
160 TInt iFactorBlue; |
|
161 |
|
162 TInt iBlendFactor; |
|
163 }; |
|
164 |
|
165 #endif // AKNSRLEFFECTPLUGINADJUSTCHANNELS_H |
|
166 |
|
167 // End of File |