mmplugins/cameraplugins/source/webcamera/ecamwebcameravfactive.h
branchRCL_3
changeset 9 9ae0fe04e757
child 64 92a82bc706f7
equal deleted inserted replaced
8:bc06d8566074 9:9ae0fe04e757
       
     1 /*
       
     2 * Copyright (c) 2010 ISB.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * ISB - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ECAMWEBCAMERAVFACTIVE_H
       
    19 #define ECAMWEBCAMERAVFACTIVE_H
       
    20 
       
    21 #include "ecamwebcameraplugin.h"
       
    22 
       
    23 /**
       
    24  *  Perform a viewfinder function.
       
    25  */
       
    26 class CWebCameraVfActive : public CActive
       
    27 						 , public MDirectScreenAccess
       
    28 	{
       
    29 public:
       
    30 	 /**
       
    31      * Two-phased constructor.
       
    32      * @param aOwner pointer to callback object.
       
    33      * @param aDriver reference to driver.
       
    34      */
       
    35 	static CWebCameraVfActive* NewL(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver);
       
    36 
       
    37 	CWebCameraVfActive(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver);
       
    38 
       
    39 	/**> Destructor */
       
    40 	~CWebCameraVfActive();
       
    41 
       
    42 	/** 
       
    43 	Starts transfer of view finder data to the given portion of the screen using
       
    44 	direct screen access.
       
    45 
       
    46 	The aScreenRect parameter is in screen co-ordinates and may be modified if,
       
    47 	eg, the camera requires the destination to have a certain byte alignment, etc.
       
    48 
       
    49     @param  aWs 
       
    50 	        Window server session.
       
    51 	@param  aScreenDevice 
       
    52 	        Screen device.
       
    53 	@param  aWindow 
       
    54 	        Displayable window.
       
    55 	@param  aScreenRect 
       
    56 	        Portion of the screen to which view finder data is to be
       
    57 	        transferred. This is in screen co-ordinates and may be modified if, for example,
       
    58 	        the camera requires the destination to have a certain byte alignment.
       
    59 	*/
       
    60 	void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect);
       
    61 
       
    62 	/** 
       
    63 	Stops transfer of view finder data to the screen. 
       
    64 	*/
       
    65 	void StopViewFinder();
       
    66 
       
    67 	/** 
       
    68 	Queries whether the view finder is active.
       
    69 
       
    70 	@return  ETrue if the view finder is active. EFalse if the view finder is not
       
    71 	         active. 
       
    72 	*/
       
    73 	TBool ViewFinderActive();
       
    74 
       
    75 private:
       
    76 	/** 
       
    77 	from MAbortDirectScreenAccess
       
    78 	
       
    79 	This function is called by the window server when direct screen access must stop
       
    80 	(for example because a dialogue is moved in front of the area where direct screen access is taking place).
       
    81 	
       
    82 	@param  aScreenDevice 
       
    83 			The reason why direct screen access was terminated. 
       
    84 	*/
       
    85 	virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);
       
    86 
       
    87 private: 
       
    88 	/** 
       
    89 	from 	from MDirectScreenAccess
       
    90 	
       
    91 	This function is called by the window server as soon as direct screen access can resume.
       
    92 	
       
    93 	@param  aScreenDevice 
       
    94 			Provides the reason why direct screen access was terminated. 
       
    95 	*/
       
    96 	virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason);
       
    97 
       
    98 private:
       
    99 	void ConstructL();
       
   100 	
       
   101 	/** 
       
   102 	Start viewfinder process.
       
   103 	*/
       
   104 	void Start();
       
   105 	
       
   106 	/** 
       
   107 	Draw the image of the view finder on screen.
       
   108 	*/
       
   109 	void UpdateViewL();
       
   110 
       
   111 private:
       
   112 	void RunL();
       
   113 	void DoCancel();
       
   114 
       
   115 private:
       
   116 	MWebCameraVfActiveCallBack*		iOwner;				///< origin of start.
       
   117 	TBool							iViewFinderActive;	///< Status of viewfinder
       
   118 	RWebcameraDevice				iDriver;			///< Camera driver
       
   119 
       
   120 	CFbsBitmap*						iVfBitmap;			///< Bitmap data of viewfinder.
       
   121 	HBufC8*							iVfBuf;				///< Data buffer of viewfinder.
       
   122 	TPtr8							iVfBufPtr;			///< Pointer to data buffer of viewfinder.
       
   123 
       
   124 	CDirectScreenAccess*			iDSA;				///< DirectScreenAccess object.
       
   125 	TRect							iScreenRect;		///< The region to draw.
       
   126 	TRect							iClipRect;			///< The clipping region to draw.
       
   127 
       
   128 	TBool							iTestFlug;			///< for test
       
   129 	};
       
   130 
       
   131 
       
   132 #endif // ECAMWEBCAMERAPLUGIN_H