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