2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: ?Description
19 #ifndef AKNSRLEFFECT_H
20 #define AKNSRLEFFECT_H
23 #include <AknsRlEffectContext.h>
24 #include <AknsRlParameter.h>
29 * Constant value indicating that @c MAknsRlEffect::Render has not completed
30 * rendering and should be called again.
34 const TInt KAknsRlRenderIncomplete = 1;
39 * Effect capabilities structure.
43 struct TAknsRlEffectCaps
46 * Supported status of input layer A.
47 * This must be a binary combination of @c KAknsRlLayer constants.
51 TInt iInputLayerASupport;
54 * Supported status of input layer B.
55 * This must be a binary combination of @c KAknsRlLayer constants.
59 TInt iInputLayerBSupport;
62 * Supported status of output layer.
63 * This must be a binary combination of @c KAknsRlLayer constants.
67 TInt iOutputLayerSupport;
71 * Rendering operation parameter structure.
75 struct TAknsRlRenderOpParam
78 * Status (including channel configuration) of input layer A.
79 * This value must be one of @c KAknsRlLayer constants.
83 TInt iInputLayerAStatus;
86 * Index of input layer A.
87 * If iInputLayerAStatus is @c KAknsRlLayerNone, this value is
92 TInt iInputLayerAIndex;
95 * Status (including channel configuration) of input layer B.
96 * This value must be one of @c KAknsRlLayer constants.
100 TInt iInputLayerBStatus;
103 * Index of input layer B.
104 * If iInputLayerBStatus is @c KAknsRlLayerNone, this value is
109 TInt iInputLayerBIndex;
112 * Status (including channel configuration) of output layer.
113 * This value must be one of @c KAknsRlLayer constants.
114 * The value of this field is never @c KAknsRlLayerNone.
118 TInt iOutputLayerStatus;
121 * Index of output layer.
125 TInt iOutputLayerIndex;
128 // FORWARD DECLARATIONS
133 * Interface to skin effect plugin implementation.
135 * States of an effect plugin are:
136 * - Dead: Effect plugin has not been created. Destructing the plugin
137 * returns the plugin to this state.
138 * - Created: Effect plugin has been created (by calling its default
139 * constructor). No dynamic data can be allocated at this state.
140 * Call to @c Release returns the plugin to this state.
141 * - Initialized: Effect plugin has been successfully initialized
142 * (by calling @c InitializeL). Any dynamic data (common to the
143 * entire lifetime of the plugin) has been constructed.
144 * Call to @c Deactivate returns the plugin to this state.
145 * - Activated: Effect plugin has been successfully activated
146 * for rendering (by calling @c ActivateL). This is the only
147 * state where parameter setup or rendering can take place.
149 * A plugin instance is owned by the effect pool. A plugin instance
150 * is activated by the effect renderer to perform one rendering
153 * The effect renderer maintains a set of layers to store graphical
154 * content during the rendering of a single skin item. The effect renderer
155 * provides the active plugin with an effect context that is used to access
158 * The plugin may assume the following restrictions:
159 * - No calls (except construction) are made to a dead plugin.
160 * - No calls (except initialization or destruction) are made to a
162 * - Parameter setup or rendering operation is never requested from
163 * a plugin that has not been activated.
164 * - Capabilities can be queried only from an initialized or activated
166 * - After a rendering operation has been requested, no further
167 * parameter setup or capability queries are made.
173 public: // Constructors and destructor
175 // This interface is not used to control ownership.
177 public: // New functions - Lifetime handling
180 * Initializes the effect plugin instance.
182 * This method is called once for each effect by the effect pool before
183 * calls to any other methods are made.
186 * If effect plugin initialization fails (i.e., this method leaves
187 * with an error code), the effect is considered to be non-existent.
191 virtual void InitializeL() =0;
194 * Releases the effect plugin instance.
196 * This method is called once for each effect by the effect pool. No
197 * calls to any methods can be done after this method has been called.
201 virtual void Release() =0;
204 * Activates the effect plugin to perform a single rendering operation.
206 * This method is called once by the effect renderer before a rendering
207 * operation is requested.
209 * @param aContext Effect context. The context is guaranteed to be valid
210 * (and non-null) until @c Deactivate is called. No ownership is
214 * If effect plugin activation fails (i.e., this method leaves with an
215 * error code), the effect renderer may try to re-activate the effect
216 * later or instruct the effect pool to release it permanently
217 * (by calling @c Release).
221 virtual void ActivateL( MAknsRlEffectContext* aContext ) =0;
224 * Deactivates the effect plugin after a rendering operation.
226 * This method is called once by the effect renderer after a rendering
227 * operation has completed, or the operation is aborted.
231 virtual void Deactivate() =0;
233 public: // New functions - Rendering setup
236 * Sets the parameters for an active effect plugin.
238 * The effect may call this method zero or more times for any
239 * active plugin before starting the rendering operation
241 * If any parameter appears more than once in the given iterator
242 * (or in iterators given in more than one call to this method),
243 * the latest parameter value must be used. Already set parameters
244 * can not be removed, but their values can be updated.
246 * Any parameters not supported by this plugin at all (i.e., the
247 * name of the parameter is not recognized) must be ignored silently.
248 * If parameter type or value is not supported, the plugin may
249 * leave with @c KErrArgument.
251 * If a particular combination of parameters is not supported
252 * (and further calls to this method can not change the situation),
253 * the plugin may leave with @c KErrArgument. Otherwise, the invalid
254 * combination should be checked in @c Render.
256 * @c SetParametersL should also leave if the parameter values
257 * can not be stored, e.g., because of an OOM condition.
259 * @param aParameters Iterator to the parameters. The iterator (and all
260 * the returned values) is guaranteed to be valid during the call
261 * to this method. No ownership is transferred, unless specified
262 * otherwise in iterator API.
265 * If parameter setup fails (i.e., this method leaves with an error
266 * code), the effect renderer will abort the rendering operation and
267 * deactivate the plugin.
271 virtual void SetParametersL(
272 MAknsRlParameterIterator& aParameters ) =0;
274 public: // New functions - Capability retrieval
277 * Retrieves the capabilities of the effect plugin.
279 * The capabilities returned by this method must reflect the currently
280 * set parameters (if any). If @c SetParametersL is called after
281 * querying the capabilities, the effect renderer may call this method
282 * again to fetch the updated capabilities.
284 * If this method is called for an effect instance that has been
285 * initialized but not activated, the capabilities must reflect the
286 * support for any (valid and supported) parameters. If the plugin
287 * can not determine the capabilities without knowing the parameters,
288 * it must set all the layer support fields to
289 * @c KAknsRlLayerNone.
291 * If the returned capabilities indicate that no output layer is
292 * supported (only @c KAknsRlLayerNone is returned in output layer
293 * field), the rendering operation will not be started at all,
294 * unless additional parameters are supplied.
296 * @param aCaps Capabilities structure that the plugin must fill
297 * during the call. The initial values of the structure are
302 virtual void GetCapabilities( TAknsRlEffectCaps& aCaps ) =0;
304 public: // New functions - Rendering
307 * Renders the effect.
309 * The plugin implementation can perform rendering in one or more
310 * steps. Although the plugin has access to all the layers
311 * (and both RGB and alpha channels) during rendering, it should
312 * only use the content of the input layers (and channels)
313 * specified in @c aParam. Similarly, it should only alter the
314 * content of the specified output layer (and channels), although
315 * the context initialization for previously unused layers should
318 * The same layer index can be specified as both the input and
319 * the output layer (if at least one input layer is supported by the
320 * plugin). The plugin must implement the effect so that any combination
321 * of layer indices is correctly rendered.
323 * The plugin may assume that rendering operation is never called
324 * with parameters inconsistent with the plugin capabilities (as
325 * the capabilities would have been returned if @c GetCapabilities was
326 * called just before starting the rendering operation).
328 * @param aParam Rendering operation parameters. The structure
329 * is guaranteed to be valid for the duration of the call.
330 * If @c KAknsRlRenderIncomplete is returned, the same structure
331 * is given for subsequent calls.
333 * @return Result of the rendering operation. This must be one of the
335 * - @c KErrNone Rendering was completed successfully.
336 * - @c KAknsRlRenderIncomplete Rendering was not completed and
337 * @c Render should be called again.
338 * - Any negative value indicates that an error occured. Notably,
339 * @c KErrArgument must be returned, if the given combination
340 * of parameters is not supported, or the parameters are
341 * insufficient. The effect renderer will deactivate the plugin.
345 virtual TInt Render( const TAknsRlRenderOpParam& aParam ) =0;
348 #endif // AKNSRLEFFECT_H