imaging/imagingfws/inc_pub/ImageConversion.h
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     1 // Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This is the public client API for the Image Conversion Library
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef IMAGECONVERSION_H
       
    19 #define IMAGECONVERSION_H
       
    20 
       
    21 #include <fbs.h>
       
    22 #include <bitdev.h>
       
    23 #include <badesca.h>
       
    24 #include <ecom/implementationinformation.h>
       
    25 #include <mm/mmcaf.h>
       
    26 
       
    27 #include <icl/imagecodecdata.h>
       
    28 #include <icl/imagedata.h>
       
    29 #include <icl/icl_uids.hrh>
       
    30 #include <icl/imageconversionextension.h>
       
    31 
       
    32 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    33 #include <iclrecognizerutil.h>
       
    34 #endif
       
    35 
       
    36 class MImageDecoderRelay;
       
    37 class MImageEncoderRelay;
       
    38 class CImageDecoderPlugin;
       
    39 class CImageEncoderPlugin;
       
    40 class CImageDecodeConstruct;
       
    41 class CImageEncodeConstruct;
       
    42 
       
    43 /**
       
    44 @publishedAll
       
    45 @released
       
    46 
       
    47 Container type to manage lists of UIDs.
       
    48 */
       
    49 typedef RArray<TUid> RUidDataArray;	
       
    50 
       
    51 /**
       
    52 @publishedAll
       
    53 @released
       
    54 
       
    55 Class used to manage the mapping between an image's type, sub-type and description.
       
    56 */
       
    57 class CImageTypeDescription : public CBase
       
    58 	{
       
    59 public:
       
    60 	/**
       
    61 	@internalComponent
       
    62 	*/
       
    63 	static CImageTypeDescription* NewL(const TDesC& aDescription, const TUid aImageType, const TUid aSubType);
       
    64 	/**
       
    65 	@internalComponent
       
    66 	*/
       
    67 	static CImageTypeDescription* NewLC(const TDesC& aDescription, const TUid aImageType, const TUid aSubType);
       
    68 	
       
    69 	IMPORT_C ~CImageTypeDescription();
       
    70 	IMPORT_C const TDesC& Description() const;
       
    71 	IMPORT_C TUid ImageType() const;
       
    72 	IMPORT_C TUid SubType() const;
       
    73 private:
       
    74 	CImageTypeDescription(const TUid aImageType, const TUid aSubType);
       
    75 	void ConstructL(const TDesC& aDescription);
       
    76 private:
       
    77 	HBufC* iDescription;
       
    78 	const TUid iImageType;
       
    79 	const TUid iSubType;
       
    80 	};
       
    81 
       
    82 /**
       
    83 Container type to manage lists of pointers to CImageTypeDescription objects.
       
    84 
       
    85 @publishedAll
       
    86 @released
       
    87 */
       
    88 typedef RPointerArray<CImageTypeDescription> RImageTypeDescriptionArray;
       
    89 
       
    90 /**
       
    91 Class used to manage the mapping between an image's MIME type & file extension.
       
    92 
       
    93 @publishedAll
       
    94 @released
       
    95 */
       
    96 class CFileExtensionMIMEType : public CBase
       
    97 	{
       
    98 public:
       
    99 	/**
       
   100 	@internalComponent
       
   101 	*/
       
   102 	static CFileExtensionMIMEType* NewL(const TDesC8& aExtn, const TDesC8& aMIMEType, const TDesC& aDisplayName, TUid aImageType, TUid aImageSubType, TUid aImplementationUid);
       
   103 	IMPORT_C static CFileExtensionMIMEType* NewLC(const TDesC8& aExtn, const TDesC8& aMIMEType, const TDesC& aDisplayName, TUid aImageType, TUid aImageSubType, TUid aImplementationUid);
       
   104 	IMPORT_C ~CFileExtensionMIMEType();
       
   105 
       
   106 	IMPORT_C const TDesC& FileExtension() const;
       
   107 	IMPORT_C const TDesC8& MIMEType() const;
       
   108 	IMPORT_C const TDesC& DisplayName() const;
       
   109 	IMPORT_C TUid ImageType() const;
       
   110 	IMPORT_C TUid ImageSubType() const;
       
   111 	IMPORT_C TUid ImplementationUid() const;
       
   112 private:
       
   113 	CFileExtensionMIMEType();
       
   114 	void ConstructL(const TDesC8& aExtn, const TDesC8& aMIMEType, const TDesC& aDisplayName, TUid aImageType, TUid aImageSubType, TUid aImplementationUid);
       
   115 private:
       
   116 	HBufC* iFileExtension;
       
   117 	HBufC8* iMIMEType;
       
   118 	HBufC* iDisplayName;
       
   119 	TUid iImageTypeUid;
       
   120 	TUid iImageSubTypeUid;
       
   121 	TUid iImplementationUid;
       
   122 	};
       
   123 
       
   124 /**
       
   125 Container type to manage lists of pointers to CFileExtensionMIMEType objects.
       
   126 
       
   127 @publishedAll
       
   128 @released
       
   129 */
       
   130 typedef RPointerArray<CFileExtensionMIMEType> RFileExtensionMIMETypeArray;
       
   131 
       
   132 /**
       
   133 @publishedAll
       
   134 @released
       
   135 
       
   136 Class used to manage various information about an implementation
       
   137 which is stored in resource files.
       
   138 
       
   139 @see CImplementationInformation
       
   140 */
       
   141 class CImplementationInformationType : public CBase
       
   142 	{
       
   143 public:
       
   144 	/**
       
   145 	@internalComponent
       
   146 	*/
       
   147 	static CImplementationInformationType* NewL();
       
   148 	/**
       
   149 	@internalComponent
       
   150 	*/
       
   151 	static CImplementationInformationType* NewLC();
       
   152 
       
   153 	IMPORT_C ~CImplementationInformationType();
       
   154 	
       
   155 	/**
       
   156 	@internalComponent
       
   157 	*/
       
   158 	void SetDataL(TUid aImplementationUid, TInt aVersion, const TDesC& aDisplayName, const TDesC8& aDataType, const TDesC8& aOpaqueData, TDriveUnit aDrive);
       
   159 
       
   160 	IMPORT_C TUid ImplementationUid() const;
       
   161 	IMPORT_C TInt Version() const;
       
   162 	IMPORT_C const TDesC& DisplayName() const;
       
   163 	IMPORT_C const TDesC8& DataType() const;
       
   164 	IMPORT_C const TDesC8& OpaqueData() const;
       
   165 
       
   166 	IMPORT_C TDriveUnit Drive();
       
   167 
       
   168 private:
       
   169 	CImplementationInformationType();
       
   170 
       
   171 private:
       
   172 	TUid iImplementationUid;
       
   173 	TInt iVersion;
       
   174 	HBufC* iDisplayName;
       
   175 	HBufC8* iDataType;
       
   176 	HBufC8* iOpaqueData;
       
   177 	TDriveUnit iDrive;
       
   178 	};
       
   179 
       
   180 //The public API for clients to call the Image Conversion Library decoders
       
   181 
       
   182 /**
       
   183 @publishedAll
       
   184 @released
       
   185 
       
   186 Provides access to the Image Conversion Library decoders.
       
   187 
       
   188 This class provides functions to decode images held in files or descriptors. To decode buffered
       
   189 images use the buffered version of this class CBufferedImageDecoder.
       
   190 
       
   191 Regarding DRM: Note that intent is evaluated when a CImageDecoder instance is being constructed by one of the FileNewL() methods.
       
   192 It is executed after at least one frame of the image has been successfully decoded.  Subsequent converts using the same CImageDecoder instance will not execute intent.
       
   193 */
       
   194 class CImageDecoder : public CBase
       
   195 	{
       
   196 public:
       
   197 
       
   198 	/**
       
   199 	Flags to control how the image is decoded.
       
   200 	These can be combined using an OR operation.
       
   201 	*/
       
   202 	enum TOptions
       
   203 		{
       
   204 		/** No flag set 
       
   205 		*/
       
   206 		EOptionNone = 0x00,
       
   207 
       
   208 		/** Do not dither the decoded image 
       
   209 		*/
       
   210 		EOptionNoDither	= 0x01,
       
   211 
       
   212 		/** Perform the decoding in a separate thread
       
   213 		*/
       
   214 		EOptionAlwaysThread = 0x02,
       
   215 
       
   216 		/**
       
   217 		Allow Opens to complete with no error if there is less
       
   218 		than one frame available. This should be set for streaming.
       
   219 		*/
       
   220 		EOptionAllowZeroFrameOpen = 0x04,
       
   221 
       
   222 		/**
       
   223 		Setting this flag requests that the plugin generate a mask during decoding.
       
   224 
       
   225 		Note:
       
   226 		
       
   227 		This option is only relevant to image formats
       
   228 		that do not already contain mask information.
       
   229 
       
   230 		The client must check that TFrameInfo::ETransparencyPossible is set
       
   231 		before attempting to obtain the mask, because not all plugins support mask generation.
       
   232 		*/
       
   233 		EAllowGeneratedMask = 0x08,
       
   234 		
       
   235 		/**
       
   236 		Use the highest possible image decoding speed; this may result in lower image quality. 
       
   237 		This flag is more applicable to formats which use "lossy" compression algorithms, such as JPEG. 
       
   238 		Decoders that do not support fast decoding will ignore it.
       
   239 		*/
       
   240 		EPreferFastDecode = 0x10,
       
   241 		
       
   242 		/**
       
   243 		@publishedPartner
       
   244 		@released
       
   245 		
       
   246 		Prevent MNG ImageDecoder from unwinding all the loops
       
   247 		*/
       
   248 		EOptionMngSubframesNoLoops = 0x20,
       
   249 		
       
   250 		/**
       
   251 		@publishedPartner
       
   252 		@released
       
   253 		
       
   254 		Setting this flag requests that the plugin use the frame size rather than the
       
   255 		overall size when calculating its reduction factor
       
   256 		*/
       
   257 		EOptionUseFrameSizeInPixels = 0x40,
       
   258 		
       
   259 		/**
       
   260 		When specified, this flag indicates that the decoder must ignore the EXIF meta-data, if present. 
       
   261 		In this case, the ExifMetaData() should return NULL.
       
   262 		This option value is also used to indicate the requirement to ignore the EXIF meta-data when doing the 
       
   263 		image transformation.
       
   264 		*/
       
   265 		EOptionIgnoreExifMetaData = 0x80,
       
   266 
       
   267 		/**
       
   268 		@publishedAll
       
   269 		@released
       
   270 				
       
   271 		Codec must support crop.
       
   272 		 */
       
   273 		EOptionExtCrop = 0x0100,
       
   274 		
       
   275 		/**
       
   276 		@publishedAll
       
   277 		@released
       
   278 			
       
   279 		Codec must support block streaming extension.
       
   280 		 */
       
   281 		EOptionExtStream = 0x0200,
       
   282 		
       
   283 		/**
       
   284 		@publishedAll
       
   285 		@released
       
   286 			
       
   287 		Codec must support rotation through the operation extension.
       
   288 		 */
       
   289 		EOptionExtRotation = 0x0400,
       
   290 
       
   291 		/**
       
   292 		@publishedAll
       
   293 		@released
       
   294 				
       
   295 		Codec must support horizontal mirror through the operation extension.
       
   296 		 */
       
   297 		EOptionExtMirrorHorizontalAxis = 0x0800,
       
   298 
       
   299 		/**
       
   300 		@publishedAll
       
   301 		@released
       
   302 				
       
   303 		Codec must support vertical mirror through the operation extension.
       
   304 		 */
       
   305 		EOptionExtMirrorVerticalAxis = 0x1000,
       
   306 
       
   307 		/**
       
   308 		@publishedAll
       
   309 		@released
       
   310 				
       
   311 		Codec must support the scaling extension.
       
   312 		 */
       
   313 		EOptionExtScaling = 0x2000,
       
   314 		
       
   315 		/** Reserved.
       
   316 		 */
       
   317 		EOptionExtReserved7 = 0x4000,
       
   318 
       
   319 		/** Reserved.
       
   320 		 */
       
   321 		EOptionExtReserved8 = 0x8000,
       
   322 		/**
       
   323 		@internalTechnology
       
   324 		Requests that decode always fails for Png images without an iEND chunk.
       
   325 		*/
       
   326 		EOptionPngMissingiENDFail = 0x010000,
       
   327 		
       
   328 		/**
       
   329 		@publishedAll
       
   330 		@released
       
   331 		
       
   332 		Allows WMF codec to ignore any SETVIEWPORTORG, SETVIEWPORTEXT, SCALEVIEWPORTEXT 
       
   333 		or OFFSETVIEWPORTORG commands in the metafile and allows scaling to destination bitmap.
       
   334 		*/
       
   335 		EOptionWmfIgnoreViewportMetaData = 0x020000,
       
   336 
       
   337 		/**
       
   338 		@publishedPartner
       
   339 		@prototype
       
   340 		
       
   341 		Requests that codec applies the auto rotation when decoding according to the orientation tag in the image Exif header.
       
   342 		*/
       
   343 		EOptionAutoRotate = 0x040000,
       
   344 
       
   345 		/**
       
   346 		@publishedPartner
       
   347 		@prototype
       
   348 		
       
   349 		Requests the Codec to do optimised partial image decoding, whenever partial decoding is needed.
       
   350 		*/
       
   351 		EOptionOptimisedPartialImageDecoding = 0x80000
       
   352 		};
       
   353 
       
   354 	/**
       
   355 	Flags to control which image is decoded.
       
   356 	This can be used when the source file or descriptor 
       
   357 	contains multiple distinct image sources.
       
   358 	*/	
       
   359 	enum TImageType
       
   360 		{
       
   361 		/** Use the thumbnail as source image
       
   362 		*/
       
   363 		EImageTypeThumbnail = 0x01,
       
   364 		/** Use the main image
       
   365 		*/
       
   366 		EImageTypeMain = 0x02
       
   367 		};
       
   368 		
       
   369 public:
       
   370 	IMPORT_C static void GetImageTypesL(RImageTypeDescriptionArray& aImageTypeArray);
       
   371 	IMPORT_C static void GetImageSubTypesL(const TUid aImageType, RImageTypeDescriptionArray& aSubTypeArray);
       
   372 	IMPORT_C static void GetFileTypesL(RFileExtensionMIMETypeArray& aFileExtensionArray);
       
   373 	IMPORT_C static void GetMimeTypeFileL(RFs& aFs, const TDesC& aFileName, TDes8& aMimeType);
       
   374 	IMPORT_C static void GetMimeTypeDataL(const TDesC8& aImageData, TDes8& aMimeType);
       
   375 
       
   376 	IMPORT_C static CImplementationInformationType* GetImplementationInformationL(TUid aImplementationUid);
       
   377 
       
   378 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TDesC& aSourceFilename, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   379 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TDesC& aSourceFilename, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   380 
       
   381 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TDesC& aSourceFilename, const TDesC8& aMIMEType, ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
       
   382 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TDesC& aSourceFilename, ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   383 	IMPORT_C static CImageDecoder* FileNewL(RFile& aFile, const TDesC8& aMIMEType, ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
       
   384 	IMPORT_C static CImageDecoder* FileNewL(RFile& aFile, ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   385 
       
   386 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TMMSource& aFileSource, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   387 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TMMSource& aFileSource, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   388 	
       
   389 	IMPORT_C static CImageDecoder* DataNewL(RFs& aFs, const TDesC8& aSourceData, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   390 	IMPORT_C static CImageDecoder* DataNewL(RFs& aFs, const TDesC8& aSourceData, const TOptions aOptions = EOptionNone, const TUid aImageType  = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   391 	IMPORT_C virtual ~CImageDecoder();
       
   392 
       
   393 	IMPORT_C virtual void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber = 0);
       
   394 	IMPORT_C virtual void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber = 0);
       
   395 	IMPORT_C virtual void ContinueConvert(TRequestStatus* aRequestStatus);
       
   396 	IMPORT_C void Cancel();
       
   397 
       
   398 	IMPORT_C TInt FrameCount() const;
       
   399 	IMPORT_C TBool IsImageHeaderProcessingComplete() const;
       
   400 	IMPORT_C void ContinueProcessingHeaderL();
       
   401 
       
   402 	IMPORT_C const TFrameInfo& FrameInfo(TInt aFrameNumber = 0) const;
       
   403 	IMPORT_C const CFrameImageData& FrameData(TInt aFrameNumber = 0) const;
       
   404 
       
   405 	IMPORT_C TInt NumberOfImageComments() const;
       
   406 	IMPORT_C HBufC* ImageCommentL(TInt aCommentNumber) const;
       
   407 	IMPORT_C TInt NumberOfFrameComments(TInt aFrameNumber) const;
       
   408 	IMPORT_C HBufC* FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const;
       
   409 
       
   410 	IMPORT_C CFrameInfoStrings* FrameInfoStringsLC(TInt aFrameNumber = 0);
       
   411 	IMPORT_C CFrameInfoStrings* FrameInfoStringsL(TInt aFrameNumber = 0);
       
   412 	IMPORT_C TUid ImplementationUid() const;
       
   413 
       
   414 	IMPORT_C void ImageType(TInt aFrameNumber, TUid& aImageType, TUid& aImageSubType) const;
       
   415 
       
   416 	IMPORT_C TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue);
       
   417 	IMPORT_C void SetImageTypeL(TInt aImageType);
       
   418 	
       
   419 	IMPORT_C TInt ReductionFactor(const TSize& aOriginalSize, const TSize& aReducedSize) const;
       
   420 	IMPORT_C TInt ReducedSize(const TSize& aOriginalSize,  TInt aReductionFactor, TSize& aReducedSize) const;
       
   421 	IMPORT_C TInt SetDecoderThreadPriority(TThreadPriority aPriority);
       
   422 
       
   423 	IMPORT_C static void GetPluginPropertiesL(const TUid aImplementationUid, RUidDataArray& aPropertiesArray);
       
   424 	IMPORT_C static void GetInterfaceImplementationsL(const RUidDataArray& aRequiredUids, RUidDataArray& aImplArray);
       
   425 	IMPORT_C static void GetInterfaceImplementationsL(const TUid* aRequiredUids, const TInt aLength, RUidDataArray& aImplArray);
       
   426 
       
   427 	IMPORT_C TImageConvOperation* OperationL();
       
   428 	IMPORT_C TImageConvScaler* ScalerL();
       
   429 	IMPORT_C TImageConvStreamedDecode* BlockStreamerL();
       
   430 
       
   431 	IMPORT_C void SetClippingRectL(const TRect* aClipRect);
       
   432 	IMPORT_C TInt GetDestinationSize(TSize& aSize, TInt aFrameNumber = 0);
       
   433 	
       
   434 	IMPORT_C void Prepare(TRequestStatus* aRequestStatus);
       
   435 
       
   436 protected:
       
   437 	IMPORT_C CImageDecoder();
       
   438 
       
   439 	// custom commands - for extended decoders
       
   440 	IMPORT_C void CustomSyncL(TInt aParam);
       
   441 	IMPORT_C void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam);
       
   442 	IMPORT_C CImageDecoderPlugin* Plugin() const;
       
   443 
       
   444 private:
       
   445 	static void MimeTypeGetDecoderListL(RImplInfoPtrArray& aDecoderList, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   446 	static void ImageTypeGetDecoderListL(RImplInfoPtrArray& aDecoderList, const TDesC8& aImageHeader, const TUid aImageType, const TUid aImageSubType, const TUid aDecoderUid, const TOptions aOptions = EOptionNone);
       
   447 	static void SuffixTypeGetDecoderListL(RImplInfoPtrArray& aDecoderList, const TDesC& aFileName, const TOptions aOptions = EOptionNone);
       
   448 
       
   449 	static CImageDecoder* FileFindDecoderNewL(const RImplInfoPtrArray& aDecoderList, RFs& aFs, const TDesC& aSourceFilename, const TOptions aOptions, const TDesC& aUniqueId);
       
   450 	static CImageDecoder* FileDecoderNewL(const CImplementationInformation& aDecoderInfo, RFs& aFs, const TDesC& aSourceFilename, const TOptions aOptions, const TDesC& aUniqueId);
       
   451 	
       
   452 	static CImageDecoder* DataFindDecoderNewL(const RImplInfoPtrArray& aDecoderList, RFs& aFs, const TDesC8& aSourceData, const TOptions aOptions);
       
   453 	static CImageDecoder* DataDecoderNewL(const CImplementationInformation& aDecoderInfo, RFs& aFs, const TDesC8& aSourceData, const TOptions aOptions);
       
   454 
       
   455 	static CImageDecodeConstruct* NewDecodeConstructL(const CImplementationInformation& aDecoderInfo, const TOptions aOptions = EOptionNone);
       
   456 
       
   457 	static void DoGetMimeTypeL(const TDesC& aFileName, const TDesC8& aMatchString, TDes8& aMimeType);
       
   458 
       
   459 	static CImageDecoder* NewL(CImageDecodeConstruct* aConstruct, TOptions aOptions);
       
   460 	static CImageDecoder* NewL();
       
   461 
       
   462 	static CImageDecoder* FileNewImplL(RFs& aFs, const TDesC& aSourceFilename, const TDesC8& aMIMEType, const TDesC& aUniqueId, const ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
       
   463 	static CImageDecoder* FileNewImplL(RFs& aFs, const TDesC& aSourceFilename, const TDesC& aUniqueId, const ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   464 	static CImageDecoder* FileFindDecoderNewL(const RImplInfoPtrArray& aDecoderList, RFile& aFile, const TOptions aOptions, const TDesC& aUniqueId);
       
   465 	static CImageDecoder* FileDecoderNewL(const CImplementationInformation& aDecoderInfo, RFile& aFile, const TOptions aOptions, const TDesC& aUniqueId);
       
   466 	static CImageDecoder* FileNewImplL(RFile& aFile, const TDesC8& aMIMEType, const TDesC& aUniqueId, const ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
       
   467 	static CImageDecoder* FileNewImplL(RFile& aFile, const TDesC& aUniqueId, const ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   468     static ContentAccess::CContent* GetContentLC(const TDesC& aSourceFilename);
       
   469 
       
   470 	inline TBool ValidProperties() const;
       
   471 
       
   472 	// Future proofing
       
   473 	IMPORT_C virtual void ReservedVirtual1();
       
   474 	IMPORT_C virtual void ReservedVirtual2();
       
   475 	IMPORT_C virtual void ReservedVirtual3();
       
   476 	IMPORT_C virtual void ReservedVirtual4();
       
   477 
       
   478 private:
       
   479 	MImageDecoderRelay* iRelay;
       
   480 
       
   481 friend class CImageDecodeConstruct;	
       
   482 	};
       
   483 
       
   484 
       
   485 /**
       
   486 @publishedAll
       
   487 @released
       
   488 
       
   489 Buffered image conversion library.
       
   490 
       
   491 Provides a wrapper arround CImageDecoder that enables you to decode multiple images without
       
   492 having to recreate the CBufferedImageDecoder object each time. One of the key features of this
       
   493 class is the ability to append image data to the decoder object as it becomes available; this
       
   494 is done using AppendDataL().
       
   495 */
       
   496 
       
   497 //The public API for clients to call the Buffered Image Conversion Library decoders
       
   498 class CBufferedImageDecoder : public CBase
       
   499 	{
       
   500 private:
       
   501 	enum TState
       
   502 		{
       
   503 		EStateCreated,
       
   504 		EStateOpening,
       
   505 		EStateOpen,
       
   506 		EStateConverting
       
   507 		};
       
   508 
       
   509 public:
       
   510 	IMPORT_C static CBufferedImageDecoder* NewL(RFs& aFs);
       
   511 	IMPORT_C virtual ~CBufferedImageDecoder();
       
   512 
       
   513 	IMPORT_C void OpenL(const TDesC8& aSourceData, const TDesC8& aMIMEType, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone);
       
   514 	IMPORT_C void OpenL(const TDesC8& aSourceData, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone, const TUid aImageType  = KNullUid, const TUid aImageSubType = KNullUid, const TUid aDecoderUid = KNullUid);
       
   515 	IMPORT_C void ContinueOpenL();
       
   516 	IMPORT_C void ContinueProcessingHeaderL();
       
   517 	IMPORT_C TBool IsImageHeaderProcessingComplete() const;
       
   518 
       
   519 	IMPORT_C void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber = 0);
       
   520 	IMPORT_C void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber = 0);
       
   521 	IMPORT_C void ContinueConvert(TRequestStatus* aRequestStatus);
       
   522 
       
   523 	IMPORT_C void Cancel();
       
   524 	IMPORT_C void Reset();
       
   525 
       
   526 	IMPORT_C void AppendDataL(const TDesC8& aData);
       
   527 
       
   528 	IMPORT_C TInt FrameCount() const;
       
   529 	IMPORT_C const TFrameInfo& FrameInfo(TInt aFrameNumber = 0) const;
       
   530 	IMPORT_C const CFrameImageData& FrameData(TInt aFrameNumber = 0) const;
       
   531 
       
   532 	IMPORT_C TInt NumberOfImageComments() const;
       
   533 	IMPORT_C HBufC* ImageCommentL(TInt aCommentNumber) const;
       
   534 	IMPORT_C TInt NumberOfFrameComments(TInt aFrameNumber) const;
       
   535 	IMPORT_C HBufC* FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const;
       
   536 
       
   537 	IMPORT_C CFrameInfoStrings* FrameInfoStringsLC(TInt aFrameNumber = 0);
       
   538 	IMPORT_C CFrameInfoStrings* FrameInfoStringsL(TInt aFrameNumber = 0);
       
   539 	IMPORT_C TUid ImplementationUid() const;
       
   540 
       
   541 	IMPORT_C TBool ValidDecoder () const;
       
   542 
       
   543 private:
       
   544 	CBufferedImageDecoder(RFs& aFs);
       
   545 
       
   546 private:
       
   547 	RFs iFileSession;
       
   548 	CImageDecoder::TOptions iOptions;
       
   549 	TUid iImageType;
       
   550 	TUid iImageSubType;
       
   551 	TUid iDecoderUid;
       
   552 	TPtr8 iBuffer;
       
   553 	TPtr8 iMimeType;	
       
   554 
       
   555 	CImageDecoder* iDecoder;
       
   556 
       
   557 	TBool iImageTypeOpen; // Object was opened using image type	
       
   558 	TState iState;
       
   559 
       
   560 friend class RBufferedDecoderTest;
       
   561 	};
       
   562 
       
   563 
       
   564 // The public API for clients to call the Image Conversion Library encoders
       
   565 
       
   566 /**
       
   567 @publishedAll
       
   568 @released
       
   569 
       
   570 Provides access to the ICL (image conversion library) encoders.
       
   571 
       
   572 This class provides functions that convert image data held in CFbsBitmap objects 
       
   573 into well know formats and store the results in either files of descriptors.
       
   574 */
       
   575 class CImageEncoder : public CBase
       
   576 	{
       
   577 public:
       
   578 
       
   579 	/**
       
   580 	Flags to control how the image is encoded.
       
   581 	These can be combined using an OR operation.
       
   582 	*/
       
   583 	enum TOptions
       
   584 		{
       
   585 		/** No flag set
       
   586 		*/
       
   587 		EOptionNone = 0x00,
       
   588 
       
   589 		/** Perform the encoding in a separate thread 
       
   590 		*/
       
   591 		EOptionAlwaysThread = 0x01,
       
   592 		
       
   593 		/** If the codec supports it, generate a palette based on the colors present in the image data, rather than using the default palette
       
   594 		*/
       
   595 		EOptionGenerateAdaptivePalette = 0x02,
       
   596 
       
   597 		/**
       
   598 		Use the highest possible image encoding speed; this may result in lower image quality. 
       
   599 		This flag is more applicable to formats which use "lossy" compression algorithms, such as JPEG. 
       
   600 		Decoders that do not support fast encoding will ignore it.
       
   601 		*/
       
   602 		EPreferFastEncode = 0x04,
       
   603 
       
   604 		/**
       
   605 		@publishedAll
       
   606 		@released
       
   607 				
       
   608 		Codec must support block streaming extension.
       
   609 		 */
       
   610 		EOptionExtStream = 0x0100,
       
   611 		
       
   612 		/**
       
   613 		@publishedAll
       
   614 		@released
       
   615 				
       
   616 		Codec must support rotation through the operation extension.
       
   617 		 */
       
   618 		EOptionExtRotation = 0x0200,
       
   619 
       
   620 		/**
       
   621 		@publishedAll
       
   622 		@released
       
   623 				
       
   624 		Codec must support horizontal mirror through the operation extension.
       
   625 		 */
       
   626 		EOptionExtMirrorHorizontalAxis = 0x0400,
       
   627 
       
   628 		/**
       
   629 		@publishedAll
       
   630 		@released
       
   631 				
       
   632 		Codec must support vertical mirror through the operation extension.
       
   633 		 */
       
   634 		EOptionExtMirrorVerticalAxis = 0x0800,
       
   635 
       
   636 		/**
       
   637 		@publishedAll
       
   638 		@released
       
   639 				
       
   640 		Codec must support setting thumbnail when using the other extensions (e.g. thumbnail rotation)
       
   641 		 */
       
   642 		EOptionExtUseWithSetThumbnail = 0x1000,
       
   643 		
       
   644 		/** Reserved.
       
   645 		 */
       
   646 		EOptionExtReserved1 = 0x2000,
       
   647 
       
   648 		/** Reserved.
       
   649 		 */
       
   650 		EOptionExtReserved2 = 0x4000,
       
   651 		
       
   652 		/** Reserved.
       
   653 		 */
       
   654 		EOptionExtReserved3 = 0x8000
       
   655 		};
       
   656 
       
   657 public:
       
   658 	IMPORT_C static void GetImageTypesL(RImageTypeDescriptionArray& aImageTypeArray);
       
   659 	IMPORT_C static void GetImageSubTypesL(const TUid aImageType, RImageTypeDescriptionArray& aSubTypeArray);
       
   660 	IMPORT_C static void GetFileTypesL(RFileExtensionMIMETypeArray& aFileExtensionArray);
       
   661 	IMPORT_C static CImageEncoder* FileNewL(RFs& aFs, const TDesC& aDestinationFilename, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   662 	IMPORT_C static CImageEncoder* FileNewL(RFs& aFs, const TDesC& aDestinationFilename, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aEncoderUid = KNullUid);
       
   663 
       
   664 	IMPORT_C static CImageEncoder* FileNewL(RFile& aFile, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   665 	IMPORT_C static CImageEncoder* FileNewL(RFile& aFile, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aEncoderUid = KNullUid);
       
   666 
       
   667 	IMPORT_C static CImageEncoder* DataNewL(HBufC8*& aDestinationData, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   668 	IMPORT_C static CImageEncoder* DataNewL(HBufC8*& aDestinationData, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aEncoderUid = KNullUid);
       
   669 
       
   670 	IMPORT_C void Convert(TRequestStatus* aRequestStatus, const CFbsBitmap& aSource, const CFrameImageData* aFrameImageData = NULL);
       
   671 
       
   672 	IMPORT_C virtual ~CImageEncoder();
       
   673 	IMPORT_C void Cancel();
       
   674 
       
   675 	IMPORT_C TUid ImplementationUid() const;
       
   676 
       
   677 	IMPORT_C void SetThumbnail(TBool aDoGenerateThumbnail);
       
   678 	IMPORT_C TInt SetEncoderThreadPriority(TThreadPriority aPriority);
       
   679 
       
   680 	IMPORT_C static void GetPluginPropertiesL(const TUid aImplementationUid, RUidDataArray& aPropertiesArray);
       
   681 	IMPORT_C static void GetInterfaceImplementationsL(const RUidDataArray& aRequiredUids, RUidDataArray& aImplArray);
       
   682 	IMPORT_C static void GetInterfaceImplementationsL(const TUid* aRequiredUids, const TInt aLength, RUidDataArray& aImplArray);
       
   683 
       
   684 	IMPORT_C TImageConvOperation* OperationL();
       
   685 	IMPORT_C TImageConvStreamedEncode* BlockStreamerL();
       
   686 
       
   687 	IMPORT_C void Prepare(TRequestStatus* aRequestStatus);
       
   688 
       
   689 protected:
       
   690 	IMPORT_C CImageEncoder();
       
   691 
       
   692 	// custom commands - for extended encoders
       
   693 	IMPORT_C void CustomSyncL(TInt aParam);
       
   694 	IMPORT_C void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam);
       
   695 	IMPORT_C CImageEncoderPlugin* Plugin() const;
       
   696 
       
   697 private:
       
   698 	static void MimeTypeGetEncoderListL(RImplInfoPtrArray& aEncoderList, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
       
   699 	static void ImageTypeGetEncoderListL(RImplInfoPtrArray& aEncoderList, const TUid aImageType, const TUid aImageSubType, const TUid aEncoderUid, const TOptions aOptions = EOptionNone);
       
   700 
       
   701    	static CImageEncodeConstruct* NewEncodeConstructL(const CImplementationInformation& aEncoderInfo, const TOptions aOptions = EOptionNone);
       
   702 
       
   703 	static CImageEncoder* NewL(CImageEncodeConstruct* aConstruct, TOptions aOptions);
       
   704 	static CImageEncoder* NewL();
       
   705 
       
   706 	inline TBool ValidProperties() const;
       
   707 
       
   708 	// Future proofing
       
   709 	IMPORT_C virtual void ReservedVirtual1();
       
   710 	IMPORT_C virtual void ReservedVirtual2();
       
   711 	IMPORT_C virtual void ReservedVirtual3();
       
   712 	IMPORT_C virtual void ReservedVirtual4();
       
   713 
       
   714 private:
       
   715 	MImageEncoderRelay* iRelay;
       
   716 
       
   717 friend class CImageEncodeConstruct;
       
   718 	};
       
   719 
       
   720 #endif // IMAGECONVERSION_H
       
   721