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

📄 imagecapturerengine.h

📁 《基于Symbian OS的手机开发与应用实践》这本书的配套源码。
💻 H
字号:
/*
* ============================================================================
*  Name     : CImageCapturerDocument from ImageCapturerEngine.h
*  Part of  : ImageCapturer
*  Created  : 02.02.2006 by ToBeReplacedByAuthor
*  Description:
*     Declares engine for application.
*  Version  :
*  Copyright: ToBeReplacedByCopyright
* ============================================================================
*/

#ifndef IMAGECAPTURERENGINE_H
#define IMAGECAPTURERENGINE_H

// INCLUDES
#include <ecam.h>

// FORWARD DECLARATIONS

// CLASS DECLARATION
/**
*  CImageCapturerEngine application class.
*/
class CImageCapturerEngine : public CBase, public MCameraObserver
    {
    public: // Observer interface
        class MObserver
            {
            public:
                virtual void OnFrame(const CFbsBitmap& aFrame)=0;
                virtual void OnImage(CFbsBitmap* aBitmap)=0;
                virtual void OnError(TInt aError)=0;
            };

    public: // Static constants
        static const TInt KDefaultImageWidth;
        static const TInt KDefaultImageHeight;
        static const CCamera::TFormat KDefaultImageFormat;
        static const TInt KDefaultImageIndex;

    public: // Constructors and destructor
        /**
        * Two-phased constructor.
        */
        static CImageCapturerEngine* NewL(MObserver& aObserver);

        /**
        * Destructor.
        */
        ~CImageCapturerEngine();

    private:
        /**
        * EPOC default constructor.
        */
        CImageCapturerEngine(MObserver& aObserver);
        void ConstructL();

    public: // Functions from MCameraObserver
       /**
        * Indicates camera reservation is complete.
        * Called asynchronously when CCamera::Reserve() completes. 
        * @param aError: An error on failure and KErrNone on success
        */
        void ReserveComplete(TInt aError);

       /**
        * Indicates camera power on is complete.
        * Called on completion of CCamera:PowerOn().
        * @param aError: An error on failure and KErrNone on success
        */
        void PowerOnComplete(TInt aError);

       /**
        * Called periodically in response to the use of 
        * CCamera::StartViewFinderBitmapsL().
        * @param aFrame: A view finder frame
        */
        void ViewFinderFrameReady(CFbsBitmap& aFrame);

       /**
        * Called asynchronously when CCamera::CaptureImage() completes. 
        * Transfers the current image from the camera to the client.
        * @param aBitmap: An image held in CFbsBitmap form if this was the 
        *  format specified in CCamera::PrepareImageCaptureL().
        * @param aData: a pointer to an HBufC8 if this was the format 
        *  specified in CCamera::PrepareImageCaptureL().
        * @param aError KErrNone on success or an error code on failure
        */
        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);

       /**
        * Called asynchronously when a buffer has been filled with the 
        * required number of video frames by CCamera::StartVideoCapture(). 
        * Passes a filled frame buffer to the client. 
        * @param aFrameBuffer: A pointer to an MFrameBuffer if successful, or 
        *  NULL if not successful.
        * @param aError: KErrNone on success or an error code on failure
        */
        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);

    public: // new public methods
       /**
        * Start the view finder
        */
        void StartViewFinderL();

       /**
        * Stop the view finder
        */
        void StopViewFinder();

       /**
        * Asynchronously performs still image capture.
        * Calls MCameraObserver::ImageReady() when complete.
        */
        void CaptureImage();

    private: // new private methods
       /**
        * Performs setup and allocation of memory.
        * Called prior to calling CaptureImage() to keep the latency of that 
        * function to a minimum. Needs to be called only once for multiple 
        * CaptureImage() calls.
        * May leave with KErrNotSupported or KErrNoMemory
        * @param aImageFormat: The image format, must be one of the formats 
        *  supported (see TCameraInfo::iImageFormatsSupported)
        */
        void PrepareImageCaptureL(CCamera::TFormat aImageFormat);

    private: // member variables
       /**
        * 
        */
        MObserver& iObserver;

       /**
        * The camera object
        */
        CCamera* iCamera;

       /**
        * The resolution of the captured image.
        */
        TSize iSize;
    };

#endif

// End of File

⌨️ 快捷键说明

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