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