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
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 /**
    19  @file
    20  @publishedAll
    21  @released
    22 */
    23 
    24 #ifndef CAMERAOVERLAY_H
    25 #define CAMERAOVERLAY_H
    26 
    27 #include <ecam.h>
    28 #include <ecam/ecamcommonuids.hrh>
    29 
    30 class MCameraOverlay;
    31 class MCameraOverlay2;
    32 
    33 /** 
    34 The current Version for the TOverlaySupportInfo class.
    35 @publishedPartner
    36 @prototype
    37 */
    38 static const TUint KECamOverlaySupportInfoCurrentVersion = 1;
    39 
    40 /** 
    41 The current Version for the TOverlayParameters class.
    42 @publishedPartner
    43 @prototype
    44 */
    45 static const TUint KECamOverlayParametersCurrentVersion = 1;
    46 
    47 /** 
    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.
    50 @publishedPartner
    51 @prototype
    52 */
    53 static const TInt  KECamOverlayNoSpecificViewFinderHandle = -1;
    54 
    55 /**
    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 
    61 neglected.
    62 @publishedPartner
    63 @prototype
    64 */
    65 static const TInt  KECamOverlayInvalidViewFinderHandle = -2;
    66 
    67 /** 
    68 This is the UID which is used to obtain the CCameraOverlay interface, 
    69 via a call to CCamera::CustomInterface().
    70 
    71 @see KECamOverlayUidValue
    72 @see CCamera::CCameraOverlay
    73 */
    74 static const TUid  KECamOverlayUid = {KECamOverlayUidValue};
    75 
    76 	
    77 /**
    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.
    82 
    83 @note This class provides a standardised client interface for the camera overlay. Classes cannot be derived from it.
    84 
    85 @note   If the class methods leave, the output type parameter value is not guaranteed to be valid.
    86 
    87 @publishedAll
    88 @released
    89 */
    90 class CCamera::CCameraOverlay: public CBase
    91 	{
    92 	
    93 	friend class CCamera;
    94 	
    95 public:	
    96 	/** 
    97 	Overlay camera mode types 
    98 	 
    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. 
   101 	*/
   102 	enum TOverlayCameraMode
   103 		{
   104 		/**	Overlays are not supported for any camera mode. */
   105 		EModeNone 		=  0x00,
   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.
   110 		*/
   111 		EModeStillImage	=  0x01,
   112 		/**	The image can be overlaid on a snapshot.
   113 		The camera has snapshot functionality set on. 
   114 		*/
   115 		EModeSnapshot	=  0x02,		
   116 		/**	
   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.
   122 		*/
   123 		EModeViewfinder	=  0x04,
   124 		/**	The image can be overlaid on a video frame. 
   125 		The camera is in video mode. */
   126 		EModeVideo		=  0x08,
   127 		/**
   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()
   130 		*/
   131 		EModeDirectViewfinder       = 0x00010,
   132 		/**
   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()
   135 		*/
   136 		EModeClientViewfinder       = 0x00020,
   137 		/**
   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()
   140 		*/		
   141 		EModeStillImageContinuous   = 0x00080,
   142 		/**
   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()
   145 		*/		
   146         EModeStillImageBracket		= 0x00100,
   147 		/**
   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()
   150 		*/        
   151         EModeStillImageBracketMerge	= 0x00200,
   152 		/**
   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()
   155 		*/         
   156         EModeStillImageTimed		= 0x00400,
   157 		/**
   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()
   160 		*/         
   161         EModeStillImageTimeLapse	= 0x00800,
   162 		/**
   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()
   165 		*/         
   166         EModeStillImageBurst		= 0x01000
   167 		};
   168 	
   169 	/** 
   170 	Overlay types 
   171 	 
   172 	Type in which alpha value will be provided.
   173 	*/
   174 	enum TOverlayType
   175 		{
   176 		/** Does not support overlays. */
   177 		EOverlayNone  	=  0x00,
   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. */
   182 		EPerPixel		=  0x01,
   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. */
   185 		EPerPlane		=  0x02	
   186 		};
   187 	
   188 	/** 
   189 	Blending types 
   190 	 
   191 	Type of supported blending.
   192 	*/
   193 	enum TBlendingType
   194 		{
   195 		/** Does not support blending. */
   196 		EBlendNone,
   197 		/** Supports only binary blending. If alpha value is 0xFF, it is opaque, otherwise transparent. */
   198 		EBinary,
   199 		/** Full support for blending - all values in the range [0:255]. */
   200 		EFullRange,
   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. */
   205 		EBinaryDynamic,
   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. */
   209 		EFullRangeDynamic
   210 		};
   211 		
   212 	/**
   213  	Overlay support information characterizing the overlay functionality as a whole.
   214  	@publishedPartner
   215 	@prototype
   216  	*/
   217 	class TOverlaySupportInfo
   218 	{
   219 	public:
   220 		IMPORT_C explicit TOverlaySupportInfo();
   221 		
   222 		IMPORT_C TUint Size() const;
   223 		IMPORT_C TUint Version() const;
   224 		
   225 	public:
   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. */
   239 		TBool         iCanOverlap;  
   240 		
   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().
   246 		*/
   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().
   255 		*/
   256 		TInt iViewFinderHandle; 
   257 		
   258 		private:
   259 		// reserved for future expansion
   260 		TInt iReserved3;	 
   261 	};
   262 		
   263 	/**
   264  	Overlay parameters characterizing a particular overlay.
   265  	@publishedPartner
   266 	@prototype
   267  	*/
   268 	class TOverlayParameters
   269 	{
   270 	public:
   271 		IMPORT_C explicit TOverlayParameters();
   272 		
   273 		IMPORT_C TUint Size() const;
   274 		IMPORT_C TUint Version() const;		
   275 		
   276 	public:
   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. */
   280 		TUint 	iCurrentModes; 	
   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. */
   284 		TUint 	iCurrentTypes; 	
   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. */
   291 		TInt 	iAlphaValue; 	
   292 		/** Top left corner within the original image, where the overlay image is to be blended. */
   293 		TPoint 	iPosition; 		
   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.*/
   296 		TUint   iZOrder;       
   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
   302 		other camera modes.
   303 		*/
   304 		TInt iViewFinderHandle;
   305 	private:
   306 		// reserved for future expansion.
   307 		TInt iReserved2;
   308 		TInt iReserved3;
   309 		// Reserved members which came into existence as a result of removing Tsize public member variable.
   310 		TInt iReserved4;
   311 		TInt iReserved5;	 
   312 	};
   313 		
   314 public:
   315 	
   316 	IMPORT_C static CCameraOverlay* NewL(CCamera& aCamera);
   317 	IMPORT_C ~CCameraOverlay();
   318 	IMPORT_C void GetOverlaySupport(TOverlaySupportInfo& aInfo);   
   319 
   320 	IMPORT_C TUint CreateOverlayL(const TOverlayParameters& aParameters, CFbsBitmap* aBitmap);
   321 	IMPORT_C void ReleaseOverlay(TUint aOverlayHandle);
   322 
   323 	IMPORT_C void SetOverlayBitmapL(TUint aOverlayHandle, const CFbsBitmap* aBitmap);
   324 	IMPORT_C void SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap);
   325 		
   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);
   329 
   330 	IMPORT_C void GetAllOverlaysInZOrderL(RArray<TUint>& aOverlayHandles);
   331 	IMPORT_C void SetAllOverlaysInZOrderL(const RArray<TUint>& aOverlayHandles);
   332 	
   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);
   335 
   336 private:
   337 	CCameraOverlay(CCamera& aOwner);
   338 	void ConstructL();
   339 
   340 private:
   341 	CCamera&        iOwner; 
   342 	MCameraOverlay* iImpl;    // not owned
   343 	MCameraOverlay2* iImpl2;  // not owned
   344 	};	
   345 
   346 #endif // CAMERAOVERLAY_H