imagingandcamerafws/camerafw/Include/MCameraSnapshot.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     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  @publishedPartner
       
    19  @prototype
       
    20 */
       
    21 
       
    22 #ifndef MCAMERASNAPSHOT_H
       
    23 #define MCAMERASNAPSHOT_H
       
    24 
       
    25 #include <ecam/camerasnapshot.h> 
       
    26 #include <ecam/ecamcommonuidif.hrh>
       
    27 
       
    28 class TRgb;
       
    29 
       
    30 /** 
       
    31 This is the UID which is used to obtain the MCameraSnapshot interface, 
       
    32 via a call to CCamera::CustomInterface(), which provides implementation of the M-class interface. 
       
    33 
       
    34 @see KECamMCameraSnapshotUidValue
       
    35 */   
       
    36 static const TUid KECamMCameraSnapshotUid = {KECamMCameraSnapshotUidValue};
       
    37 
       
    38 /** 
       
    39 This is the UID which is used to obtain the MCameraSnapshot2 interface, 
       
    40 via a call to CCamera::CustomInterface(), which provides implementation of the M-class interface. 
       
    41 
       
    42 @see KECamMCameraSnapshot2UidValue
       
    43 */   
       
    44 static const TUid KECamMCameraSnapshot2Uid = {KECamMCameraSnapshot2UidValue};
       
    45 
       
    46 /**
       
    47 This is a mixin class to be implemented by providers of the extension API for the camera snapshot.
       
    48 
       
    49 @note This class is intended for sub classing by licensees only.
       
    50 
       
    51 @see CCamera::CCameraSnapshot
       
    52 
       
    53 @publishedPartner
       
    54 @prototype
       
    55 */
       
    56 
       
    57 class MCameraSnapshot
       
    58 	{
       
    59 	
       
    60 public:	
       
    61 	/**
       
    62 	@publishedPartner
       
    63 	@released
       
    64 	
       
    65 	Gets a list of camera formats for which the ECam implementation supports snapshots.
       
    66 
       
    67 	@return	Bit field containing the supported camera formats as CCamera::TFormat values.
       
    68 	*/
       
    69 	virtual TUint32 SupportedFormats()=0;
       
    70 			
       
    71 	/**
       
    72 	@deprecated Use void MCameraSnapshot2::PrepareSnapshotL(const CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters);
       
    73 
       
    74 	Sets the properties of the snapshot data including the background colour and the position of the snapshot.
       
    75 
       
    76 	@param 	aFormat
       
    77 			The image format that the snapshot must have.
       
    78 	@param 	aPosition
       
    79 			The top left corner position (in pixels) which determines the layout of the snapshot image  
       
    80 			within the dimensions provided by the aSize parameter when the snapshot has been scaled 
       
    81 			maintaining its aspect ratio. See also SetPositionL().
       
    82 	@param 	aSize
       
    83 			The size of the snapshot in pixels.
       
    84 	@param 	aBgColor
       
    85 			The background colour to be used if the snapshot has been scaled (maintaining its aspect ratio)
       
    86 			and does not fully fill the dimension provided by the aSize parameter. See also SetBgColorL().
       
    87 	@param 	aMaintainAspectRatio
       
    88 			Set to ETrue if the aspect ratio of the snapshot image must be maintained when scaling down.
       
    89 
       
    90 	@leave  KErrNotSupported if the specified image format is not supported; also any system wide error.
       
    91 	*/
       
    92     virtual void PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio)=0;
       
    93     
       
    94 	/**
       
    95 	@deprecated Use void MCameraSnapshot2::PrepareSnapshotL(const CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters);
       
    96 
       
    97 	Sets the properties of the snapshot data, excluding the background colour and the position of the snapshot.
       
    98 	This method can be used when the client wishes to determine the layout and background colour after the
       
    99 	snapshot image has been generated. See also SetPositionL() and SetBgColorL().
       
   100 
       
   101 	@param 	aFormat
       
   102 			The image format that the snapshot must have.
       
   103 	@param 	aSize
       
   104 			The size of the snapshot in pixels.
       
   105 	@param 	aMaintainAspectRatio
       
   106 			Set to ETrue if the aspect ratio of the snapshot image must be maintained when scaling down.
       
   107 
       
   108 	@leave  KErrNotSupported if the specified image format is not supported; also any system wide error.
       
   109 	*/
       
   110 	virtual void PrepareSnapshotL(CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio)=0;
       
   111 	
       
   112 	/**
       
   113 	@deprecated Use void MCameraSnapshot2::SetSnapshotParametersL(const CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters);
       
   114 
       
   115 	Sets the background colour to be used if the snapshot has been scaled (maintaining its aspect ratio)
       
   116 	and does not fully fill the snapshot size as specified in PrepareSnapshot().
       
   117 
       
   118 	@param 	aBgColor
       
   119 			The new background colour.
       
   120 
       
   121 	@leave  KErrNotSupported if the specified image format is not supported; also any system wide error.
       
   122 	*/		
       
   123 	virtual void SetBgColorL(const TRgb& aBgColor)=0; 
       
   124 	
       
   125 	/**
       
   126 	@deprecated Use void MCameraSnapshot2::SetSnapshotParametersL(const CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters);
       
   127 
       
   128 	Sets the top left corner position (in pixels), where the snapshot should be laid out after scaling
       
   129 	down (maintaining its aspect ratio). The position is within the dimensions provided by the snapshot 
       
   130 	size specified in PrepareSnapshot().
       
   131 	
       
   132 	@param 	aPosition
       
   133 			The top left corner position in pixels of the snapshot.  		
       
   134 	
       
   135 	@leave  KErrNotSupported if the specified image format is not supported; also any system wide error.
       
   136 	*/
       
   137 	virtual void SetPositionL(const TPoint& aPosition)=0;
       
   138 	
       
   139 	/**
       
   140 	@deprecated Use void MCameraSnapshot2::GetSnapshotStatusL(CCamera::CCameraSnapshot::TSnapshotState& aSnapshotState) const;
       
   141 
       
   142 	Determines if the snapshot feature is active.
       
   143 
       
   144 	@return	ETrue, if StartSnapshot() has been called, otherwise EFalse.
       
   145 	*/
       
   146     virtual TBool IsSnapshotActive() const=0;
       
   147 
       
   148 	/**
       
   149 	@deprecated Use void MCameraSnapshot2::EnableSnapshotL();
       
   150 
       
   151 	Activates the snapshot feature. Calls to this method when the snapshot feature is already active
       
   152 	will be ignored. 
       
   153 
       
   154 	The client will not receive snapshot notifications until the snapshot feature is activated. 
       
   155 	*/
       
   156     virtual void StartSnapshot()=0;
       
   157 
       
   158 	/**
       
   159 	@deprecated Use void MCameraSnapshot2::DisableSnapshotL();
       
   160 	
       
   161 	Deactivates the snapshot feature if it is active. 
       
   162 
       
   163 	Once the snapshot has been deactivated, the client will no longer receive notifications about snapshots.
       
   164 	*/
       
   165 	virtual void StopSnapshot()=0;
       
   166         	
       
   167 	/**
       
   168 	@deprecated Use callbacks: MCaptureImageObserver::ClientSnapshotForImageReady and MCaptureVideoObserver::
       
   169 				ClientSnapshotReady
       
   170 	
       
   171 	Returns the snapshot data from ECam implementation to the client. 
       
   172 
       
   173 	The data is returned in an MCameraBuffer object. In the case where the driving mode returns more 
       
   174 	than one image (burst mode, bracket mode, etc.) the buffer contains several snapshots which may 
       
   175 	be returned in any order. The aFrameIndexOrder array provides the image sequence numbers in the 
       
   176 	order in which the snapshots for those images are returned within the MCameraBuffer.
       
   177 
       
   178 	@param 	aFrameIndexOrder
       
   179 			A reference to an array that will receive the image sequence numbers in the order to which  
       
   180 			the snapshots within MCameraBuffer relate.
       
   181 
       
   182 	@return	A reference to an MCameraBuffer which will contain the returned snapshot image data.
       
   183 		
       
   184 	@leave	KErrNoMemory if the ECam implementation has not been able to create the camera buffer;
       
   185 			also any system wide error.
       
   186 	*/
       
   187 	virtual MCameraBuffer& SnapshotDataL(RArray<TInt>& aFrameIndexOrder)=0;
       
   188 
       
   189 	/**
       
   190 	Destroys the object of this class on the ECam implementation. 
       
   191 	This function is called from the destructor of CCamera::CCameraSnapshot.
       
   192 	*/
       
   193 	virtual void Release()=0;
       
   194 	    
       
   195 	};
       
   196 	
       
   197 /**
       
   198 This is a mixin class to be implemented by providers of the extension API for the extra features for camera snapshot.
       
   199 
       
   200 @see CCamera::CCameraSnapshot
       
   201 
       
   202 @publishedPartner
       
   203 @prototype
       
   204 */
       
   205 
       
   206 class MCameraSnapshot2
       
   207 	{
       
   208 	
       
   209 public:	
       
   210 	/** 
       
   211 	Releases the interface. 
       
   212 	*/
       
   213 	virtual void Release()=0;
       
   214 	
       
   215 	/**
       
   216 	Sets the client viewfinder on which the client snapshot will be displayed.
       
   217 	
       
   218 	@param aClientViewFinderId
       
   219 		   The client viewfinder on which this client snapshot will be displayed.
       
   220 	*/
       
   221 	virtual void SetClientViewFinderId(TInt aClientViewFinderId)=0;
       
   222 	
       
   223 	/**
       
   224 	Retrieves the concrete factory handle for the histogram implementation in order to 
       
   225 	use it specifically for a given snapshot.
       
   226 		   
       
   227 	@param aImplFactoryPtr
       
   228 		   The concrete factory handle for the histogram implementation specific to the given snapshot.
       
   229 		   
       
   230 	@leave  May leave with any error code.
       
   231 	*/
       
   232 	virtual void CreateHistogramImplFactoryL(MImplementationFactory*& aImplFactoryPtr) const=0;
       
   233 	
       
   234 	/**
       
   235 	Sets the properties of the snapshot. ECam implementation may use a different size than that specified by this method. 
       
   236 	
       
   237 	@param  aSnapshotParameters
       
   238 			The snaspshot parameters.
       
   239 	
       
   240 	@leave  May leave with any error code.
       
   241 	
       
   242 	@note   This method is used to provide snapshot parameters.
       
   243 	*/
       
   244 	virtual void PrepareSnapshotL(const CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters)=0;
       
   245 	
       
   246 	/**
       
   247 	Retrieves the snapshot parameters. ECam implementation may use a different size than that provided by this method.
       
   248 	
       
   249 	@param  aSnapshotParameters
       
   250 			Retrieves the currently used snapshot parameters.
       
   251 	
       
   252 	@leave  May leave with any error code.
       
   253 	
       
   254 	@note   This method is used to retrieve snapshot parameters.
       
   255 	*/
       
   256 	virtual void GetSnapshotParametersL(CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters)=0;
       
   257 	
       
   258 	/**
       
   259 	Sets/updates the snapshot parameters.
       
   260 	
       
   261 	@param  aSnapshotParameters
       
   262 			The desired snapshot parameters.
       
   263 			
       
   264 	@leave  May leave with any error code.
       
   265 	
       
   266 	@note   This method is used to set/update snapshot parameters.
       
   267 	*/
       
   268 	virtual void SetSnapshotParametersL(const CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters)=0; 
       
   269 
       
   270 	/**
       
   271 	Retrieves the current status for the snapshot.
       
   272 	
       
   273 	@param  aSnapshotState
       
   274 			Retrieves information about the current snapshot state.
       
   275 		
       
   276 	@leave  May leave with any error code.
       
   277 
       
   278 	@note   This method is used to retrieve the snapshot status.
       
   279 	*/
       
   280 	virtual void GetSnapshotStatusL(CCamera::CCameraSnapshot::TSnapshotState& aSnapshotState) const=0;
       
   281 	
       
   282 	/**
       
   283 	The method specifies the frames to be used from video captured data in order to create snapshot for video.
       
   284 
       
   285 	@param  aSnapshotVideoFrames
       
   286 			A TSnapshotVideoFrames used to specify the desired frames to be used for creating snapshots for video. 
       
   287 			
       
   288 	@leave  May leave with any error code.
       
   289 	*/
       
   290 	virtual void SelectSnapshotVideoFramesL(CCamera::CCameraSnapshot::TSnapshotVideoFrames aSnapshotVideoFrames)=0;
       
   291 	
       
   292 	/**
       
   293 	Activates the snapshot feature. Calls to this method when the snapshot feature is already active will be ignored. 
       
   294 
       
   295 	The client will not receive snapshot notifications until the snapshot feature is activated. 
       
   296 
       
   297 	Implementation shall use the observers: MCaptureImageObserver and MCaptureVideoObserver. Snapshot notifications will 
       
   298 	be send	to the clients via these observers and not through events.
       
   299 	*/
       
   300 	virtual void EnableSnapshot()=0;
       
   301 	
       
   302 	/**
       
   303 	Deactivates the snapshot feature if it is active. 
       
   304 
       
   305 	Once the snapshot has been deactivated, the client will no longer receive notifications about snapshots.
       
   306 	*/
       
   307 	virtual void DisableSnapshot()=0;
       
   308 	};
       
   309 	
       
   310 #endif // MCAMERASNAPSHOT_H