williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: ?Description
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef AKNSRLEFFECT_H
|
williamr@2
|
20 |
#define AKNSRLEFFECT_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
// INCLUDES
|
williamr@2
|
23 |
#include <AknsRlEffectContext.h>
|
williamr@2
|
24 |
#include <AknsRlParameter.h>
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// CONSTANTS
|
williamr@2
|
27 |
|
williamr@2
|
28 |
/**
|
williamr@2
|
29 |
* Constant value indicating that @c MAknsRlEffect::Render has not completed
|
williamr@2
|
30 |
* rendering and should be called again.
|
williamr@2
|
31 |
*
|
williamr@2
|
32 |
* @since 2.8
|
williamr@2
|
33 |
*/
|
williamr@2
|
34 |
const TInt KAknsRlRenderIncomplete = 1;
|
williamr@2
|
35 |
|
williamr@2
|
36 |
// DATA TYPES
|
williamr@2
|
37 |
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
* Effect capabilities structure.
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* @since 2.8
|
williamr@2
|
42 |
*/
|
williamr@2
|
43 |
struct TAknsRlEffectCaps
|
williamr@2
|
44 |
{
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
* Supported status of input layer A.
|
williamr@2
|
47 |
* This must be a binary combination of @c KAknsRlLayer constants.
|
williamr@2
|
48 |
*
|
williamr@2
|
49 |
* @since 2.8
|
williamr@2
|
50 |
*/
|
williamr@2
|
51 |
TInt iInputLayerASupport;
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
* Supported status of input layer B.
|
williamr@2
|
55 |
* This must be a binary combination of @c KAknsRlLayer constants.
|
williamr@2
|
56 |
*
|
williamr@2
|
57 |
* @since 2.8
|
williamr@2
|
58 |
*/
|
williamr@2
|
59 |
TInt iInputLayerBSupport;
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
* Supported status of output layer.
|
williamr@2
|
63 |
* This must be a binary combination of @c KAknsRlLayer constants.
|
williamr@2
|
64 |
*
|
williamr@2
|
65 |
* @since 2.8
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
TInt iOutputLayerSupport;
|
williamr@2
|
68 |
};
|
williamr@2
|
69 |
|
williamr@2
|
70 |
/**
|
williamr@2
|
71 |
* Rendering operation parameter structure.
|
williamr@2
|
72 |
*
|
williamr@2
|
73 |
* @since 2.8
|
williamr@2
|
74 |
*/
|
williamr@2
|
75 |
struct TAknsRlRenderOpParam
|
williamr@2
|
76 |
{
|
williamr@2
|
77 |
/**
|
williamr@2
|
78 |
* Status (including channel configuration) of input layer A.
|
williamr@2
|
79 |
* This value must be one of @c KAknsRlLayer constants.
|
williamr@2
|
80 |
*
|
williamr@2
|
81 |
* @since 2.8
|
williamr@2
|
82 |
*/
|
williamr@2
|
83 |
TInt iInputLayerAStatus;
|
williamr@2
|
84 |
|
williamr@2
|
85 |
/**
|
williamr@2
|
86 |
* Index of input layer A.
|
williamr@2
|
87 |
* If iInputLayerAStatus is @c KAknsRlLayerNone, this value is
|
williamr@2
|
88 |
* undefined.
|
williamr@2
|
89 |
*
|
williamr@2
|
90 |
* @since 2.8
|
williamr@2
|
91 |
*/
|
williamr@2
|
92 |
TInt iInputLayerAIndex;
|
williamr@2
|
93 |
|
williamr@2
|
94 |
/**
|
williamr@2
|
95 |
* Status (including channel configuration) of input layer B.
|
williamr@2
|
96 |
* This value must be one of @c KAknsRlLayer constants.
|
williamr@2
|
97 |
*
|
williamr@2
|
98 |
* @since 2.8
|
williamr@2
|
99 |
*/
|
williamr@2
|
100 |
TInt iInputLayerBStatus;
|
williamr@2
|
101 |
|
williamr@2
|
102 |
/**
|
williamr@2
|
103 |
* Index of input layer B.
|
williamr@2
|
104 |
* If iInputLayerBStatus is @c KAknsRlLayerNone, this value is
|
williamr@2
|
105 |
* undefined.
|
williamr@2
|
106 |
*
|
williamr@2
|
107 |
* @since 2.8
|
williamr@2
|
108 |
*/
|
williamr@2
|
109 |
TInt iInputLayerBIndex;
|
williamr@2
|
110 |
|
williamr@2
|
111 |
/**
|
williamr@2
|
112 |
* Status (including channel configuration) of output layer.
|
williamr@2
|
113 |
* This value must be one of @c KAknsRlLayer constants.
|
williamr@2
|
114 |
* The value of this field is never @c KAknsRlLayerNone.
|
williamr@2
|
115 |
*
|
williamr@2
|
116 |
* @since 2.8
|
williamr@2
|
117 |
*/
|
williamr@2
|
118 |
TInt iOutputLayerStatus;
|
williamr@2
|
119 |
|
williamr@2
|
120 |
/**
|
williamr@2
|
121 |
* Index of output layer.
|
williamr@2
|
122 |
*
|
williamr@2
|
123 |
* @since 2.8
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
TInt iOutputLayerIndex;
|
williamr@2
|
126 |
};
|
williamr@2
|
127 |
|
williamr@2
|
128 |
// FORWARD DECLARATIONS
|
williamr@2
|
129 |
|
williamr@2
|
130 |
// CLASS DECLARATION
|
williamr@2
|
131 |
|
williamr@2
|
132 |
/**
|
williamr@2
|
133 |
* Interface to skin effect plugin implementation.
|
williamr@2
|
134 |
*
|
williamr@2
|
135 |
* States of an effect plugin are:
|
williamr@2
|
136 |
* - Dead: Effect plugin has not been created. Destructing the plugin
|
williamr@2
|
137 |
* returns the plugin to this state.
|
williamr@2
|
138 |
* - Created: Effect plugin has been created (by calling its default
|
williamr@2
|
139 |
* constructor). No dynamic data can be allocated at this state.
|
williamr@2
|
140 |
* Call to @c Release returns the plugin to this state.
|
williamr@2
|
141 |
* - Initialized: Effect plugin has been successfully initialized
|
williamr@2
|
142 |
* (by calling @c InitializeL). Any dynamic data (common to the
|
williamr@2
|
143 |
* entire lifetime of the plugin) has been constructed.
|
williamr@2
|
144 |
* Call to @c Deactivate returns the plugin to this state.
|
williamr@2
|
145 |
* - Activated: Effect plugin has been successfully activated
|
williamr@2
|
146 |
* for rendering (by calling @c ActivateL). This is the only
|
williamr@2
|
147 |
* state where parameter setup or rendering can take place.
|
williamr@2
|
148 |
*
|
williamr@2
|
149 |
* A plugin instance is owned by the effect pool. A plugin instance
|
williamr@2
|
150 |
* is activated by the effect renderer to perform one rendering
|
williamr@2
|
151 |
* operation.
|
williamr@2
|
152 |
*
|
williamr@2
|
153 |
* The effect renderer maintains a set of layers to store graphical
|
williamr@2
|
154 |
* content during the rendering of a single skin item. The effect renderer
|
williamr@2
|
155 |
* provides the active plugin with an effect context that is used to access
|
williamr@2
|
156 |
* these layers.
|
williamr@2
|
157 |
*
|
williamr@2
|
158 |
* The plugin may assume the following restrictions:
|
williamr@2
|
159 |
* - No calls (except construction) are made to a dead plugin.
|
williamr@2
|
160 |
* - No calls (except initialization or destruction) are made to a
|
williamr@2
|
161 |
* created plugin.
|
williamr@2
|
162 |
* - Parameter setup or rendering operation is never requested from
|
williamr@2
|
163 |
* a plugin that has not been activated.
|
williamr@2
|
164 |
* - Capabilities can be queried only from an initialized or activated
|
williamr@2
|
165 |
* plugin.
|
williamr@2
|
166 |
* - After a rendering operation has been requested, no further
|
williamr@2
|
167 |
* parameter setup or capability queries are made.
|
williamr@2
|
168 |
*
|
williamr@2
|
169 |
* @since 2.8
|
williamr@2
|
170 |
*/
|
williamr@2
|
171 |
class MAknsRlEffect
|
williamr@2
|
172 |
{
|
williamr@2
|
173 |
public: // Constructors and destructor
|
williamr@2
|
174 |
|
williamr@2
|
175 |
// This interface is not used to control ownership.
|
williamr@2
|
176 |
|
williamr@2
|
177 |
public: // New functions - Lifetime handling
|
williamr@2
|
178 |
|
williamr@2
|
179 |
/**
|
williamr@2
|
180 |
* Initializes the effect plugin instance.
|
williamr@2
|
181 |
*
|
williamr@2
|
182 |
* This method is called once for each effect by the effect pool before
|
williamr@2
|
183 |
* calls to any other methods are made.
|
williamr@2
|
184 |
*
|
williamr@2
|
185 |
* @par Exceptions:
|
williamr@2
|
186 |
* If effect plugin initialization fails (i.e., this method leaves
|
williamr@2
|
187 |
* with an error code), the effect is considered to be non-existent.
|
williamr@2
|
188 |
*
|
williamr@2
|
189 |
* @since 2.8
|
williamr@2
|
190 |
*/
|
williamr@2
|
191 |
virtual void InitializeL() =0;
|
williamr@2
|
192 |
|
williamr@2
|
193 |
/**
|
williamr@2
|
194 |
* Releases the effect plugin instance.
|
williamr@2
|
195 |
*
|
williamr@2
|
196 |
* This method is called once for each effect by the effect pool. No
|
williamr@2
|
197 |
* calls to any methods can be done after this method has been called.
|
williamr@2
|
198 |
*
|
williamr@2
|
199 |
* @since 2.8
|
williamr@2
|
200 |
*/
|
williamr@2
|
201 |
virtual void Release() =0;
|
williamr@2
|
202 |
|
williamr@2
|
203 |
/**
|
williamr@2
|
204 |
* Activates the effect plugin to perform a single rendering operation.
|
williamr@2
|
205 |
*
|
williamr@2
|
206 |
* This method is called once by the effect renderer before a rendering
|
williamr@2
|
207 |
* operation is requested.
|
williamr@2
|
208 |
*
|
williamr@2
|
209 |
* @param aContext Effect context. The context is guaranteed to be valid
|
williamr@2
|
210 |
* (and non-null) until @c Deactivate is called. No ownership is
|
williamr@2
|
211 |
* transferred.
|
williamr@2
|
212 |
*
|
williamr@2
|
213 |
* @par Exceptions:
|
williamr@2
|
214 |
* If effect plugin activation fails (i.e., this method leaves with an
|
williamr@2
|
215 |
* error code), the effect renderer may try to re-activate the effect
|
williamr@2
|
216 |
* later or instruct the effect pool to release it permanently
|
williamr@2
|
217 |
* (by calling @c Release).
|
williamr@2
|
218 |
*
|
williamr@2
|
219 |
* @since 2.8
|
williamr@2
|
220 |
*/
|
williamr@2
|
221 |
virtual void ActivateL( MAknsRlEffectContext* aContext ) =0;
|
williamr@2
|
222 |
|
williamr@2
|
223 |
/**
|
williamr@2
|
224 |
* Deactivates the effect plugin after a rendering operation.
|
williamr@2
|
225 |
*
|
williamr@2
|
226 |
* This method is called once by the effect renderer after a rendering
|
williamr@2
|
227 |
* operation has completed, or the operation is aborted.
|
williamr@2
|
228 |
*
|
williamr@2
|
229 |
* @since 2.8
|
williamr@2
|
230 |
*/
|
williamr@2
|
231 |
virtual void Deactivate() =0;
|
williamr@2
|
232 |
|
williamr@2
|
233 |
public: // New functions - Rendering setup
|
williamr@2
|
234 |
|
williamr@2
|
235 |
/**
|
williamr@2
|
236 |
* Sets the parameters for an active effect plugin.
|
williamr@2
|
237 |
*
|
williamr@2
|
238 |
* The effect may call this method zero or more times for any
|
williamr@2
|
239 |
* active plugin before starting the rendering operation
|
williamr@2
|
240 |
*
|
williamr@2
|
241 |
* If any parameter appears more than once in the given iterator
|
williamr@2
|
242 |
* (or in iterators given in more than one call to this method),
|
williamr@2
|
243 |
* the latest parameter value must be used. Already set parameters
|
williamr@2
|
244 |
* can not be removed, but their values can be updated.
|
williamr@2
|
245 |
*
|
williamr@2
|
246 |
* Any parameters not supported by this plugin at all (i.e., the
|
williamr@2
|
247 |
* name of the parameter is not recognized) must be ignored silently.
|
williamr@2
|
248 |
* If parameter type or value is not supported, the plugin may
|
williamr@2
|
249 |
* leave with @c KErrArgument.
|
williamr@2
|
250 |
*
|
williamr@2
|
251 |
* If a particular combination of parameters is not supported
|
williamr@2
|
252 |
* (and further calls to this method can not change the situation),
|
williamr@2
|
253 |
* the plugin may leave with @c KErrArgument. Otherwise, the invalid
|
williamr@2
|
254 |
* combination should be checked in @c Render.
|
williamr@2
|
255 |
*
|
williamr@2
|
256 |
* @c SetParametersL should also leave if the parameter values
|
williamr@2
|
257 |
* can not be stored, e.g., because of an OOM condition.
|
williamr@2
|
258 |
*
|
williamr@2
|
259 |
* @param aParameters Iterator to the parameters. The iterator (and all
|
williamr@2
|
260 |
* the returned values) is guaranteed to be valid during the call
|
williamr@2
|
261 |
* to this method. No ownership is transferred, unless specified
|
williamr@2
|
262 |
* otherwise in iterator API.
|
williamr@2
|
263 |
*
|
williamr@2
|
264 |
* @par Exceptions:
|
williamr@2
|
265 |
* If parameter setup fails (i.e., this method leaves with an error
|
williamr@2
|
266 |
* code), the effect renderer will abort the rendering operation and
|
williamr@2
|
267 |
* deactivate the plugin.
|
williamr@2
|
268 |
*
|
williamr@2
|
269 |
* @since 2.8
|
williamr@2
|
270 |
*/
|
williamr@2
|
271 |
virtual void SetParametersL(
|
williamr@2
|
272 |
MAknsRlParameterIterator& aParameters ) =0;
|
williamr@2
|
273 |
|
williamr@2
|
274 |
public: // New functions - Capability retrieval
|
williamr@2
|
275 |
|
williamr@2
|
276 |
/**
|
williamr@2
|
277 |
* Retrieves the capabilities of the effect plugin.
|
williamr@2
|
278 |
*
|
williamr@2
|
279 |
* The capabilities returned by this method must reflect the currently
|
williamr@2
|
280 |
* set parameters (if any). If @c SetParametersL is called after
|
williamr@2
|
281 |
* querying the capabilities, the effect renderer may call this method
|
williamr@2
|
282 |
* again to fetch the updated capabilities.
|
williamr@2
|
283 |
*
|
williamr@2
|
284 |
* If this method is called for an effect instance that has been
|
williamr@2
|
285 |
* initialized but not activated, the capabilities must reflect the
|
williamr@2
|
286 |
* support for any (valid and supported) parameters. If the plugin
|
williamr@2
|
287 |
* can not determine the capabilities without knowing the parameters,
|
williamr@2
|
288 |
* it must set all the layer support fields to
|
williamr@2
|
289 |
* @c KAknsRlLayerNone.
|
williamr@2
|
290 |
*
|
williamr@2
|
291 |
* If the returned capabilities indicate that no output layer is
|
williamr@2
|
292 |
* supported (only @c KAknsRlLayerNone is returned in output layer
|
williamr@2
|
293 |
* field), the rendering operation will not be started at all,
|
williamr@2
|
294 |
* unless additional parameters are supplied.
|
williamr@2
|
295 |
*
|
williamr@2
|
296 |
* @param aCaps Capabilities structure that the plugin must fill
|
williamr@2
|
297 |
* during the call. The initial values of the structure are
|
williamr@2
|
298 |
* undefined.
|
williamr@2
|
299 |
*
|
williamr@2
|
300 |
* @since 2.8
|
williamr@2
|
301 |
*/
|
williamr@2
|
302 |
virtual void GetCapabilities( TAknsRlEffectCaps& aCaps ) =0;
|
williamr@2
|
303 |
|
williamr@2
|
304 |
public: // New functions - Rendering
|
williamr@2
|
305 |
|
williamr@2
|
306 |
/**
|
williamr@2
|
307 |
* Renders the effect.
|
williamr@2
|
308 |
*
|
williamr@2
|
309 |
* The plugin implementation can perform rendering in one or more
|
williamr@2
|
310 |
* steps. Although the plugin has access to all the layers
|
williamr@2
|
311 |
* (and both RGB and alpha channels) during rendering, it should
|
williamr@2
|
312 |
* only use the content of the input layers (and channels)
|
williamr@2
|
313 |
* specified in @c aParam. Similarly, it should only alter the
|
williamr@2
|
314 |
* content of the specified output layer (and channels), although
|
williamr@2
|
315 |
* the context initialization for previously unused layers should
|
williamr@2
|
316 |
* be followed.
|
williamr@2
|
317 |
*
|
williamr@2
|
318 |
* The same layer index can be specified as both the input and
|
williamr@2
|
319 |
* the output layer (if at least one input layer is supported by the
|
williamr@2
|
320 |
* plugin). The plugin must implement the effect so that any combination
|
williamr@2
|
321 |
* of layer indices is correctly rendered.
|
williamr@2
|
322 |
*
|
williamr@2
|
323 |
* The plugin may assume that rendering operation is never called
|
williamr@2
|
324 |
* with parameters inconsistent with the plugin capabilities (as
|
williamr@2
|
325 |
* the capabilities would have been returned if @c GetCapabilities was
|
williamr@2
|
326 |
* called just before starting the rendering operation).
|
williamr@2
|
327 |
*
|
williamr@2
|
328 |
* @param aParam Rendering operation parameters. The structure
|
williamr@2
|
329 |
* is guaranteed to be valid for the duration of the call.
|
williamr@2
|
330 |
* If @c KAknsRlRenderIncomplete is returned, the same structure
|
williamr@2
|
331 |
* is given for subsequent calls.
|
williamr@2
|
332 |
*
|
williamr@2
|
333 |
* @return Result of the rendering operation. This must be one of the
|
williamr@2
|
334 |
* following values:
|
williamr@2
|
335 |
* - @c KErrNone Rendering was completed successfully.
|
williamr@2
|
336 |
* - @c KAknsRlRenderIncomplete Rendering was not completed and
|
williamr@2
|
337 |
* @c Render should be called again.
|
williamr@2
|
338 |
* - Any negative value indicates that an error occured. Notably,
|
williamr@2
|
339 |
* @c KErrArgument must be returned, if the given combination
|
williamr@2
|
340 |
* of parameters is not supported, or the parameters are
|
williamr@2
|
341 |
* insufficient. The effect renderer will deactivate the plugin.
|
williamr@2
|
342 |
*
|
williamr@2
|
343 |
* @since 2.8
|
williamr@2
|
344 |
*/
|
williamr@2
|
345 |
virtual TInt Render( const TAknsRlRenderOpParam& aParam ) =0;
|
williamr@2
|
346 |
};
|
williamr@2
|
347 |
|
williamr@2
|
348 |
#endif // AKNSRLEFFECT_H
|
williamr@2
|
349 |
|
williamr@2
|
350 |
// End of File
|