sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: /**
sl@0:  @file
sl@0:  @publishedPartner
sl@0:  @prototype
sl@0: */
sl@0: #ifndef  ECAMVIEWFINDER_H
sl@0: #define  ECAMVIEWFINDER_H
sl@0: 
sl@0: #include <e32base.h>
sl@0: #include <gdi.h>
sl@0: #include <ecamadvsettings.h>
sl@0: 
sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: #include <ecamviewfinderdef.h>
sl@0: #else
sl@0: #include <ecamadvsettingsuidsconst.hrh>
sl@0: #include <ecamconst.h>
sl@0: #endif
sl@0: 
sl@0: class MCameraViewFinder;
sl@0: class MCameraV2DirectViewFinder;
sl@0: class MCameraClientViewFinder;
sl@0: 
sl@0: class MCameraDirectSnapshot;
sl@0: 
sl@0: class MHistogramV2Buffer;
sl@0: 
sl@0: /**
sl@0: Specific handle used to refer to viewfinder which is started using CCamera methods.
sl@0: */
sl@0: static const TInt KECamDefaultViewFinderHandle = 0;
sl@0: 
sl@0: /** 
sl@0: The current Version of the TDirectSnapshotParameters class.
sl@0: */
sl@0: static const TUint KECamDirectSnapshotParametersCurrentVersion = 1;
sl@0: 
sl@0: /** 
sl@0: UID used to identify the CCameraV2DirectViewFinder API.
sl@0: 
sl@0: @see CCamera::CCameraV2DirectViewFinder
sl@0: */
sl@0: static const TUid KECamV2DirectViewFinderUid 	= {KECamV2DirectViewFinderUidValue};
sl@0: 
sl@0: /** 
sl@0: UID used to identify the CCameraClientViewFinder API.
sl@0: 
sl@0: @see CCamera::CCameraClientViewFinder
sl@0: */
sl@0: static const TUid KECamClientViewFinderUid 	= {KECamClientViewFinderUidValue};
sl@0: 
sl@0: /** 
sl@0: UID used to identify the CCamera::CCameraDirectSnapshot API.
sl@0: This is the UID which is used to obtain the CCameraDirectSnapshot interface, 
sl@0: via a call to CCamera::CustomInterface().
sl@0: 
sl@0: @see KECamDirectSnapshotUidValue
sl@0: @see CCamera::CCameraDirectSnapshot
sl@0: 
sl@0: @publishedPartner
sl@0: @prototype
sl@0: */
sl@0: static const TUid KECamDirectSnapshotUid = {KECamDirectSnapshotUidValue};
sl@0: 
sl@0: /**
sl@0: A mixin class to be implemented by the client in order to use the V2 direct view finder API CCameraV2DirectViewFinder. The
sl@0: derived class methods are called by the implementation when the direct view finder operations are ready to be notified 
sl@0: accordingly. Implementation shall keep track of CCameraV2DirectViewFinder object deletion. It has to ensure that a callback 
sl@0: is not send should the client destroy the particular CCameraV2DirectViewFinder class object when the callback is queued to 
sl@0: be send across. Ownership of CCameraV2DirectViewFinder is retained by the client.
sl@0: 
sl@0: @see CCamera::CCameraV2DirectViewFinder
sl@0: */
sl@0: class MDirectViewFinderObserver
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client when the first direct viewfinder frame gets displayed 
sl@0: 	after starting/resuming a particular direct viewfinder.
sl@0: 	
sl@0: 	@param  aDirectViewFinderHandle
sl@0: 			Reference to CCameraV2DirectViewFinder class object which refers a particular direct viewfinder.
sl@0: 						
sl@0: 	@param  aErrorCode
sl@0: 			Appropriate error code.
sl@0: 	*/
sl@0: 	virtual void DirectViewFinderFirstFrameDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)=0;
sl@0: 																									  
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client when the direct histogram data gets displayed on the 
sl@0: 	screen for the first time after starting/resuming a particular direct viewfinder. If a call to CCameraV2Histogram::
sl@0: 	StartHistogram() is made without a previous successful call to CCameraV2Histogram::PrepareDirectHistogramL() then the
sl@0: 	callback returns KErrBadHandle.
sl@0: 	
sl@0: 	@param  aDirectViewFinderHandle
sl@0: 			Reference to CCameraV2DirectViewFinder class object which refers a particular direct viewfinder for which the 
sl@0: 			direct histogram data has been displayed.
sl@0: 	
sl@0: 	@param  aDirectHistogramDisplayed
sl@0: 			Reference to CCameraV2Histogram class object which refers a particular type of histogram being displayed.
sl@0: 	
sl@0: 	@param  aErrorCode
sl@0: 			Appropriate error code. 
sl@0: 	*/
sl@0: 	virtual void DirectHistogramDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraV2Histogram& aDirectHistogramDisplayed, TInt aErrorCode)=0;
sl@0: 	
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client about availability of the histogram data. If a call 
sl@0: 	to CCameraV2Histogram::StartHistogram() is made without a previous successful call to CCameraV2Histogram::
sl@0: 	PrepareClientHistogramL() then the callback returns KErrBadHandle.
sl@0: 	
sl@0: 	@param  aDirectViewFinderHandle
sl@0: 			Reference to CCameraV2DirectViewFinder class object which refers a particular direct viewfinder for which the 
sl@0: 			client histogram data have been generated.
sl@0: 	
sl@0: 	@param  aClientHistogramBuffer
sl@0: 			Pointer to MHistogramV2Buffer which retrieves a single histogram alongwith relevant information about it. The 
sl@0: 			ownership will be retained by the implementation. Client needs to call Release in order to indicate the 
sl@0: 			implementation that the buffer can be re-used. Client shall never try to delete the pointer. NULL, if error.
sl@0: 				
sl@0: 	@param  aErrorCode
sl@0: 			Appropriate error code. 
sl@0: 	
sl@0: 	@note   Client shall use the currently available histogram for the direct viewfinder frames until a new histogram is 
sl@0: 			available.
sl@0: 	*/
sl@0: 	virtual void ClientHistogramReady(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, MHistogramV2Buffer* aClientHistogramBuffer, TInt aErrorCode)=0;
sl@0: 	
sl@0: 	/** 
sl@0: 	Implementation sends this callback as a notification of the display of direct snapshot for still images on the display
sl@0: 	screen.
sl@0: 	
sl@0: 	@param  aDirectViewFinderHandle
sl@0: 			Reference to CCameraV2DirectViewFinder class object which refers a particular direct viewfinder on which the 
sl@0: 			direct snapshot data for still images have been displayed.
sl@0: 
sl@0: 	@param  aCaptureImageHandle
sl@0: 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
sl@0: 	
sl@0: 	@param  aPostCaptureControlId
sl@0: 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
sl@0: 			CCameraImageCapture class object. This is needed to identify the image which is represented by this snapshot.
sl@0: 	
sl@0: 	@param  aErrorCode
sl@0: 			Appropriate error code.
sl@0: 	*/
sl@0: 	virtual void DirectSnapshotForImageDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)=0;
sl@0: 	
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client about failure with the direct viewfinder.
sl@0: 	
sl@0: 	@param  aDirectViewFinderHandle
sl@0: 			Reference to CCameraV2DirectViewFinder class object which refers a particular direct viewfinder.
sl@0: 	
sl@0: 	@param  aErrorCode
sl@0: 			The reason of failure of the direct viewfinder. 
sl@0: 	*/
sl@0: 	virtual void DirectViewFinderFailed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)=0;
sl@0: 	
sl@0: 	/**
sl@0: 	Gets a custom interface for future callbacks. This method will be called by the implementation to get a new interface
sl@0: 	which would support future callbacks.
sl@0: 
sl@0: 	@param  aInterface
sl@0: 		    The Uid of the particular interface function required for callbacks.
sl@0: 		   
sl@0: 	@param  aPtrInterface
sl@0: 		    The implementation has to type-cast the retrieved custom interface pointer to the appropriate type.	
sl@0: 
sl@0: 	@return The error code.
sl@0: 	*/
sl@0: 	virtual TInt CustomInterface(TUid aInterface, TAny*& aPtrInterface)=0;
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: A mixin class to be implemented by the client in order to use the client view finder API CCameraClientViewFinder. The 
sl@0: derived class methods are called by the implementation when the client view finder operations are ready to be notified 
sl@0: accordingly. Implementation shall keep track of CCameraClientViewFinder object deletion. It has to ensure that a callback
sl@0: is not send should the client destroy the particular CCameraClientViewFinder class object when the callback is queued to
sl@0: be send across. Ownership of CCameraClientViewFinder is retained by the client.
sl@0: 
sl@0: @see CCamera::CCameraClientViewFinder
sl@0: */
sl@0: class MClientViewFinderObserver
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client about the availability of viewfinder frames.
sl@0: 	Viewfinder frames can be retrieved by the client using the CCameraClientViewFinder::GetViewFinderBufferL
sl@0: 	(MCameraBuffer2& aClientViewFinderBuffer).
sl@0: 	
sl@0: 	@param  CCameraClientViewFinder
sl@0: 			Reference to CCameraClientViewFinder class object which refers a particular client viewfinder.
sl@0: 						
sl@0: 	@param  aErrorCode
sl@0: 			Appropriate error code.
sl@0: 	*/
sl@0: 	virtual void ViewFinderBufferReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)=0;
sl@0: 																									  
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client when the direct histogram data gets displayed on the 
sl@0: 	screen for the first time after starting a particular client viewfinder. If a call to CCameraV2Histogram::
sl@0: 	StartHistogram() is made without a previous successful call to CCameraV2Histogram::PrepareDirectHistogramL() then the
sl@0: 	callback returns KErrBadHandle.
sl@0: 	
sl@0: 	@param  aClientViewFinderHandle
sl@0: 			Reference to CCameraClientViewFinder class object which refers a particular client viewfinder.
sl@0: 	
sl@0: 	@param  aDirectHistogramDisplayed
sl@0: 			Reference to CCameraV2Histogram class object which refers a particular type of histogram being displayed.
sl@0: 	
sl@0: 	@param  aErrorCode
sl@0: 			Appropriate error code. 
sl@0: 	*/
sl@0: 	virtual void DirectHistogramDisplayed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, CCamera::CCameraV2Histogram& aDirectHistogramDisplayed, TInt aErrorCode)=0;
sl@0: 	
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client about availability of the histogram data. If a call 
sl@0: 	to CCameraV2Histogram::StartHistogram() is made without a previous successful call to CCameraV2Histogram::
sl@0: 	PrepareClientHistogramL() then the callback returns KErrBadHandle.
sl@0: 	
sl@0: 	@param  aClientViewFinderHandle
sl@0: 			Reference to CCameraClientViewFinder class object which refers a particular client viewfinder for which the 
sl@0: 			client histogram data have been generated.
sl@0: 	
sl@0: 	@param  aClientHistogramBuffer
sl@0: 			Pointer to MHistogramV2Buffer which retrieves a single histogram alongwith relevant information about it. The 
sl@0: 			ownership will be retained by the implementation. Client needs to call Release in order to indicate the 
sl@0: 			implementation that the buffer can be re-used. Client shall never try to delete the pointer. NULL, if error.
sl@0: 			
sl@0: 	@param  aErrorCode
sl@0: 			Appropriate error code. 
sl@0: 	
sl@0: 	@note   Client shall use the currently available histogram for the viewfinder frames until a new histogram is 
sl@0: 			available.
sl@0: 	*/
sl@0: 	virtual void ClientHistogramReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, MHistogramV2Buffer* aClientHistogramBuffer, TInt aErrorCode)=0;
sl@0: 	
sl@0: 	/**
sl@0: 	Implementation sends this callback in order to notify the client about failure of image processing for the client 
sl@0: 	viewfinder frames.
sl@0: 	
sl@0: 	@param  aClientViewFinderHandle
sl@0: 			Reference to CCameraClientViewFinder class object which refers a particular client viewfinder.
sl@0: 	
sl@0: 	@param  aErrorCode
sl@0: 			The reason of failure of the image processing. 
sl@0: 	*/
sl@0: 	virtual void ImageProcessingFailed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)=0;
sl@0: 	
sl@0: 	/**
sl@0: 	Gets a custom interface for future callbacks. This method will be called by the implementation to get a new interface
sl@0: 	which would support future callbacks.
sl@0: 
sl@0: 	@param  aInterface
sl@0: 		    The Uid of the particular interface function required for callbacks.
sl@0: 		   
sl@0: 	@param  aPtrInterface
sl@0: 		    The implementation has to type-cast the retrieved custom interface pointer to the appropriate type.	
sl@0: 
sl@0: 	@return The error code.
sl@0: 	*/
sl@0: 	virtual TInt CustomInterface(TUid aInterface, TAny*& aPtrInterface)=0;
sl@0: 	};
sl@0: 
sl@0: /** 
sl@0: CCamera view finder base class is used to provide features common to both client view finders and direct view finders.
sl@0: 
sl@0: @note This class is not intended for stand alone use. One of the derived class shall be used instead.
sl@0: Features of this class will automatically be used when either direct view finder or client based view finder are 
sl@0: created by clients.
sl@0: 
sl@0: @note   If the class methods leave, the output type parameter value is not guaranteed to be valid.
sl@0: 
sl@0: @publishedPartner
sl@0: @prototype
sl@0: */
sl@0: class CCameraViewFinder : public CBase
sl@0: 	{
sl@0: 	/* so can use internal factory functions etc. */
sl@0: 	friend class CCamera;
sl@0: 
sl@0: public:
sl@0: 	/** 
sl@0: 	Different types of available viewfinder fading.
sl@0: 	The enumeration list may be extended in future.
sl@0: 	
sl@0: 	@internalTechnology
sl@0: 	*/
sl@0: 	enum TViewFinderFadingType
sl@0: 		{
sl@0: 		/** Fading not supported. */
sl@0: 		EVFFadingTypeNone	 		 		=0x00,
sl@0: 		/** Fading from a single frame of color given by the client. */
sl@0: 		EVFFadingTypeStaticColorFading      =0x01,
sl@0: 		/** Fading from a single frame given by the client. */
sl@0: 		EVFFadingTypeStaticFrameFading      =0x02,
sl@0: 		/** Fading from a number of previous VF frames. */
sl@0: 		EVFFadingTypeCross     	 			=0x04
sl@0: 		};
sl@0: 
sl@0: 	/** 
sl@0: 	Different ways to control the viewfinder fading.
sl@0: 	The enumeration list may be extended in future.
sl@0: 	
sl@0: 	@internalTechnology
sl@0: 	*/
sl@0: 	enum TViewFinderFadingControl
sl@0: 		{
sl@0: 		/** Fading not supported. */
sl@0: 		EVFFadingControlNone			= 0x00,
sl@0: 		/** Switch on (enable) the fading. */
sl@0: 		EVFFadingControlSwitchedOn		= 0x01,
sl@0: 		/** Switch off (disable) the fading. */
sl@0: 		EVFFadingControlSwitchedOff		= 0x02,
sl@0: 		/** Automatic fading. */
sl@0: 		EVFFadingControlSwitchAuto		= 0x04
sl@0: 		};
sl@0: 	
sl@0: 	/**
sl@0: 	Different directions in which the fading may appear.
sl@0: 	The enumeration list may be extended in future.
sl@0: 	
sl@0: 	@internalTechnology
sl@0: 	*/		
sl@0: 	enum TViewFinderFadingDirection
sl@0: 		{
sl@0: 		/** Fading not supported. */
sl@0: 		EVFFadingDirectionNone			= 0x00,
sl@0: 		/** Automatic direction or may be even custom direction decided by implementation. */
sl@0: 		EVFFadingDirectionAuto			= 0x01,
sl@0: 		/** Uniform fading. */ 
sl@0: 		EVFFadingDirectionUniform		= 0x02,
sl@0: 		/** Start to fade from up to down. */
sl@0: 		EVFFadingDirectionUpDown		= 0x04,
sl@0: 		/** Start to fade from down to up. */
sl@0: 		EVFFadingDirectionDownUp		= 0x08,
sl@0: 		/** Start to fade from left to right. */
sl@0: 		EVFFadingDirectionLeftRight		= 0x10,
sl@0: 		/** Start to fade from right to left. */
sl@0: 		EVFFadingDirectionRightLeft		= 0x20
sl@0: 		};
sl@0: 		
sl@0: 	/**
sl@0: 	Image enhancement options to be applied for a particular display.
sl@0: 	The enumeration list may be extended in future.
sl@0: 	
sl@0: 	@internalTechnology
sl@0: 	*/	
sl@0: 	enum TImageEnhancement
sl@0: 		{
sl@0: 		/** Not Supported. */
sl@0: 		EImageEnhancementNone 			= 0x00,
sl@0: 		/** Image Enhancement switches off. */
sl@0: 		EImageEnhancementSwitchOFF 		= 0x01,
sl@0: 		/** Image Enhancement switches to auto mode. */
sl@0: 		EImageEnhancementAuto 			= 0x02,
sl@0: 		/** Image Enhancement switches on. */
sl@0: 		EImageEnhancementSwitchOn 		= 0x04
sl@0: 		};
sl@0: 	
sl@0: 	/**
sl@0: 	Retrieves the capabilites of viewfinder fading.
sl@0: 	
sl@0: 	@internalTechnology
sl@0: 	*/
sl@0: 	class TViewFinderFadingCapabilities
sl@0: 		{
sl@0: 	public:
sl@0: 		IMPORT_C TViewFinderFadingCapabilities();
sl@0: 		
sl@0: 		IMPORT_C TUint Size() const;
sl@0: 		IMPORT_C TUint Version() const;
sl@0: 		
sl@0: 	private:
sl@0: 		//for future expansion
sl@0: 		TUint iSize:24;
sl@0: 		TUint iVersion:8;
sl@0: 		
sl@0: 		// reserved for future expansion
sl@0: 		TInt iReserved1;
sl@0: 		TInt iReserved2;
sl@0: 		
sl@0: 	public:
sl@0: 		/** Bit-field retrieving the supported fading type TViewFinderFadingType. */
sl@0: 		TUint iSupportedFadingType;
sl@0: 		/** Bit-field retrieving the supported fading control TViewFinderFadingControl. */
sl@0: 		TUint iSupportedFadingControl;
sl@0: 		/** Bit-field retrieving the supported fading direction TViewFinderFadingDirection. */
sl@0: 		TUint iSupportedFadingDirection;
sl@0: 		};
sl@0: 		
sl@0: 	/**
sl@0: 	Viewfinder fading effects characterizing a particular viewfinder fading.
sl@0: 	
sl@0: 	@internalTechnology
sl@0: 	*/
sl@0: 	class TViewFinderFadingEffect
sl@0: 		{
sl@0: 	public:
sl@0: 		IMPORT_C TViewFinderFadingEffect();
sl@0: 		
sl@0: 		IMPORT_C TUint Size() const;
sl@0: 		IMPORT_C TUint Version() const;
sl@0: 	
sl@0: 	private:
sl@0: 		//for future expansion
sl@0: 		TUint iSize:24;
sl@0: 		TUint iVersion:8; 
sl@0: 		
sl@0: 		// reserved for future expansion
sl@0: 		TInt iReserved1;
sl@0: 		TInt iReserved2;
sl@0: 		TInt iReserved3[6];
sl@0: 		
sl@0: 	public:
sl@0: 		/** The type of viewfinder fading to be used. */
sl@0: 		TViewFinderFadingType 		iViewFinderFadingType;
sl@0: 		/** The control for the viewfinder fading, that is, on/off/auto. */
sl@0: 		TViewFinderFadingControl 	iViewFinderFadingControl;
sl@0: 		/** The direction of viewfinder fading. */
sl@0: 		TViewFinderFadingDirection 	iViewFinderFadingDirection;
sl@0: 		/** The color used to fade from/to in case of static color fading. This is ignored if iViewFinderFadingType is 
sl@0: 		not EVFFadingTypeStaticColorFading. */
sl@0: 		TRgb  						iStaticFadingColor;
sl@0: 		/** The handle of CFbsBitmap used to obtain the frame used to fade from/to in case of static frame fading. 
sl@0: 		This is KECamStaticFrameFadingTypeNotUsed if iViewFinderFadingType is not EVFFadingTypeStaticFrameFading.
sl@0: 		This is KECamSpecialStaticFrameFormatHandle if CFBsBitmap handle is not to be used. */
sl@0: 		TInt						iStaticFadingFrameBitmapHandle;
sl@0: 		/** The number of previous frames to be saved for cross fading. 
sl@0: 		This is KECamCrossFadingFramesNotUsed if iViewFinderFadingType is not EVFFadingTypeCross. */
sl@0: 		TUint						iCrossFadingFrames;
sl@0: 		/** The fading time. This may be used both for auto and manual fading as per implementation. */
sl@0: 		TTimeIntervalMicroSeconds32 iFadingTime;
sl@0: 		};
sl@0: 
sl@0: public:
sl@0: 	
sl@0: 	IMPORT_C void GetViewFinderFadingCapabilitiesL(TViewFinderFadingCapabilities& aVFFadingCapabilities) const;
sl@0: 	IMPORT_C void GetViewFinderFadingEffectL(TViewFinderFadingEffect& aCurrentVFFadingEffect) const;
sl@0: 	IMPORT_C void SetViewFinderFadingEffectL(const TViewFinderFadingEffect& aVFFadingEffect);
sl@0: 	
sl@0: 	IMPORT_C void GetViewFinderHandleL(TInt& aVFHandle) const;
sl@0: 	
sl@0: 	~CCameraViewFinder();
sl@0: 	
sl@0: protected:
sl@0: 	CCameraViewFinder(CCamera& aOwner);
sl@0: 	
sl@0: protected: 
sl@0: 	void GetSpotsPositionL(TUint aSpotCombination, RArray<TRect>& aSpotsPosition) const;
sl@0: 	
sl@0: 	void GetSupportedImageEnhancementL(TUint& aSupportedImageEnhancement) const;
sl@0: 	void GetImageEnhancementL(TImageEnhancement& aImageEnhancement) const;
sl@0: 	void SetImageEnhancementL(TImageEnhancement aImageEnhancement);
sl@0: 	
sl@0: 	void GetSupportedVFMagnificationL(RArray<TUint>& aSupportedVFMagnification) const;
sl@0: 	void GetViewfinderMagnificationL(TUint& aVFMagnification) const; 
sl@0: 	void SetViewfinderMagnificationL(TUint aVFMagnification);
sl@0: 		   	
sl@0: protected:	
sl@0: 	CCamera&        	iOwner; 
sl@0: 	MCameraViewFinder* 	iImplBase;  // not owned
sl@0:     };	
sl@0: 
sl@0: /** 
sl@0: CCamera direct view finder v2 class is used to provide support for multiple Direct View Finder.
sl@0: A new instance of this class will be created for every new direct viewfinder.
sl@0: 
sl@0: @note This class is not intended for sub-classing and used to standardise existing varieties of implementations.
sl@0: 
sl@0: @note   If the class methods leave, the output type parameter value is not guaranteed to be valid.
sl@0: 
sl@0: @note  Clients must implement an MDirectViewFinderObserver in order to use this CCameraV2DirectViewFinder API.
sl@0: 
sl@0: @publishedPartner
sl@0: @prototype
sl@0: */
sl@0: class CCamera::CCameraV2DirectViewFinder : public CCameraViewFinder
sl@0: 	{
sl@0: 	/* so can use internal factory functions etc. */
sl@0: 	friend class CCamera;
sl@0: 	friend class CCamera::CCameraDirectSnapshot;
sl@0: 
sl@0: public:
sl@0:    
sl@0: 	/** Specifies direct viewfinder state. */ 
sl@0: 	enum TViewFinderState
sl@0: 		{
sl@0: 		/** View Finder is activated */  
sl@0: 		EViewFinderActive, 	 
sl@0: 		/** View Finder has been paused */
sl@0: 		EViewFinderPause,	 
sl@0: 		/** View Finder has been stopped or hasn't yet started. Default state. */
sl@0: 		EViewFinderInActive
sl@0: 		};
sl@0: 	
sl@0: public:
sl@0: 
sl@0: 	IMPORT_C static CCameraV2DirectViewFinder* NewL(CCamera& aOwner, MDirectViewFinderObserver& aDirectViewFinderObserver);
sl@0: 	
sl@0: 	IMPORT_C CCamera::CCameraV2Histogram* CreateHistogramHandleL() const;
sl@0: 	IMPORT_C CCamera::CCameraImageProcessing* GetTransformationHandleL() const;
sl@0: 	
sl@0: 	IMPORT_C CCamera::CCameraDirectSnapshot* GetDirectSnapshotHandleL() const; 
sl@0: 	
sl@0: 	IMPORT_C void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect);
sl@0: 										
sl@0: 	IMPORT_C void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, 
sl@0: 																			TRect& aScreenRect, TRect& aClipRect);
sl@0: 	
sl@0: 	IMPORT_C void GetDirectViewFinderPropertiesL(TInt& aScreenNumber, TRect& aScreenRect, TRect& aClipRect) const;
sl@0:     
sl@0:     IMPORT_C void PauseViewFinderDirect();
sl@0: 	IMPORT_C void ResumeViewFinderDirect();
sl@0: 	IMPORT_C void GetViewFinderStateL(TViewFinderState& aViewFinderState) const;
sl@0: 	
sl@0: 	IMPORT_C void StopDirectViewFinder();
sl@0: 	
sl@0: 	IMPORT_C ~CCameraV2DirectViewFinder();
sl@0: 	
sl@0: private:
sl@0: 	CCameraV2DirectViewFinder(CCamera& aOwner);
sl@0: 	void ConstructL(MDirectViewFinderObserver& aDirectViewFinderObserver);
sl@0: 	
sl@0: 	void SetImplHandle();
sl@0: 			
sl@0: 	void SetImplBaseHandle();
sl@0: 	
sl@0: 	MCameraV2DirectViewFinder* Impl();
sl@0: 	
sl@0: private:	
sl@0: 	MCameraV2DirectViewFinder* 	iImpl;  // not owned
sl@0:     };	
sl@0: 
sl@0: /** 
sl@0: CCamera client view finder class is used to provide support for multiple client View Finder.
sl@0: A new instance of this class will be created for every new client viewfinder.
sl@0: 
sl@0: @note  This class is not intended for sub-classing and used to standardise existing
sl@0:        varieties of implementations.
sl@0:        
sl@0: @note  If the class methods leave, the output type parameter value is not guaranteed to be valid.
sl@0: 
sl@0: @note  Clients must implement an MClientViewFinderObserver in order to use this CCameraClientViewFinder API. 
sl@0: 	   MCameraObserver2::ViewFinderReady will not be used with this class.
sl@0: 
sl@0: @publishedPartner
sl@0: @prototype
sl@0: */
sl@0: class CCamera::CCameraClientViewFinder : public CCameraViewFinder
sl@0: 	{
sl@0: 	/* so can use internal factory functions etc. */
sl@0: 	friend class CCamera;
sl@0: 
sl@0: public:
sl@0: 
sl@0: 	IMPORT_C static CCameraClientViewFinder* NewL(CCamera& aOwner, MClientViewFinderObserver& aClientViewFinderObserver);
sl@0: 	
sl@0: 	IMPORT_C CCamera::CCameraV2Histogram* CreateHistogramHandleL() const;
sl@0: 	IMPORT_C CCamera::CCameraImageProcessing* GetTransformationHandleL() const;
sl@0: 	
sl@0: 	IMPORT_C void StartClientViewFinderL(TInt aScreenNumber, CCamera::TFormat aImageFormat, TSize& aSize);
sl@0: 	IMPORT_C void StartClientViewFinderL(TInt aScreenNumber, CCamera::TFormat aImageFormat, TSize& aSize, TRect& aClipRect);
sl@0: 	
sl@0: 	IMPORT_C void GetClientViewFinderStateL(TBool& aIsActive) const;
sl@0: 	IMPORT_C void GetClientViewFinderPropertiesL(TInt& aScreenNumber, CCamera::TFormat& aImageFormat, TSize& aSize, TRect& aClipRect) const;
sl@0: 
sl@0: 	IMPORT_C void StopClientViewFinder();
sl@0: 	
sl@0: 	IMPORT_C void GetViewFinderBufferL(MCameraBuffer2& aClientViewFinderBuffer) const;
sl@0: 	
sl@0: 	IMPORT_C ~CCameraClientViewFinder();
sl@0: 	   	
sl@0: private:
sl@0: 	CCameraClientViewFinder(CCamera& aOwner);
sl@0: 	void ConstructL(MClientViewFinderObserver& aClientViewFinderObserver);
sl@0: 	
sl@0: 	void SetImplHandle();
sl@0: 			
sl@0: 	void SetImplBaseHandle();
sl@0: 	
sl@0: private:	
sl@0: 	MCameraClientViewFinder* 	iImpl;  // not owned
sl@0:     };
sl@0:     
sl@0: /**
sl@0: This class allows the client to enable direct snapshot feature for still images only. The direct snapshot API can not be 
sl@0: used for video.
sl@0: 
sl@0: The direct snapshot can be created out of CCameraV2DirectViewFinder object only. Its lifetime is dependent on the parent 
sl@0: direct viewfinder object. So, the client is supposed to destroy the direct snapshot object before deleting the parent 
sl@0: direct viewfinder object. The MDirectViewFinderObserver observer class provides callback to notify the client whenever
sl@0: direct snapshot data gets displayed on the given direct viewfinder screen. The callback also provides information regarding
sl@0: the CCameraImageCapture object used to issue the image capture calls. It also provides the Id for the individual images 
sl@0: which get represented by the snapshot displayed.
sl@0: 
sl@0: @note This class provides a standardised client interface for the direct snapshot. Classes cannot be derived from it.
sl@0: 
sl@0: @note If the class methods leave, the output type parameter value is not guaranteed to be valid.
sl@0: 
sl@0: @publishedPartner
sl@0: @prototype
sl@0: */ 
sl@0: class CCamera::CCameraDirectSnapshot : public CBase
sl@0: 	{
sl@0: 	friend class CCamera::CCameraV2DirectViewFinder;
sl@0: 
sl@0: public:
sl@0: 	/**
sl@0: 	Describes the state of direct snapshot. 
sl@0: 	The enumeration list may be extended in future.
sl@0: 	*/
sl@0: 	enum TDirectSnapshotState 
sl@0: 		{
sl@0: 		/** The direct snapshot has been enabled. */
sl@0: 		EDirectSnapshotEnabled, 
sl@0: 		/** The direct snapshot has been disabled. */
sl@0: 		EDirectSnapshotDisabled
sl@0: 		};
sl@0: 		
sl@0: 	/**
sl@0: 	Specifes the parameters necessary for direct snapshots. The screen co-ordinates used for direct snapshot will be the 
sl@0: 	same as used for the parent direct viewfinder screen co-ordinates. This screen co-ordinate for direct snapshot may be 
sl@0: 	changed by the implementation in certain cases for alignment.
sl@0: 	*/
sl@0: 	class TDirectSnapshotParameters
sl@0: 		{
sl@0: 	public:
sl@0: 		IMPORT_C TDirectSnapshotParameters();
sl@0: 		
sl@0: 		IMPORT_C TUint Size() const;
sl@0: 		IMPORT_C TUint Version() const;
sl@0: 		
sl@0: 		IMPORT_C TBool IsAspectRatioMaintained() const;
sl@0: 		IMPORT_C void SetAspectRatioState(TBool aIsAspectRatioMaintained);
sl@0: 				
sl@0: 	private:
sl@0: 		//for future expansion
sl@0: 		TUint iSize:24;
sl@0: 		TUint iVersion:8;
sl@0: 		
sl@0: 		// reserved for future expansion
sl@0: 		TInt iReserved1;
sl@0: 		TInt iReserved2;
sl@0: 		TInt iReserved3;
sl@0: 		
sl@0: 		TUint iReserved4:31;
sl@0: 		
sl@0: 		/** Set to ETrue if the aspect ratio of the direct snapshot image must be maintained when scaling down */
sl@0: 		TUint iIsAspectRatioMaintained:1;
sl@0: 		
sl@0: 	public:
sl@0: 	    /** The bit field representing the drive modes for which the direct snapshot will be displayed if enabled. 
sl@0: 	    Refer CCamera::CCameraAdvancedSettings::TDriveMode. */
sl@0: 		TUint iDriveModes; 
sl@0: 		
sl@0: 		/** The background colour to be used if the snapshot has been scaled (maintaining its aspect ratio)
sl@0:   		and does not fully fill the dimension as per the direct view finder screen size. The TRect supposed to be used 
sl@0:   		for direct snapshot may be modified by the implementation in certain cases for alignment. */
sl@0: 		TRgb iBgColor; 
sl@0: 		
sl@0: 		/** The time duration during which the snapshot data should appear on the screen. The implementation may 
sl@0: 		internally change this display time if the client sets iDisplayTime to TTimeIntervalMicroSeconds32 
sl@0: 		(KECamSnapshotDefaultDisplayTime). This may happen when the client doesn't want to specify a specific duration 
sl@0: 		and would rather let the implementation decide. */
sl@0: 		TTimeIntervalMicroSeconds32 iDisplayTime;
sl@0: 		};
sl@0: 		
sl@0: public:
sl@0: 	
sl@0: 	IMPORT_C void GetDirectViewFinderL(CCamera::CCameraV2DirectViewFinder*& aDirectViewFinder) const;
sl@0: 	
sl@0: 	IMPORT_C void EnableDirectSnapshotL(TDirectSnapshotParameters& aDirectSnapshotParameters);
sl@0: 	
sl@0: 	IMPORT_C void DisableDirectSnapshot();
sl@0: 	
sl@0: 	IMPORT_C void GetDirectSnapshotStateL(TDirectSnapshotState& aDirectSnapshotParameters) const;
sl@0: 	
sl@0: 	IMPORT_C void GetDirectSnapshotParametersL(TDirectSnapshotParameters& aDirectSnapshotParameters) const;
sl@0: 	
sl@0: 	IMPORT_C void SetDirectSnapshotParametersL(const TDirectSnapshotParameters& aDirectSnapshotParameters);
sl@0: 	
sl@0: 	IMPORT_C ~CCameraDirectSnapshot();
sl@0: 	
sl@0: private:
sl@0: 	IMPORT_C static CCameraDirectSnapshot* CreateL(CCamera::CCameraV2DirectViewFinder& aDirectViewFinder);
sl@0: 	
sl@0: 	CCameraDirectSnapshot();
sl@0: 	void ConstructL(CCamera::CCameraV2DirectViewFinder& aDirectViewFinder);
sl@0: 	
sl@0: 	MCameraV2DirectViewFinder* DirectViewFinderImpl(CCamera::CCameraV2DirectViewFinder& aDirectViewFinder);
sl@0: 	
sl@0: private:
sl@0: 	MCameraDirectSnapshot*  iImpl;   // not owned
sl@0: 	}; 
sl@0: 	 
sl@0: #endif // ECAMVIEWFINDER_H