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