⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cameracaptureengine.h

📁 Symbian智能手机操作系统源代码值的参考_摄像头
💻 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 "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: // 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();

        /**
         * 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();

        /**
         * Start to save image
         */
        void StartToSaveImage();

        /**
         * 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 );

        /**
         * 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(); 

        /**
         * 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);

    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 by this class
        CCamera* iCamera;
        TDisplayMode iDisplayMode;
        CCamera::TFormat iColorDepth;
        CCamera::TFormat iColorDepthHW;
        CCameraAppController& iController;
        TCameraInfo iInfo;
        TInt iZoomFactor;
        TBool iCapturePrepared; 
        CWsBitmap* iBitmapPortraitVF; 
        CFbsBitmap* iBitmapSave;
        CImageEncoder* iEncoder;
        TBool iStart;
        TBool iCameraReserved;
        TBool iCameraReserveComplete;
        TSize iLandscapeSize;
        TSize iPortraitSize;
        TCameraState iMode;
        TBool iPowering;
        TEngineState iState;
    };

#endif // __CAMERA_CAPTURE_ENGINE_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -