videditor/VideoEditorCommon/inc/VeiImageConverter.h
changeset 9 d87d32eab1a9
parent 0 951a5db380a0
equal deleted inserted replaced
0:951a5db380a0 9:d87d32eab1a9
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description:
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #ifndef IMAGECONVERTER_H
       
    22 #define IMAGECONVERTER_H
       
    23 
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <f32file.h>
       
    27 #include <ImageConversion.h>
       
    28 
       
    29 class CFbsBitmap;
       
    30 class CBitmapRotator;
       
    31 class CBitmapScaler;
       
    32 
       
    33 /**
       
    34  * Observer for notifying that image conversion is ready.
       
    35  * 
       
    36  */
       
    37 class MConverterController
       
    38 	{
       
    39 	public:
       
    40 		/**
       
    41 		* Called to notify that image conversion is completed
       
    42 		* 
       
    43 		*/
       
    44 		virtual void NotifyCompletion( TInt aErr ) = 0;
       
    45 		
       
    46 	};
       
    47 /**
       
    48 * Utility class for image conversion.
       
    49 */
       
    50 NONSHARABLE_CLASS( CVeiImageConverter ) : public CActive
       
    51 	{
       
    52 	// states for this object
       
    53 	enum TState 
       
    54 		{
       
    55 		EIdle = 0,
       
    56 		EEncoding,
       
    57 		EScaling
       
    58 		};
       
    59 
       
    60 	public: // contructors/destructors
       
    61 
       
    62 		/**
       
    63 		* NewL 
       
    64 		* Create a CVeiImageConverter object and return a pointer to it.
       
    65 		*
       
    66 		* @param aController Pointer to a MConverterController interface.
       
    67 		* The engine uses NotifyCompletion callback from this interface
       
    68 		* to notify the controller about completions of coding or 
       
    69 		* encoding requests.
       
    70 		*		 
       
    71 		* @return a pointer to the created engine
       
    72 		*/	
       
    73 		IMPORT_C static CVeiImageConverter* NewL( MConverterController* aController );
       
    74 	
       
    75 		IMPORT_C ~CVeiImageConverter();
       
    76 
       
    77 	public: // interface methods
       
    78 
       
    79 		IMPORT_C CFbsBitmap* GetBitmap();
       
    80 		IMPORT_C void SetBitmap(CFbsBitmap* aBitmap);
       
    81 
       
    82 		/** StartToEncodeL 
       
    83 		* Starts to encode an image to a file. When completed calls 
       
    84 		* NotifyCompletion, from iController.
       
    85 		*
       
    86 		* @param aFileName Full path and filename to the image to be encoded.
       
    87 		*		 
       
    88 		* @returns Nothing
       
    89 		*/
       
    90 		IMPORT_C void StartToEncodeL( const TDesC& aFileName, 
       
    91 			const TUid& aImageType, const TUid& aImageSubType );
       
    92 		
       
    93 		/**
       
    94 		* GetEncoderImageTypesL
       
    95 		* Gets descriptions of supported (encoding) image types. 
       
    96 		*
       
    97 		* @param aImageTypeArray Reference to an array to be filled.
       
    98 		*
       
    99 		* @return Nothing 
       
   100 		*/
       
   101 		IMPORT_C static void GetEncoderImageTypesL( 
       
   102 			RImageTypeDescriptionArray& aImageTypeArray );
       
   103 
       
   104 		IMPORT_C void CancelEncoding();
       
   105 		
       
   106 		IMPORT_C void ScaleL(CFbsBitmap* aSrcBitmap,CFbsBitmap* aDestBitmap, const TSize& aSize);
       
   107 	
       
   108 
       
   109 	protected: // implementation of CActive
       
   110 		void DoCancel();
       
   111 		void RunL();
       
   112 		TInt RunError(TInt aError);
       
   113 
       
   114 	private: // internal methods
       
   115 		CVeiImageConverter( MConverterController* aController ); 
       
   116 		void ConstructL();
       
   117 
       
   118 	public: // data	
       
   119 
       
   120 		/** Decoded image. */
       
   121 		CFbsBitmap* iBitmap;
       
   122 
       
   123 	private: // internal data
       
   124 
       
   125 		/** ui controller. */
       
   126 		MConverterController* iController; 
       
   127 		
       
   128 		/** for opening/saving images from/to files. */
       
   129 		RFs iFs; 
       
   130 		
       
   131 		/** decoder from ICL API. */
       
   132 		//CImageDecoder* iImageDecoder; // 
       
   133 
       
   134 		/** encoder from ICL API. */
       
   135 		CImageEncoder* iImageEncoder; 
       
   136 		CBitmapScaler* iBitmapScaler;
       
   137 	
       
   138 		TState iState;
       
   139 	};
       
   140 
       
   141 #endif