|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedAll |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef CAMERAOVERLAY_H |
|
23 #define CAMERAOVERLAY_H |
|
24 |
|
25 #include <ecam.h> |
|
26 #include <ecam/ecamcommonuids.hrh> |
|
27 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
28 #include <ecam/cameraoverlayconst.h> |
|
29 #endif |
|
30 |
|
31 class MCameraOverlay; |
|
32 class MCameraOverlay2; |
|
33 |
|
34 |
|
35 /** |
|
36 This is the UID which is used to obtain the CCameraOverlay interface, |
|
37 via a call to CCamera::CustomInterface(). |
|
38 |
|
39 @see KECamOverlayUidValue |
|
40 @see CCamera::CCameraOverlay |
|
41 */ |
|
42 static const TUid KECamOverlayUid = {KECamOverlayUidValue}; |
|
43 |
|
44 |
|
45 /** |
|
46 This class provides support for image overlays. |
|
47 The client can use it to overlay an image onto the viewfinder, snapshots, still images and video. |
|
48 A client can create multiple overlays, where each overlay can be in a different format. |
|
49 The properties of an overlay can be changed after it has been created. |
|
50 |
|
51 @note This class provides a standardised client interface for the camera overlay. Classes cannot be derived from it. |
|
52 |
|
53 @note If the class methods leave, the output type parameter value is not guaranteed to be valid. |
|
54 |
|
55 @publishedAll |
|
56 @released |
|
57 */ |
|
58 class CCamera::CCameraOverlay: public CBase |
|
59 { |
|
60 |
|
61 friend class CCamera; |
|
62 |
|
63 public: |
|
64 /** |
|
65 Overlay camera mode types |
|
66 |
|
67 Represents the possible camera modes in which the overlay could be used. |
|
68 Several types can be combined when returning ECam implementation support for various modes. |
|
69 */ |
|
70 enum TOverlayCameraMode |
|
71 { |
|
72 /** Overlays are not supported for any camera mode. */ |
|
73 EModeNone = 0x00, |
|
74 /** The image can be overlaid on captured images. |
|
75 The camera is in still image mode. This effectively means all the still image drive modes and |
|
76 its interpretation may be implementation-specific. |
|
77 Explicit definition of drive modes is recommended instead. |
|
78 */ |
|
79 EModeStillImage = 0x01, |
|
80 /** The image can be overlaid on a snapshot. |
|
81 The camera has snapshot functionality set on. |
|
82 */ |
|
83 EModeSnapshot = 0x02, |
|
84 /** |
|
85 The image can be overlaid on a viewfinder. |
|
86 The camera is displaying directly to viewfinder. |
|
87 This mode shall not be used if any of the viewfinder submodes is specified. |
|
88 @note Overlay visibility for different viewfinder modes (direct/client-based) is |
|
89 implementation-specific; viewfinder modes should be explicitly specified by clients instead. |
|
90 */ |
|
91 EModeViewfinder = 0x04, |
|
92 /** The image can be overlaid on a video frame. |
|
93 The camera is in video mode. */ |
|
94 EModeVideo = 0x08, |
|
95 /** |
|
96 The image is to be overlaid on direct viewfinder |
|
97 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
98 */ |
|
99 EModeDirectViewfinder = 0x00010, |
|
100 /** |
|
101 The image is to be overlaid on client-based viewfinder |
|
102 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
103 */ |
|
104 EModeClientViewfinder = 0x00020, |
|
105 /** |
|
106 The image is to be overlaid when Continuous Still Image driving mode is active. |
|
107 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
108 */ |
|
109 EModeStillImageContinuous = 0x00080, |
|
110 /** |
|
111 The image is to be overlaid when Still Image Bracketing driving mode is active. |
|
112 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
113 */ |
|
114 EModeStillImageBracket = 0x00100, |
|
115 /** |
|
116 The image is to be overlaid when Still Image Bracketing with Merge option driving mode is active. |
|
117 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
118 */ |
|
119 EModeStillImageBracketMerge = 0x00200, |
|
120 /** |
|
121 The image is to be overlaid when Timed Still Image driving mode is active. |
|
122 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
123 */ |
|
124 EModeStillImageTimed = 0x00400, |
|
125 /** |
|
126 The image is to be overlaid when Timed Still Image with Lapse option driving mode is active. |
|
127 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
128 */ |
|
129 EModeStillImageTimeLapse = 0x00800, |
|
130 /** |
|
131 The image is to be overlaid when Still Image Burst driving mode is active. |
|
132 @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() |
|
133 */ |
|
134 EModeStillImageBurst = 0x01000 |
|
135 }; |
|
136 |
|
137 /** |
|
138 Overlay types |
|
139 |
|
140 Type in which alpha value will be provided. |
|
141 */ |
|
142 enum TOverlayType |
|
143 { |
|
144 /** Does not support overlays. */ |
|
145 EOverlayNone = 0x00, |
|
146 /** Blending is on a per pixel basis, where the alpha value information is provided in the overlay bitmap itself. |
|
147 The alpha value is specified in each pixel of the bitmap (it is the alpha componenet of the TRgb object). The |
|
148 display mode of the bitmap should be such that alpha value is supported. TOverlayParameters::iAlphaValue is |
|
149 neglected in this case. */ |
|
150 EPerPixel = 0x01, |
|
151 /** Blending is on a per plane basis, where all pixels are affected by the same alpha value. The alpha value is |
|
152 provided through TOverlayParameters::iAlphaValue. */ |
|
153 EPerPlane = 0x02 |
|
154 }; |
|
155 |
|
156 /** |
|
157 Blending types |
|
158 |
|
159 Type of supported blending. |
|
160 */ |
|
161 enum TBlendingType |
|
162 { |
|
163 /** Does not support blending. */ |
|
164 EBlendNone, |
|
165 /** Supports only binary blending. If alpha value is 0xFF, it is opaque, otherwise transparent. */ |
|
166 EBinary, |
|
167 /** Full support for blending - all values in the range [0:255]. */ |
|
168 EFullRange, |
|
169 /** Supports only dynamic binary blending - |
|
170 allows values to be changed when overlay is being displayed. If alpha value is 0xFF, it is opaque, |
|
171 otherwise transparent. Since the blending is dynamic, SetModifiableOverlayBitmapL shall be used such that the |
|
172 bitmap could be changed by the implementation. */ |
|
173 EBinaryDynamic, |
|
174 /** Full support for dynamic blending - all values in the range [0:255] |
|
175 - allows values to be changed when overlay is being displayed. Since the blending is dynamic, |
|
176 SetModifiableOverlayBitmapL shall be used such that the bitmap could be changed by the implementation. */ |
|
177 EFullRangeDynamic |
|
178 }; |
|
179 |
|
180 /** |
|
181 Overlay support information characterizing the overlay functionality as a whole. |
|
182 @publishedPartner |
|
183 @prototype |
|
184 */ |
|
185 class TOverlaySupportInfo |
|
186 { |
|
187 public: |
|
188 IMPORT_C explicit TOverlaySupportInfo(); |
|
189 |
|
190 IMPORT_C TUint Size() const; |
|
191 IMPORT_C TUint Version() const; |
|
192 |
|
193 public: |
|
194 /** The camera modes that the ECam implementation supports when applying overlays. |
|
195 The modes are held as a bitwise logical OR of the relevant individual modes |
|
196 defined in CCamera::CCameraOverlay::TOverlayCameraMode. */ |
|
197 TUint iSupportedModes; |
|
198 /** The camera types that the ECam implementation supports when applying overlays. |
|
199 The types are held as a bitwise logical OR of the relevant individual types |
|
200 defined in CCamera::CCameraOverlay::TOverlayType. */ |
|
201 TUint iSupportedTypes; |
|
202 /** Represents blending type for EPerPlane overlay Type.*/ |
|
203 TBlendingType iPerPlane; |
|
204 /** Represents blending type for EPerPixel overlay Type.*/ |
|
205 TBlendingType iPerPixel; |
|
206 /** Whether overlapping overlays are supported. */ |
|
207 TBool iCanOverlap; |
|
208 |
|
209 /** This is an input parameter which the client needs to provide. It represents the specific camera mode for which |
|
210 the overlay support information is required. |
|
211 Default values for iDesiredCameraMode (that is, CCamera::CCameraOverlay::EModeNone) and iViewFinderHandle (that is, |
|
212 KECamOverlayInvalidViewFinderHandle) implies that the client is using the TOverlaySupportInfo as before and |
|
213 iSupportedModes will not be neglected. Refer to TOverlaySupportInfo(). |
|
214 */ |
|
215 TOverlayCameraMode iDesiredCameraMode; |
|
216 /** This is also another input parameter which the client needs to provide. It represents the specific viewfinder |
|
217 handle for which the overlay support information is required. |
|
218 If iViewFinderHandle is KECamOverlayNoSpecificViewFinderHandle, then generic overlay support is required which will |
|
219 be valid for every viewfinder handle of type iDesiredCameraMode. |
|
220 Default values for iDesiredCameraMode (that is, CCamera::CCameraOverlay::EModeNone) and iViewFinderHandle (that is, |
|
221 KECamOverlayInvalidViewFinderHandle) implies that the client is using the TOverlaySupportInfo as before and |
|
222 iSupportedModes will not be neglected. Refer to TOverlaySupportInfo(). |
|
223 */ |
|
224 TInt iViewFinderHandle; |
|
225 |
|
226 private: |
|
227 // reserved for future expansion |
|
228 TInt iReserved3; |
|
229 }; |
|
230 |
|
231 /** |
|
232 Overlay parameters characterizing a particular overlay. |
|
233 @publishedPartner |
|
234 @prototype |
|
235 */ |
|
236 class TOverlayParameters |
|
237 { |
|
238 public: |
|
239 IMPORT_C explicit TOverlayParameters(); |
|
240 |
|
241 IMPORT_C TUint Size() const; |
|
242 IMPORT_C TUint Version() const; |
|
243 |
|
244 public: |
|
245 /** The camera modes in which this image overlay can be used. |
|
246 The modes are held as a bitwise logical OR of the relevant individual modes |
|
247 defined in CCamera::CCameraOverlay::TOverlayCameraMode. */ |
|
248 TUint iCurrentModes; |
|
249 /** The camera types in which this image overlay can be used. |
|
250 The types are held as a bitwise logical OR of the relevant individual types |
|
251 defined in CCamera::CCameraOverlay::TOverlayType. */ |
|
252 TUint iCurrentTypes; |
|
253 /** This is the alpha value to be applied when iCurrentTypes contains type |
|
254 CCamera::CCameraOverlay::TOverlayType::EPerPlane. The alpha value for red, green and blue is packed into this |
|
255 TInt. The layout of this TInt is such that the most significant byte (from left side) is not used at all and the |
|
256 remaining three bytes (after the most significant byte) contains the alpha value for red, green and blue. |
|
257 Otherwise, if iCurrentTypes only contains type CCamera::CCameraOverlay::TOverlayType::EPerPixel, |
|
258 then iAlphaValue will not be used. */ |
|
259 TInt iAlphaValue; |
|
260 /** Top left corner within the original image, where the overlay image is to be blended. */ |
|
261 TPoint iPosition; |
|
262 /** The z-order of the overlay to indicate relative depth when several overlays are applied. |
|
263 Values are in the range 0 to 100. The overlay with iZOrder of 0 is the deepest.*/ |
|
264 TUint iZOrder; |
|
265 /** The handle for the viewfinder on which the overlay is supposed to be applied. Only one viewfinder handle can be passed. |
|
266 If KECamOverlayNoSpecificViewFinderHandle is provided by the client, then the overlay is supposed to be applied for every |
|
267 viewfinder handle of type as given by iCurrentModes. |
|
268 If KECamOverlayInvalidViewFinderHandle, then the default implementation is being used where |
|
269 TOverlayParameters::iCurrentModes will not be neglected and overlay will be applied for every viewfinder alongwith |
|
270 other camera modes. |
|
271 */ |
|
272 TInt iViewFinderHandle; |
|
273 private: |
|
274 // reserved for future expansion. |
|
275 TInt iReserved2; |
|
276 TInt iReserved3; |
|
277 // Reserved members which came into existence as a result of removing Tsize public member variable. |
|
278 TInt iReserved4; |
|
279 TInt iReserved5; |
|
280 }; |
|
281 |
|
282 public: |
|
283 |
|
284 IMPORT_C static CCameraOverlay* NewL(CCamera& aCamera); |
|
285 IMPORT_C ~CCameraOverlay(); |
|
286 IMPORT_C void GetOverlaySupport(TOverlaySupportInfo& aInfo); |
|
287 |
|
288 IMPORT_C TUint CreateOverlayL(const TOverlayParameters& aParameters, CFbsBitmap* aBitmap); |
|
289 IMPORT_C void ReleaseOverlay(TUint aOverlayHandle); |
|
290 |
|
291 IMPORT_C void SetOverlayBitmapL(TUint aOverlayHandle, const CFbsBitmap* aBitmap); |
|
292 IMPORT_C void SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap); |
|
293 |
|
294 IMPORT_C void GetOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap); |
|
295 IMPORT_C void GetOverlayParametersL(TUint aOverlayHandle, TOverlayParameters& aInfo); |
|
296 IMPORT_C void SetOverlayParametersL(TUint aOverlayHandle, const TOverlayParameters& aParameters); |
|
297 |
|
298 IMPORT_C void GetAllOverlaysInZOrderL(RArray<TUint>& aOverlayHandles); |
|
299 IMPORT_C void SetAllOverlaysInZOrderL(const RArray<TUint>& aOverlayHandles); |
|
300 |
|
301 IMPORT_C void GetAllOverlaysInZOrderL(TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, RArray<TUint>& aOverlayHandles) const; |
|
302 IMPORT_C void SetAllOverlaysInZOrderL(TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, const RArray<TUint>& aOverlayHandles); |
|
303 |
|
304 private: |
|
305 CCameraOverlay(CCamera& aOwner); |
|
306 void ConstructL(); |
|
307 |
|
308 private: |
|
309 CCamera& iOwner; |
|
310 MCameraOverlay* iImpl; // not owned |
|
311 MCameraOverlay2* iImpl2; // not owned |
|
312 }; |
|
313 |
|
314 #endif // CAMERAOVERLAY_H |