epoc32/include/imageconversion.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 2001-2009 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 	/**
   347 	Flags to control which image is decoded.
   348 	This can be used when the source file or descriptor 
   349 	contains multiple distinct image sources.
   350 	*/	
   351 	enum TImageType
   352 		{
   353 		/** Use the thumbnail as source image
   354 		*/
   355 		EImageTypeThumbnail = 0x01,
   356 		/** Use the main image
   357 		*/
   358 		EImageTypeMain = 0x02
   359 		};
   360 		
   361 public:
   362 	IMPORT_C static void GetImageTypesL(RImageTypeDescriptionArray& aImageTypeArray);
   363 	IMPORT_C static void GetImageSubTypesL(const TUid aImageType, RImageTypeDescriptionArray& aSubTypeArray);
   364 	IMPORT_C static void GetFileTypesL(RFileExtensionMIMETypeArray& aFileExtensionArray);
   365 	IMPORT_C static void GetMimeTypeFileL(RFs& aFs, const TDesC& aFileName, TDes8& aMimeType);
   366 	IMPORT_C static void GetMimeTypeDataL(const TDesC8& aImageData, TDes8& aMimeType);
   367 
   368 	IMPORT_C static CImplementationInformationType* GetImplementationInformationL(TUid aImplementationUid);
   369 
   370 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TDesC& aSourceFilename, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   371 	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);
   372 
   373 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TDesC& aSourceFilename, const TDesC8& aMIMEType, ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
   374 	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);
   375 	IMPORT_C static CImageDecoder* FileNewL(RFile& aFile, const TDesC8& aMIMEType, ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
   376 	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);
   377 
   378 	IMPORT_C static CImageDecoder* FileNewL(RFs& aFs, const TMMSource& aFileSource, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   379 	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);
   380 	
   381 	IMPORT_C static CImageDecoder* DataNewL(RFs& aFs, const TDesC8& aSourceData, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   382 	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);
   383 	IMPORT_C virtual ~CImageDecoder();
   384 
   385 	IMPORT_C virtual void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber = 0);
   386 	IMPORT_C virtual void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber = 0);
   387 	IMPORT_C virtual void ContinueConvert(TRequestStatus* aRequestStatus);
   388 	IMPORT_C void Cancel();
   389 
   390 	IMPORT_C TInt FrameCount() const;
   391 	IMPORT_C TBool IsImageHeaderProcessingComplete() const;
   392 	IMPORT_C void ContinueProcessingHeaderL();
   393 
   394 	IMPORT_C const TFrameInfo& FrameInfo(TInt aFrameNumber = 0) const;
   395 	IMPORT_C const CFrameImageData& FrameData(TInt aFrameNumber = 0) const;
   396 
   397 	IMPORT_C TInt NumberOfImageComments() const;
   398 	IMPORT_C HBufC* ImageCommentL(TInt aCommentNumber) const;
   399 	IMPORT_C TInt NumberOfFrameComments(TInt aFrameNumber) const;
   400 	IMPORT_C HBufC* FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const;
   401 
   402 	IMPORT_C CFrameInfoStrings* FrameInfoStringsLC(TInt aFrameNumber = 0);
   403 	IMPORT_C CFrameInfoStrings* FrameInfoStringsL(TInt aFrameNumber = 0);
   404 	IMPORT_C TUid ImplementationUid() const;
   405 
   406 	IMPORT_C void ImageType(TInt aFrameNumber, TUid& aImageType, TUid& aImageSubType) const;
   407 
   408 	IMPORT_C TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue);
   409 	IMPORT_C void SetImageTypeL(TInt aImageType);
   410 	
   411 	IMPORT_C TInt ReductionFactor(const TSize& aOriginalSize, const TSize& aReducedSize) const;
   412 	IMPORT_C TInt ReducedSize(const TSize& aOriginalSize,  TInt aReductionFactor, TSize& aReducedSize) const;
   413 	IMPORT_C TInt SetDecoderThreadPriority(TThreadPriority aPriority);
   414 
   415 	IMPORT_C static void GetPluginPropertiesL(const TUid aImplementationUid, RUidDataArray& aPropertiesArray);
   416 	IMPORT_C static void GetInterfaceImplementationsL(const RUidDataArray& aRequiredUids, RUidDataArray& aImplArray);
   417 	IMPORT_C static void GetInterfaceImplementationsL(const TUid* aRequiredUids, const TInt aLength, RUidDataArray& aImplArray);
   418 
   419 	IMPORT_C TImageConvOperation* OperationL();
   420 	IMPORT_C TImageConvScaler* ScalerL();
   421 	IMPORT_C TImageConvStreamedDecode* BlockStreamerL();
   422 
   423 	IMPORT_C void SetClippingRectL(const TRect* aClipRect);
   424 	IMPORT_C TInt GetDestinationSize(TSize& aSize, TInt aFrameNumber = 0);
   425 	
   426 	IMPORT_C void Prepare(TRequestStatus* aRequestStatus);
   427 
   428 protected:
   429 	IMPORT_C CImageDecoder();
   430 
   431 	// custom commands - for extended decoders
   432 	IMPORT_C void CustomSyncL(TInt aParam);
   433 	IMPORT_C void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam);
   434 	IMPORT_C CImageDecoderPlugin* Plugin() const;
   435 
   436 private:
   437 	static void MimeTypeGetDecoderListL(RImplInfoPtrArray& aDecoderList, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   438 	static void ImageTypeGetDecoderListL(RImplInfoPtrArray& aDecoderList, const TDesC8& aImageHeader, const TUid aImageType, const TUid aImageSubType, const TUid aDecoderUid, const TOptions aOptions = EOptionNone);
   439 	static void SuffixTypeGetDecoderListL(RImplInfoPtrArray& aDecoderList, const TDesC& aFileName, const TOptions aOptions = EOptionNone);
   440 
   441 	static CImageDecoder* FileFindDecoderNewL(const RImplInfoPtrArray& aDecoderList, RFs& aFs, const TDesC& aSourceFilename, const TOptions aOptions, const TDesC& aUniqueId);
   442 	static CImageDecoder* FileDecoderNewL(const CImplementationInformation& aDecoderInfo, RFs& aFs, const TDesC& aSourceFilename, const TOptions aOptions, const TDesC& aUniqueId);
   443 	
   444 	static CImageDecoder* DataFindDecoderNewL(const RImplInfoPtrArray& aDecoderList, RFs& aFs, const TDesC8& aSourceData, const TOptions aOptions);
   445 	static CImageDecoder* DataDecoderNewL(const CImplementationInformation& aDecoderInfo, RFs& aFs, const TDesC8& aSourceData, const TOptions aOptions);
   446 
   447 	static CImageDecodeConstruct* NewDecodeConstructL(const CImplementationInformation& aDecoderInfo, const TOptions aOptions = EOptionNone);
   448 
   449 	static void DoGetMimeTypeL(const TDesC& aFileName, const TDesC8& aMatchString, TDes8& aMimeType);
   450 
   451 	static CImageDecoder* NewL(CImageDecodeConstruct* aConstruct, TOptions aOptions);
   452 	static CImageDecoder* NewL();
   453 
   454 	static CImageDecoder* FileNewImplL(RFs& aFs, const TDesC& aSourceFilename, const TDesC8& aMIMEType, const TDesC& aUniqueId, const ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
   455 	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);
   456 	static CImageDecoder* FileFindDecoderNewL(const RImplInfoPtrArray& aDecoderList, RFile& aFile, const TOptions aOptions, const TDesC& aUniqueId);
   457 	static CImageDecoder* FileDecoderNewL(const CImplementationInformation& aDecoderInfo, RFile& aFile, const TOptions aOptions, const TDesC& aUniqueId);
   458 	static CImageDecoder* FileNewImplL(RFile& aFile, const TDesC8& aMIMEType, const TDesC& aUniqueId, const ContentAccess::TIntent aIntent, const TOptions aOptions = EOptionNone);
   459 	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);
   460     static ContentAccess::CContent* GetContentLC(const TDesC& aSourceFilename);
   461 
   462 	inline TBool ValidProperties() const;
   463 
   464 	// Future proofing
   465 	IMPORT_C virtual void ReservedVirtual1();
   466 	IMPORT_C virtual void ReservedVirtual2();
   467 	IMPORT_C virtual void ReservedVirtual3();
   468 	IMPORT_C virtual void ReservedVirtual4();
   469 
   470 private:
   471 	MImageDecoderRelay* iRelay;
   472 
   473 friend class CImageDecodeConstruct;	
   474 	};
   475 
   476 
   477 /**
   478 @publishedAll
   479 @released
   480 
   481 Buffered image conversion library.
   482 
   483 Provides a wrapper arround CImageDecoder that enables you to decode multiple images without
   484 having to recreate the CBufferedImageDecoder object each time. One of the key features of this
   485 class is the ability to append image data to the decoder object as it becomes available; this
   486 is done using AppendDataL().
   487 */
   488 
   489 //The public API for clients to call the Buffered Image Conversion Library decoders
   490 class CBufferedImageDecoder : public CBase
   491 	{
   492 private:
   493 	enum TState
   494 		{
   495 		EStateCreated,
   496 		EStateOpening,
   497 		EStateOpen,
   498 		EStateConverting
   499 		};
   500 
   501 public:
   502 	IMPORT_C static CBufferedImageDecoder* NewL(RFs& aFs);
   503 	IMPORT_C virtual ~CBufferedImageDecoder();
   504 
   505 	IMPORT_C void OpenL(const TDesC8& aSourceData, const TDesC8& aMIMEType, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone);
   506 	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);
   507 	IMPORT_C void ContinueOpenL();
   508 	IMPORT_C void ContinueProcessingHeaderL();
   509 	IMPORT_C TBool IsImageHeaderProcessingComplete() const;
   510 
   511 	IMPORT_C void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber = 0);
   512 	IMPORT_C void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber = 0);
   513 	IMPORT_C void ContinueConvert(TRequestStatus* aRequestStatus);
   514 
   515 	IMPORT_C void Cancel();
   516 	IMPORT_C void Reset();
   517 
   518 	IMPORT_C void AppendDataL(const TDesC8& aData);
   519 
   520 	IMPORT_C TInt FrameCount() const;
   521 	IMPORT_C const TFrameInfo& FrameInfo(TInt aFrameNumber = 0) const;
   522 	IMPORT_C const CFrameImageData& FrameData(TInt aFrameNumber = 0) const;
   523 
   524 	IMPORT_C TInt NumberOfImageComments() const;
   525 	IMPORT_C HBufC* ImageCommentL(TInt aCommentNumber) const;
   526 	IMPORT_C TInt NumberOfFrameComments(TInt aFrameNumber) const;
   527 	IMPORT_C HBufC* FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const;
   528 
   529 	IMPORT_C CFrameInfoStrings* FrameInfoStringsLC(TInt aFrameNumber = 0);
   530 	IMPORT_C CFrameInfoStrings* FrameInfoStringsL(TInt aFrameNumber = 0);
   531 	IMPORT_C TUid ImplementationUid() const;
   532 
   533 	IMPORT_C TBool ValidDecoder () const;
   534 
   535 private:
   536 	CBufferedImageDecoder(RFs& aFs);
   537 
   538 private:
   539 	RFs iFileSession;
   540 	CImageDecoder::TOptions iOptions;
   541 	TUid iImageType;
   542 	TUid iImageSubType;
   543 	TUid iDecoderUid;
   544 	TPtr8 iBuffer;
   545 	TPtr8 iMimeType;	
   546 
   547 	CImageDecoder* iDecoder;
   548 
   549 	TBool iImageTypeOpen; // Object was opened using image type	
   550 	TState iState;
   551 
   552 friend class RBufferedDecoderTest;
   553 	};
   554 
   555 
   556 // The public API for clients to call the Image Conversion Library encoders
   557 
   558 /**
   559 @publishedAll
   560 @released
   561 
   562 Provides access to the ICL (image conversion library) encoders.
   563 
   564 This class provides functions that convert image data held in CFbsBitmap objects 
   565 into well know formats and store the results in either files of descriptors.
   566 */
   567 class CImageEncoder : public CBase
   568 	{
   569 public:
   570 
   571 	/**
   572 	Flags to control how the image is encoded.
   573 	These can be combined using an OR operation.
   574 	*/
   575 	enum TOptions
   576 		{
   577 		/** No flag set
   578 		*/
   579 		EOptionNone = 0x00,
   580 
   581 		/** Perform the encoding in a separate thread 
   582 		*/
   583 		EOptionAlwaysThread = 0x01,
   584 		
   585 		/** If the codec supports it, generate a palette based on the colors present in the image data, rather than using the default palette
   586 		*/
   587 		EOptionGenerateAdaptivePalette = 0x02,
   588 
   589 		/**
   590 		Use the highest possible image encoding speed; this may result in lower image quality. 
   591 		This flag is more applicable to formats which use "lossy" compression algorithms, such as JPEG. 
   592 		Decoders that do not support fast encoding will ignore it.
   593 		*/
   594 		EPreferFastEncode = 0x04,
   595 
   596 		/**
   597 		@publishedAll
   598 		@released
   599 				
   600 		Codec must support block streaming extension.
   601 		 */
   602 		EOptionExtStream = 0x0100,
   603 		
   604 		/**
   605 		@publishedAll
   606 		@released
   607 				
   608 		Codec must support rotation through the operation extension.
   609 		 */
   610 		EOptionExtRotation = 0x0200,
   611 
   612 		/**
   613 		@publishedAll
   614 		@released
   615 				
   616 		Codec must support horizontal mirror through the operation extension.
   617 		 */
   618 		EOptionExtMirrorHorizontalAxis = 0x0400,
   619 
   620 		/**
   621 		@publishedAll
   622 		@released
   623 				
   624 		Codec must support vertical mirror through the operation extension.
   625 		 */
   626 		EOptionExtMirrorVerticalAxis = 0x0800,
   627 
   628 		/**
   629 		@publishedAll
   630 		@released
   631 				
   632 		Codec must support setting thumbnail when using the other extensions (e.g. thumbnail rotation)
   633 		 */
   634 		EOptionExtUseWithSetThumbnail = 0x1000,
   635 		
   636 		/** Reserved.
   637 		 */
   638 		EOptionExtReserved1 = 0x2000,
   639 
   640 		/** Reserved.
   641 		 */
   642 		EOptionExtReserved2 = 0x4000,
   643 		
   644 		/** Reserved.
   645 		 */
   646 		EOptionExtReserved3 = 0x8000
   647 		};
   648 
   649 public:
   650 	IMPORT_C static void GetImageTypesL(RImageTypeDescriptionArray& aImageTypeArray);
   651 	IMPORT_C static void GetImageSubTypesL(const TUid aImageType, RImageTypeDescriptionArray& aSubTypeArray);
   652 	IMPORT_C static void GetFileTypesL(RFileExtensionMIMETypeArray& aFileExtensionArray);
   653 	IMPORT_C static CImageEncoder* FileNewL(RFs& aFs, const TDesC& aDestinationFilename, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   654 	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);
   655 
   656 	IMPORT_C static CImageEncoder* FileNewL(RFile& aFile, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   657 	IMPORT_C static CImageEncoder* FileNewL(RFile& aFile, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aEncoderUid = KNullUid);
   658 
   659 	IMPORT_C static CImageEncoder* DataNewL(HBufC8*& aDestinationData, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   660 	IMPORT_C static CImageEncoder* DataNewL(HBufC8*& aDestinationData, const TOptions aOptions = EOptionNone, const TUid aImageType = KNullUid, const TUid aImageSubType = KNullUid, const TUid aEncoderUid = KNullUid);
   661 
   662 	IMPORT_C void Convert(TRequestStatus* aRequestStatus, const CFbsBitmap& aSource, const CFrameImageData* aFrameImageData = NULL);
   663 
   664 	IMPORT_C virtual ~CImageEncoder();
   665 	IMPORT_C void Cancel();
   666 
   667 	IMPORT_C TUid ImplementationUid() const;
   668 
   669 	IMPORT_C void SetThumbnail(TBool aDoGenerateThumbnail);
   670 	IMPORT_C TInt SetEncoderThreadPriority(TThreadPriority aPriority);
   671 
   672 	IMPORT_C static void GetPluginPropertiesL(const TUid aImplementationUid, RUidDataArray& aPropertiesArray);
   673 	IMPORT_C static void GetInterfaceImplementationsL(const RUidDataArray& aRequiredUids, RUidDataArray& aImplArray);
   674 	IMPORT_C static void GetInterfaceImplementationsL(const TUid* aRequiredUids, const TInt aLength, RUidDataArray& aImplArray);
   675 
   676 	IMPORT_C TImageConvOperation* OperationL();
   677 	IMPORT_C TImageConvStreamedEncode* BlockStreamerL();
   678 
   679 	IMPORT_C void Prepare(TRequestStatus* aRequestStatus);
   680 
   681 protected:
   682 	IMPORT_C CImageEncoder();
   683 
   684 	// custom commands - for extended encoders
   685 	IMPORT_C void CustomSyncL(TInt aParam);
   686 	IMPORT_C void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam);
   687 	IMPORT_C CImageEncoderPlugin* Plugin() const;
   688 
   689 private:
   690 	static void MimeTypeGetEncoderListL(RImplInfoPtrArray& aEncoderList, const TDesC8& aMIMEType, const TOptions aOptions = EOptionNone);
   691 	static void ImageTypeGetEncoderListL(RImplInfoPtrArray& aEncoderList, const TUid aImageType, const TUid aImageSubType, const TUid aEncoderUid, const TOptions aOptions = EOptionNone);
   692 
   693    	static CImageEncodeConstruct* NewEncodeConstructL(const CImplementationInformation& aEncoderInfo, const TOptions aOptions = EOptionNone);
   694 
   695 	static CImageEncoder* NewL(CImageEncodeConstruct* aConstruct, TOptions aOptions);
   696 	static CImageEncoder* NewL();
   697 
   698 	inline TBool ValidProperties() const;
   699 
   700 	// Future proofing
   701 	IMPORT_C virtual void ReservedVirtual1();
   702 	IMPORT_C virtual void ReservedVirtual2();
   703 	IMPORT_C virtual void ReservedVirtual3();
   704 	IMPORT_C virtual void ReservedVirtual4();
   705 
   706 private:
   707 	MImageEncoderRelay* iRelay;
   708 
   709 friend class CImageEncodeConstruct;
   710 	};
   711 
   712 #endif // IMAGECONVERSION_H
   713