?? cameracaptureengine.h
字號:
/*
* ============================================================================
* Name : CameraCapureEngine.h
* Part of : CameraApp
* Description: Provides all still image releated methods.
* Interface to Symbian Onboard Camera API.
* Created : 05/06/2006 by Forum Nokia
* Version : 2.0
* Copyright: Nokia Corporation, 2006
* ============================================================================
*/
#ifndef __CAMERA_CAPTURE_ENGINE_H__
#define __CAMERA_CAPTURE_ENGINE_H__
#include <f32file.h>
#include <e32std.h>
#include <gdi.h>
#include <ECam.h>
#include <ccamautofocus.h>
#include "CameraApp.hrh"
#include "CameraAppController.h"
//Color sampling used with the JPEG encoder
const TJpegImageData::TColorSampling KCameraColorSampling =
TJpegImageData::EColor420;
class CWsBitmap;
/**
* Provides all still image releated methods.
*/
class CCameraCaptureEngine : public CActive,
public MCameraObserver,
public MCamAutoFocusObserver
{
public: // Constructors and destructor
/**
* Two-phased constructor.
* @return CCameraCapureEngine*
*/
static CCameraCaptureEngine* NewL( CCameraAppController& aController,
const TRect& aRect );
/**
* Destructor
*/
virtual ~CCameraCaptureEngine();
private:
/**
* Symbian OS default constructor.
*/
CCameraCaptureEngine( CCameraAppController& aController );
/**
* Symbian OS constructor.
*/
void ConstructL(const TRect& aRect);
public: // New Functions
/**
* Check whether the camera is being used by another app.
* @return, true if it used by another app.
*/
TBool IsCameraUsedByAnotherApp();
/**
* Check whether viewfinder is currently active
* @return TBool
*/
TBool IsViewFinderActive();
/**
* Check for AF support
* @return TBool
*/
TBool IsAutoFocusSupported();
/**
* Set the engine state
*/
void SetEngineState( TEngineState aState );
/**
* Get the engine state
* @return EEngineState
*/
TEngineState GetEngineState();
/**
* Returns whether the imageconversion is in progress or not
*/
TBool IsImageConversionInProgress();
/**
* Starts view finding
* @return void
*/
void StartViewFinderL();
/**
* Stops view finding
* @return void
*/
void StopViewFinder();
/**
* Provides save and post-exposure images
* @return void
*/
void SnapL();
/**
* Sets zoom on/off
* @param aEnable
* @return TInt, Offset for the zoom indicator bitmap
*/
TInt SetZoomFactorL( TBool aEnable );
/**
* Sets the autofocus range.
* Does nothing if AF is not supported
* @param aRange, The new focus range
* @return void
*/
void SetFocusRangeL( CCamAutoFocus::TAutoFocusRange aRange
= CCamAutoFocus::ERangeNormal );
/**
* Gets the current autofocus range.
* @param aRange, on return, contains the focus range
* @return void
*/
void FocusRange( CCamAutoFocus::TAutoFocusRange& aRange );
/**
* Starts the optimised autofocus operation.
* Does nothing if AF is not supported
* @return void
*/
void StartFocusL();
/**
* Cancels an ongoing autofocus operation
* @return void
*/
void FocusCancel();
/**
* Converts and saves bitmap to JPEG image
* @param aQuality
* @param aNewFilePathAndName
* @param aFs
* @return void
*/
void SaveImageL(TJpegQualityFactor aQuality, const TFileName*
aNewFilePathAndName, RFs* aFs);
/**
* Destructs JPEG encoder
* @return void
*/
void DeleteEncoder();
/**
* Returns default display mode
* @return TDisplayMode
*/
TDisplayMode DisplayMode() const;
/**
* Sets Exposure time according to Camera mode
* @param Camera State
* @return void
*/
void SetMode( TCameraState aMode );
/**
* Reserves camera
* @return void
*/
void ReserveCameraL();
/**
* Releases camera
* @return void
*/
void ReleaseCamera();
/**
* Switches off camera power
* @return void
*/
void PowerOff();
/**
* Displays error message
* @param An error
* @return void
*/
void HandleError( TInt aError );
/**
* Notify the engine if the client rect size changes
* @param The new client rect
*/
void ClientRectChangedL(const TRect& aRect);
private:
/**
* Calculates portrait image size from bigger snapped image
* keeping the aspect ratio unchanged
* @return The portrait image size
*/
TRect Portrait( const CFbsBitmap* aBitmap);
/**
* Returns camera image format to be used with current display mode
* @return CCamera::TFormat
*/
CCamera::TFormat ImageFormat() const;
/**
* Returns highest color mode supported by HW
* @return CCamera::TFormat
*/
CCamera::TFormat ImageFormatMax() const;
/**
* Clips the viewfinding images according to portrait mode size.
* @param A bitmap to be clipped
* @return void
*/
void ClipL(const CFbsBitmap& aFrame);
/**
* Draws captured image on the screen, modifies if needed
* @return void
*/
void DrawL();
/**
* Starts view finding and prepares image capturing
* @return void
*/
void DoViewFinderL();
/**
* Returns the index for the requested image size (if supported)
* @return TInt index of the requested image size
*/
TInt GetImageSizeIndexL(const TSize& aRequestedSize,
const CCamera::TFormat& aFormat);
/**
* From MCameraObserver, "CCamera::Reserve()" is completed
*/
virtual void ReserveComplete(TInt aError);
/**
* From MCameraObserver, "CCamera::PowerOn()" is completed
*/
virtual void PowerOnComplete(TInt aError);
/**
* From MCameraObserver, "CCamera::StartViewFinderBitmapsL()"
* is completed
*/
virtual void ViewFinderFrameReady(CFbsBitmap& aFrame);
/**
* From MCameraObserver, "CCamera::CaptureImage()" is completed
*/
virtual void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);
/**
* From MCameraObserver, CCamera::StartVideoCapture() is completed
*/
virtual void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);
/**
* From MCamAutoFocusObserver, called on completion of CCamAutoFocus::InitL
*/
virtual void InitComplete( TInt aError );
/**
* From MCamAutoFocusObserver, called on completion of AttemptOptimisedFocusL
*/
virtual void OptimisedFocusComplete( TInt aError );
/**
* Changes the engine state and completes an async request immediately
*/
void AsyncStateChange(const TEngineState& aNextState);
private: // Functions from base CActive classes
/**
* From CActive cancels the Active object, empty
* @return void
*/
void DoCancel() ;
/**
* From CActive, called when an asynchronous request has completed
* @return void
*/
void RunL() ;
private: //data
CEikonEnv* iEikEnv; // Not owned
CCamera* iCamera;
TDisplayMode iDisplayMode;
CCamera::TFormat iColorDepth;
CCamera::TFormat iColorDepthHW;
CCameraAppController& iController;
TCameraInfo iInfo;
TInt iZoomFactor;
TBool iCapturePrepared;
CWsBitmap* iBitmapPortraitVF;
CFbsBitmap* iBitmapSave;
HBufC8* iImageExif;
RFile iFile;
CImageEncoder* iEncoder;
TBool iStart;
TBool iCameraReserved;
TBool iCameraReserveComplete;
TSize iLandscapeSize;
TSize iPortraitSize;
TSize iCaptureSize;
TCameraState iMode;
TBool iPowering;
TEngineState iState;
CCamAutoFocus* iAutoFocus;
CCamera::TFormat iFormat;
CCamAutoFocus::TAutoFocusRange iRange;
};
#endif // __CAMERA_CAPTURE_ENGINE_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -