|
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: Inverts bitmap channels. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSRLEFFECTPLUGININVERT_H |
|
20 #define AKNSRLEFFECTPLUGININVERT_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "AknsRlEffectPlugin.h" |
|
24 #include <AknsRlEffect.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // Effect plugin UID |
|
29 const TInt KAknsRlEffectPluginInvertUID = 0x10204AE4; |
|
30 |
|
31 // Constants for parameter names |
|
32 _LIT( KAknsRlEffectInvertChannels, "c" ); |
|
33 |
|
34 _LIT( KAknsRlEffectInvertBlendFactor, "f" ); |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Invert provides functionality for inverting bitmap channels. Inverting can be |
|
40 * controlled per channel basis (e.g. invert only the red channel). |
|
41 * |
|
42 * @since 2.8 |
|
43 */ |
|
44 NONSHARABLE_CLASS(CAknsRlEffectPluginInvert): |
|
45 public CAknsRlEffectPlugin, |
|
46 public MAknsRlEffect |
|
47 { |
|
48 public: |
|
49 /** |
|
50 * Constants for constructing the channel bitmask. |
|
51 */ |
|
52 enum TBitmask |
|
53 { |
|
54 EMaskR = 0x01, |
|
55 EMaskG = 0x02, |
|
56 EMaskB = 0x04 |
|
57 }; |
|
58 |
|
59 public: // Constructors and destructor |
|
60 |
|
61 /** |
|
62 * Default constructor. |
|
63 * |
|
64 * @since 2.8 |
|
65 */ |
|
66 CAknsRlEffectPluginInvert(); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 * |
|
71 * @since 2.8 |
|
72 */ |
|
73 virtual ~CAknsRlEffectPluginInvert(); |
|
74 |
|
75 public: // Implementation of CAknsEffectPlugin |
|
76 |
|
77 TUid EffectUid() const; |
|
78 MAknsRlEffect* Effect( const TInt aInterface ); |
|
79 |
|
80 public: // Implementation of MAknsRlEffect |
|
81 |
|
82 void InitializeL(); |
|
83 void Release(); |
|
84 |
|
85 void ActivateL( MAknsRlEffectContext* aContext ); |
|
86 void Deactivate(); |
|
87 |
|
88 /** |
|
89 * Accepted named parameters: |
|
90 * - "c", integer, selected channels |
|
91 * - "f", integer, normal range [0, 255], blend factor. |
|
92 * |
|
93 * Selected channels: |
|
94 * A bitmask that defines the inverted channels. The channel bits are: |
|
95 * - 001 red |
|
96 * - 010 green |
|
97 * - 100 blue |
|
98 * All combinations are supported. The bitmask can be constructed by |
|
99 * orring the TBitmask enumerations. Any extra bit on parameter is |
|
100 * ignored. Selected channels parameter is ignored on Gray256 -> Gray256 |
|
101 * operations. |
|
102 * |
|
103 * Blend factor: |
|
104 * Blend factor controls the resulting opacity of the applied effect. |
|
105 * Normal value range is [0, 255] but values outside will also work. |
|
106 * - Value 0 will result in the original image. |
|
107 * - Value 255 will result in the filtered image. |
|
108 * - Values outside range [0, 255] will result in underexposure or |
|
109 * overexposure. |
|
110 * |
|
111 * The default parameter values are: |
|
112 * - "c" = 7 (111, all channels are inverted) |
|
113 * - "f" = 255, full filter opacity |
|
114 */ |
|
115 void SetParametersL( MAknsRlParameterIterator& aParameters ); |
|
116 |
|
117 /** |
|
118 * Supported modes: |
|
119 * - EColor64K -> EColor64K |
|
120 * - EColor16MU -> EColor16MU |
|
121 * - EGray256 -> EGray256 |
|
122 * |
|
123 * Masks are ignored. Target layer and input layer A are both required. |
|
124 */ |
|
125 void GetCapabilities( TAknsRlEffectCaps& aCaps ); |
|
126 |
|
127 TInt Render( const TAknsRlRenderOpParam& aParam ); |
|
128 |
|
129 private: |
|
130 |
|
131 MAknsRlEffectContext* iContext; |
|
132 |
|
133 TUint8 iChannelMask; |
|
134 TInt iBlendFactor; |
|
135 }; |
|
136 |
|
137 #endif // AKNSRLEFFECTPLUGININVERT_H |
|
138 |
|
139 // End of File |