|
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: Adds grayscale noise to bitmap image. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSRLEFFECTPLUGINNOISE_H |
|
20 #define AKNSRLEFFECTPLUGINNOISE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "AknsRlEffectPlugin.h" |
|
24 #include <AknsRlEffect.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // Effect plugin UID |
|
29 const TInt KAknsRlEffectPluginNoiseUID = 0x10204AE5; |
|
30 |
|
31 // Constants for parameter names |
|
32 _LIT( KAknsRlEffectNoiseSeed, "s" ); |
|
33 _LIT( KAknsRlEffectNoiseIntensity, "i" ); |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * Provides functionality to add grayscale noise to bitmap image. The Symbian |
|
39 * pseudo-random generator is used for generating the noise. |
|
40 * |
|
41 * @since 2.8 |
|
42 */ |
|
43 NONSHARABLE_CLASS(CAknsRlEffectPluginNoise): |
|
44 public CAknsRlEffectPlugin, |
|
45 public MAknsRlEffect |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Default constructor. |
|
51 * |
|
52 * @since 2.8 |
|
53 */ |
|
54 CAknsRlEffectPluginNoise(); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 * |
|
59 * @since 2.8 |
|
60 */ |
|
61 virtual ~CAknsRlEffectPluginNoise(); |
|
62 |
|
63 public: // Implementation of CAknsEffectPlugin |
|
64 |
|
65 TUid EffectUid() const; |
|
66 MAknsRlEffect* Effect( const TInt aInterface ); |
|
67 |
|
68 public: // Implementation of MAknsRlEffect |
|
69 |
|
70 void InitializeL(); |
|
71 void Release(); |
|
72 |
|
73 void ActivateL( MAknsRlEffectContext* aContext ); |
|
74 void Deactivate(); |
|
75 |
|
76 /** |
|
77 * Accepted named parameters: |
|
78 * - "s", integer, noise seed |
|
79 * - "i", integer, noise intensity |
|
80 * |
|
81 * Noise seed: |
|
82 * The seed passed to random number generator. |
|
83 * |
|
84 * Noise intensity: |
|
85 * Determines the strength of the noise added to the image. With |
|
86 * intensity 0 the result will be the original image. The more the value |
|
87 * differs from zero the stronger the noise effect will be. Normal range |
|
88 * is [0, 255] but values outside the range work. |
|
89 * |
|
90 * The default parameter values are: |
|
91 * - "s" = 0 |
|
92 * - "i" = 127 |
|
93 */ |
|
94 void SetParametersL( MAknsRlParameterIterator& aParameters ); |
|
95 |
|
96 /** |
|
97 * Supported modes: |
|
98 * - EColor64K -> EColor64K |
|
99 * - EColor16MU -> EColor16MU |
|
100 * - EGray256 -> EGray256 |
|
101 * |
|
102 * Masks are ignored. Target layer and input layer A are both required. |
|
103 */ |
|
104 void GetCapabilities( TAknsRlEffectCaps& aCaps ); |
|
105 |
|
106 TInt Render( const TAknsRlRenderOpParam& aParam ); |
|
107 |
|
108 private: |
|
109 |
|
110 MAknsRlEffectContext* iContext; |
|
111 |
|
112 TInt iSeed; |
|
113 TInt iIntensity; |
|
114 }; |
|
115 |
|
116 #endif // AKNSRLEFFECTPLUGINNOISE_H |
|
117 |
|
118 // End of File |