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

📄 imageconverterengine.h

📁 Symbian OS 图片转换程序源代码 可以学习一下
💻 H
字号:
/*
* ============================================================================
*  Name     : CImageConverterEngine from ImageConverterEngine.h
*  Part of  : ImageConverter
*  Created  : 25.11.2003 by Forum Nokia
*  Implementation notes:
*     Handles all ICL interaction. Implemented as a separate class/engine
*     for the sake of clarity of the example.
*  Version  :
*  Copyright: Nokia Corporation
* ============================================================================
*/

#ifndef __IMAGECONVERTER_H__
#define __IMAGECONVERTER_H__

#include <e32std.h>
#include <e32base.h>
#include <f32file.h>
#include <ImageConversion.h>

class CFbsBitmap;
class CBitmapRotator;
class CBitmapScaler;

class MConverterController
	{
	public:
		virtual void NotifyCompletion( TInt aErr ) = 0;
	};

class CImageConverterEngine : public CActive
	{
	// states for this engine
	enum TState 
		{
		EIdle = 0,
		EDecoding,
		EEncoding,
		ERotating,
		EScaling
		};

	public:
		// rotation directions
	enum TDirection 
		{
		EClockwise90 = 0,
		EAntiClockwise90 
		};

	public: // contructors/destructors

		/*
		* NewL
		*  
		* Create a CImageConverterEngine object and return a pointer to it.
		*
		* Params: 
		*		aController Pointer to a MConverterController interface.
		*      The engine uses NotifyCompletion callback from this interface
		*      to notify the controller about completions of coding or 
		*      encoding requests.
		*		 
		* Returns:
		* 		A pointer to the created engine
		*
		*/	
		static CImageConverterEngine* NewL( MConverterController* aController );
	
		~CImageConverterEngine();

	public: // interface methods
		/*
		* StartToDecodeL
		*  
		* Starts to decode an image from a file. When completed calls 
		* NotifyCompletion, from iController.
		*
		* Params: 
		*		aFileName Full path and filename of the image to be decoded.
		*		 
		* Returns:
		* 		Nothing
		*/
		void StartToDecodeL( TFileName& aFileName );
		/*
		* StartToEncodeL
		*  
		* Starts to encode an image to a file. When completed calls 
		* NotifyCompletion, from iController.
		*
		* Params: 
		*		aFileName Full path and filename to the image to be encoded.
		*		 
		* Returns:
		* 		Nothing
		*/
		void StartToEncodeL( TFileName& aFileName, 
			TUid aImageType, TUid aImageSubType );
		/*
		* GetImageInfoL
		*  
		* Gets frame 0 info strings. An image has to be decoded before 
		* call to this method, otherwise will return NULL.
		* 
		* Params: 
		*		None
		*		 
		* Returns:
		* 		CFrameInfoStrings* See Symbian OS v7.0s documentation for 
		*		reference.
		*/
		CFrameInfoStrings* GetImageInfoL();
		/*
		* GetEncoderImageTypesL
		*  
		* Gets descriptions of supported (encoding) image types. 
		*
		* Params: 
		*		aImageTypeArray Reference to an array to be filled.
		*		See Symbian OS v7.0s documentation for reference.
		*
		* Returns:
		* 		Nothing 
		*/
		static void GetEncoderImageTypesL( 
			RImageTypeDescriptionArray& aImageTypeArray );

		void RotateL( TDirection aDirection );
		void ScaleL( TInt aPercent );
	

	protected: // implementation of CActive
		void DoCancel();
		void RunL();

	private: // internal methods
		CImageConverterEngine( MConverterController* aController ); 
		void ConstructL();	      //  

	public: // data	
		/*
		* Direct access to the decoded image,
		* images are also encoded from this bitmap.
		*/
		CFbsBitmap* iBitmap; // decoded image

	private: // internal data
		MConverterController* iController; // ui controller
		
		RFs iFs; // for opening/saving images from/to files
		
		CImageDecoder* iImageDecoder; // decoder from ICL API
		CImageEncoder* iImageEncoder; // encoder from ICL API
		
		CBitmapRotator* iRotator;
		CBitmapScaler* iScaler;
	
		TState iState;
	};

#endif // #ifndef __IMAGECONVERTER_H__

⌨️ 快捷键说明

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