1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
24 #ifndef CAMERAOVERLAY_H
25 #define CAMERAOVERLAY_H
28 #include <ecam/ecamcommonuids.hrh>
31 class MCameraOverlay2;
34 The current Version for the TOverlaySupportInfo class.
38 static const TUint KECamOverlaySupportInfoCurrentVersion = 1;
41 The current Version for the TOverlayParameters class.
45 static const TUint KECamOverlayParametersCurrentVersion = 1;
48 Constant used to specify that no specific viewfinder of the given type (either direct or client based) shall be considered.
49 Rather, every viewfinder should be taken into consideration.
53 static const TInt KECamOverlayNoSpecificViewFinderHandle = -1;
56 Special handle value used for TOverlaySupportInfo::iViewFinderHandle when TOverlaySupportInfo::iDesiredCameraMode is other
57 than viewfinder mode but not EModeNone.
58 If TOverlaySupportInfo::iDesiredCameraMode is EModeNone, this indicates that OverlaySupportInfo should be used
59 as default, where support information was being provided to the client without distinguishing between different camera modes.
60 Also used as default value for TOverlayParameters::iViewFinderHandle, when TOverlayParameters::iCurrentModes is not
65 static const TInt KECamOverlayInvalidViewFinderHandle = -2;
68 This is the UID which is used to obtain the CCameraOverlay interface,
69 via a call to CCamera::CustomInterface().
71 @see KECamOverlayUidValue
72 @see CCamera::CCameraOverlay
74 static const TUid KECamOverlayUid = {KECamOverlayUidValue};
78 This class provides support for image overlays.
79 The client can use it to overlay an image onto the viewfinder, snapshots, still images and video.
80 A client can create multiple overlays, where each overlay can be in a different format.
81 The properties of an overlay can be changed after it has been created.
83 @note This class provides a standardised client interface for the camera overlay. Classes cannot be derived from it.
85 @note If the class methods leave, the output type parameter value is not guaranteed to be valid.
90 class CCamera::CCameraOverlay: public CBase
97 Overlay camera mode types
99 Represents the possible camera modes in which the overlay could be used.
100 Several types can be combined when returning ECam implementation support for various modes.
102 enum TOverlayCameraMode
104 /** Overlays are not supported for any camera mode. */
106 /** The image can be overlaid on captured images.
107 The camera is in still image mode. This effectively means all the still image drive modes and
108 its interpretation may be implementation-specific.
109 Explicit definition of drive modes is recommended instead.
111 EModeStillImage = 0x01,
112 /** The image can be overlaid on a snapshot.
113 The camera has snapshot functionality set on.
115 EModeSnapshot = 0x02,
117 The image can be overlaid on a viewfinder.
118 The camera is displaying directly to viewfinder.
119 This mode shall not be used if any of the viewfinder submodes is specified.
120 @note Overlay visibility for different viewfinder modes (direct/client-based) is
121 implementation-specific; viewfinder modes should be explicitly specified by clients instead.
123 EModeViewfinder = 0x04,
124 /** The image can be overlaid on a video frame.
125 The camera is in video mode. */
128 The image is to be overlaid on direct viewfinder
129 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
131 EModeDirectViewfinder = 0x00010,
133 The image is to be overlaid on client-based viewfinder
134 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
136 EModeClientViewfinder = 0x00020,
138 The image is to be overlaid when Continuous Still Image driving mode is active.
139 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
141 EModeStillImageContinuous = 0x00080,
143 The image is to be overlaid when Still Image Bracketing driving mode is active.
144 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
146 EModeStillImageBracket = 0x00100,
148 The image is to be overlaid when Still Image Bracketing with Merge option driving mode is active.
149 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
151 EModeStillImageBracketMerge = 0x00200,
153 The image is to be overlaid when Timed Still Image driving mode is active.
154 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
156 EModeStillImageTimed = 0x00400,
158 The image is to be overlaid when Timed Still Image with Lapse option driving mode is active.
159 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
161 EModeStillImageTimeLapse = 0x00800,
163 The image is to be overlaid when Still Image Burst driving mode is active.
164 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L()
166 EModeStillImageBurst = 0x01000
172 Type in which alpha value will be provided.
176 /** Does not support overlays. */
178 /** Blending is on a per pixel basis, where the alpha value information is provided in the overlay bitmap itself.
179 The alpha value is specified in each pixel of the bitmap (it is the alpha componenet of the TRgb object). The
180 display mode of the bitmap should be such that alpha value is supported. TOverlayParameters::iAlphaValue is
181 neglected in this case. */
183 /** Blending is on a per plane basis, where all pixels are affected by the same alpha value. The alpha value is
184 provided through TOverlayParameters::iAlphaValue. */
191 Type of supported blending.
195 /** Does not support blending. */
197 /** Supports only binary blending. If alpha value is 0xFF, it is opaque, otherwise transparent. */
199 /** Full support for blending - all values in the range [0:255]. */
201 /** Supports only dynamic binary blending -
202 allows values to be changed when overlay is being displayed. If alpha value is 0xFF, it is opaque,
203 otherwise transparent. Since the blending is dynamic, SetModifiableOverlayBitmapL shall be used such that the
204 bitmap could be changed by the implementation. */
206 /** Full support for dynamic blending - all values in the range [0:255]
207 - allows values to be changed when overlay is being displayed. Since the blending is dynamic,
208 SetModifiableOverlayBitmapL shall be used such that the bitmap could be changed by the implementation. */
213 Overlay support information characterizing the overlay functionality as a whole.
217 class TOverlaySupportInfo
220 IMPORT_C explicit TOverlaySupportInfo();
222 IMPORT_C TUint Size() const;
223 IMPORT_C TUint Version() const;
226 /** The camera modes that the ECam implementation supports when applying overlays.
227 The modes are held as a bitwise logical OR of the relevant individual modes
228 defined in CCamera::CCameraOverlay::TOverlayCameraMode. */
229 TUint iSupportedModes;
230 /** The camera types that the ECam implementation supports when applying overlays.
231 The types are held as a bitwise logical OR of the relevant individual types
232 defined in CCamera::CCameraOverlay::TOverlayType. */
233 TUint iSupportedTypes;
234 /** Represents blending type for EPerPlane overlay Type.*/
235 TBlendingType iPerPlane;
236 /** Represents blending type for EPerPixel overlay Type.*/
237 TBlendingType iPerPixel;
238 /** Whether overlapping overlays are supported. */
241 /** This is an input parameter which the client needs to provide. It represents the specific camera mode for which
242 the overlay support information is required.
243 Default values for iDesiredCameraMode (that is, CCamera::CCameraOverlay::EModeNone) and iViewFinderHandle (that is,
244 KECamOverlayInvalidViewFinderHandle) implies that the client is using the TOverlaySupportInfo as before and
245 iSupportedModes will not be neglected. Refer to TOverlaySupportInfo().
247 TOverlayCameraMode iDesiredCameraMode;
248 /** This is also another input parameter which the client needs to provide. It represents the specific viewfinder
249 handle for which the overlay support information is required.
250 If iViewFinderHandle is KECamOverlayNoSpecificViewFinderHandle, then generic overlay support is required which will
251 be valid for every viewfinder handle of type iDesiredCameraMode.
252 Default values for iDesiredCameraMode (that is, CCamera::CCameraOverlay::EModeNone) and iViewFinderHandle (that is,
253 KECamOverlayInvalidViewFinderHandle) implies that the client is using the TOverlaySupportInfo as before and
254 iSupportedModes will not be neglected. Refer to TOverlaySupportInfo().
256 TInt iViewFinderHandle;
259 // reserved for future expansion
264 Overlay parameters characterizing a particular overlay.
268 class TOverlayParameters
271 IMPORT_C explicit TOverlayParameters();
273 IMPORT_C TUint Size() const;
274 IMPORT_C TUint Version() const;
277 /** The camera modes in which this image overlay can be used.
278 The modes are held as a bitwise logical OR of the relevant individual modes
279 defined in CCamera::CCameraOverlay::TOverlayCameraMode. */
281 /** The camera types in which this image overlay can be used.
282 The types are held as a bitwise logical OR of the relevant individual types
283 defined in CCamera::CCameraOverlay::TOverlayType. */
285 /** This is the alpha value to be applied when iCurrentTypes contains type
286 CCamera::CCameraOverlay::TOverlayType::EPerPlane. The alpha value for red, green and blue is packed into this
287 TInt. The layout of this TInt is such that the most significant byte (from left side) is not used at all and the
288 remaining three bytes (after the most significant byte) contains the alpha value for red, green and blue.
289 Otherwise, if iCurrentTypes only contains type CCamera::CCameraOverlay::TOverlayType::EPerPixel,
290 then iAlphaValue will not be used. */
292 /** Top left corner within the original image, where the overlay image is to be blended. */
294 /** The z-order of the overlay to indicate relative depth when several overlays are applied.
295 Values are in the range 0 to 100. The overlay with iZOrder of 0 is the deepest.*/
297 /** The handle for the viewfinder on which the overlay is supposed to be applied. Only one viewfinder handle can be passed.
298 If KECamOverlayNoSpecificViewFinderHandle is provided by the client, then the overlay is supposed to be applied for every
299 viewfinder handle of type as given by iCurrentModes.
300 If KECamOverlayInvalidViewFinderHandle, then the default implementation is being used where
301 TOverlayParameters::iCurrentModes will not be neglected and overlay will be applied for every viewfinder alongwith
304 TInt iViewFinderHandle;
306 // reserved for future expansion.
309 // Reserved members which came into existence as a result of removing Tsize public member variable.
316 IMPORT_C static CCameraOverlay* NewL(CCamera& aCamera);
317 IMPORT_C ~CCameraOverlay();
318 IMPORT_C void GetOverlaySupport(TOverlaySupportInfo& aInfo);
320 IMPORT_C TUint CreateOverlayL(const TOverlayParameters& aParameters, CFbsBitmap* aBitmap);
321 IMPORT_C void ReleaseOverlay(TUint aOverlayHandle);
323 IMPORT_C void SetOverlayBitmapL(TUint aOverlayHandle, const CFbsBitmap* aBitmap);
324 IMPORT_C void SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap);
326 IMPORT_C void GetOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap);
327 IMPORT_C void GetOverlayParametersL(TUint aOverlayHandle, TOverlayParameters& aInfo);
328 IMPORT_C void SetOverlayParametersL(TUint aOverlayHandle, const TOverlayParameters& aParameters);
330 IMPORT_C void GetAllOverlaysInZOrderL(RArray<TUint>& aOverlayHandles);
331 IMPORT_C void SetAllOverlaysInZOrderL(const RArray<TUint>& aOverlayHandles);
333 IMPORT_C void GetAllOverlaysInZOrderL(TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, RArray<TUint>& aOverlayHandles) const;
334 IMPORT_C void SetAllOverlaysInZOrderL(TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, const RArray<TUint>& aOverlayHandles);
337 CCameraOverlay(CCamera& aOwner);
342 MCameraOverlay* iImpl; // not owned
343 MCameraOverlay2* iImpl2; // not owned
346 #endif // CAMERAOVERLAY_H