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