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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // ImageCodecData.h - data used by standard codecs
25 #ifndef __IMAGECODECDATA_H__
26 #define __IMAGECODECDATA_H__
29 #include <ezcompressor.h>
30 #include <icl/imagedata.h>
32 class CFrameImageData;
35 // Identification UIDs for TFrameDataBlock-derived classes
37 /** GIF image descriptor.
39 const TUid KGIFImageDescriptorUid = { 0x101F45E4 };
42 const TUid KGIFColorTableUid = { 0x101F7C0A };
43 /** GIF compression type LZW information.
45 const TUid KGIFLZWInfoUid = { 0x101F45E5 };
46 /** GIF image controller.
48 const TUid KGIFImageControlUid = { 0x101F45E6 };
49 /** GIF loop iterations.
51 const TUid KGIFLoopIterationsUid = { 0x102834A6 };
54 const TUid KMBMDecodeDataUid = { 0x101F45E0 };
57 const TUid KMBMEncodeDataUid = { 0x101F45E9 };
60 const TUid KPNGEncodeDataUid = { 0x101F460A };
63 const TUid KTIFFImageDataUid = { 0x101F45E8 };
67 //Identification UIDs for TImageDataBlock-derived classes
71 const TUid KBMPImageDataUid = { 0x101F45BF };
74 const TUid KBMPCompressionUid = { 0x101F45E3 };
77 const TUid KJPGImageDataUid = { 0x101F45DA };
80 const TUid KJPGQTableUid = { 0x101F45E1 };
83 const TUid KJPGCommentUid = { 0x101F45E2 };
84 /** GIF background colour.
86 const TUid KGIFBackgroundColorUid = { 0x101F45DE };
89 const TUid KGIFCommentUid = { 0x101F45E7 };
91 /** Max number of GIF palatte entries
93 const TInt KGifColorTableMaxEntries = 256;
99 BMP specific image data variant which holds bits per pixel info.
100 It is only used when configuring the BMP encoder.
101 If the Symbian bitmap encoder (0x101F45AE) is supplied then encoder specific defaults
102 are used if this object is not presented to the conversion process.
103 The default bitmap colour depth is 24-bit.
107 class TBmpImageData : public TImageDataBlock
110 IMPORT_C TBmpImageData();
113 /** The number of bits/pixel.
118 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
125 BMP specific image data variant which holds compression info.
126 It is only used when extracting info from the BMP decoder.
128 class TBmpCompression : public TImageDataBlock
131 IMPORT_C TBmpCompression();
135 Flag reflecting the compression type.
139 /** No compression used.
143 /** Eight bits per pixel run length encoding.
147 /** Four bits per pixel run length encoding.
151 /** Compression using bit fields.
158 @see enum TCompression
160 The type of compression used
162 TCompression iCompression;
165 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
173 JPEG specific image data variant which holds color sampling and quality
176 It can be used with both the JPEG decoder and encoder.
178 class TJpegImageData : public TImageDataBlock
182 Flag reflecting the color sampling type.
190 /** Horizontal and vertical chrominance decimation.
194 /** Horizontal chrominance decimation.
198 /** No chrominance decimation.
203 IMPORT_C TJpegImageData(); // Defaults to EColor420 and 75
207 @see enum TColorSampling
209 The color sampling scheme to use.
211 TColorSampling iSampleScheme;
213 /** The quality factor.
215 This represents the current allowable percentage level of degradation when compressing the image
218 The range is 0 to 100 inclusive.
223 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
226 /** The number of JPEG Q table entries.
228 @see class TJpegQTable
230 const TInt KJpgQTableEntries = 64;
236 JPEG specific image data variant which holds QTable info.
238 It can be used with both the JPEG decoder and encoder.
240 class TJpegQTable : public TImageDataBlock
244 Flag reflecting the type of Q or quantization table.
252 /** Chrominance table.
257 IMPORT_C TJpegQTable();
260 /** The type of Q table. */
263 /** The number of entries in the Q table. */
264 TBuf8<KJpgQTableEntries> iEntries;
267 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
274 JPEG specific image data variant which holds JPEG comment information.
276 It can be used with both the JPEG decoder and encoder.
278 class TJpegComment : public TImageDataBlock
281 IMPORT_C TJpegComment();
284 /** The JPEG comment associated with the JPEG image.
289 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
297 GIF specific image data variant which holds background color info.
299 It can only be used with the GIF decoder (the encoder is not configurable).
301 class TGifBackgroundColor : public TImageDataBlock
304 IMPORT_C TGifBackgroundColor();
307 /** The background colour as an index.
309 TInt iBackgroundColorIndex;
311 /** The background colour as an RGB value.
313 TRgb iBackgroundColor;
316 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
320 GIF specific frame data variant which holds image descriptor information.
322 It can only be used with the GIF decoder (the encoder is not configurable).
327 class TGifImageDescriptor : public TFrameDataBlock
330 IMPORT_C TGifImageDescriptor();
333 /** A boolean indicating if the frame has its own local colour map. ETrue if it does, otherwise
336 TBool iLocalColorMap;
338 /** A boolean indicating if the frame's local colour map is sorted in priority order. ETrue if
339 it is, otherwise EFalse.
341 TBool iSortedLocalMap;
343 /** A boolean indicating if the image is interlaced. ETrue if the image is interlaced.
348 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
355 GIF specific frame data for saving a frame local color map (palette).
357 class TGifColorTable : public TFrameDataBlock
360 IMPORT_C TGifColorTable();
364 TRgb iPalette[KGifColorTableMaxEntries];
367 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
374 GIF specific frame data variant which holds LZW compression information.
376 It can only be used with the GIF decoder (the encoder is not configurable).
378 class TGifLZWInfo : public TFrameDataBlock
381 IMPORT_C TGifLZWInfo();
384 /** The initial number of bits used in LZW compression.
386 TInt iInitialCodeLength;
388 /** The size of compressed frame.
390 TInt iCompressedBytes;
393 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
400 GIF specific frame data variant which holds GIF image control information.
402 It can only be used with the GIF decoder (the encoder is not configurable).
404 class TGifImageControl : public TFrameDataBlock
408 Flag reflecting how the previous frame is handled when the next frame is drawn.
416 /** Leave the previous frame in place.
420 /** Restore to the backgound colour.
422 ERestoreToBackground = 2,
424 /** Restore the previous frame.
426 ERestoreToPrevious = 3
430 IMPORT_C TGifImageControl();
433 /** The interval between display of successive frames in units of 1/100 second.
435 TInt iDelayTimeInCentiseconds;
437 /** The colour index to be used for transparency.
439 TInt iTransparentColorIndex;
441 /** A flag indicating if user input is required before display of next frame.
443 TBool iUserInputFlag;
445 /** The frame disposal method for multiframe images.
447 TDisposalMethod iDisposalMethod;
450 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
457 GIF specific image data variant which holds GIF comment info.
459 It can only be used with the GIF decoder (the encoder is not configurable).
461 class TGifComment : public TImageDataBlock
464 IMPORT_C TGifComment();
467 /** The comment associated with the GIF image.
472 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
479 GIF specific image data variant which holds Netscape 2.0 Application Extension block loop iterations value
481 It can only be used with the GIF decoder (the encoder is not configurable).
483 class TGifLoopIterations : public TImageDataBlock
486 IMPORT_C TGifLoopIterations();
489 /** The number of times to loop an animated GIF
491 TInt iLoopIterations;
494 TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
497 // Mbm compression data. (Decoder only)
502 MBM specific frame data variant which holds frame data information.
504 It can only be used with the MBM decoder.
506 class TMbmDecodeData : public TFrameDataBlock
509 IMPORT_C TMbmDecodeData();
512 /** A flag indicating if RLE compression is used.
516 /** The uncompressed frame size in bytes.
518 TInt iImageDataSizeInBytes;
521 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
525 // Mbm display mode. (Encoder only)
530 MBM specific image data variant which holds frame data information.
532 It can only be used with the MBM encoder.
534 class TMbmEncodeData : public TFrameDataBlock
537 IMPORT_C TMbmEncodeData();
540 /** The display mode.
542 TDisplayMode iDisplayMode;
545 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
553 PNG specific frame data variant which holds PNG encoding information.
555 It can only be used with the PNG encoder.
557 class TPngEncodeData : public TFrameDataBlock
560 // Same values as CEZCompressor
562 A flag reflecting the level of compression used.
564 enum TPngCompressLevel
567 Default level of compression used.
569 EDefaultCompression = Z_DEFAULT_COMPRESSION,
571 /** No compression used.
573 ENoCompression = Z_NO_COMPRESSION,
575 /** Optimise compression for speed.
577 EBestSpeed = Z_BEST_SPEED,
579 /** Optimise compression for size.
581 EBestCompression = Z_BEST_COMPRESSION
584 IMPORT_C TPngEncodeData();
587 /** The number of bits per pixel.
591 /** A flag indicating if the image is color or grayscale.
595 /** A flag indicating use of a palette or RGB.
599 /** The level of compression to apply.
601 TPngCompressLevel iLevel;
604 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
611 TIFF specific frame data variant. Holds colour sampling and quality factor information.
613 It can only be used with the TIFF decoder.
615 class TTiffImageData : public TFrameDataBlock
618 IMPORT_C TTiffImageData();
621 /** The new subfile type.
623 TUint32 iNewSubfileType;
625 /** The frame size in pixels.
629 /** The number of bits per sample.
633 /** The number of samples per pixel.
635 TInt iSamplesPerPixel;
637 /** The compression setting.
641 /** T4 options as per the "Standardization of Group 3 facsimile apparatus for document
642 transmission, Recommendation T.4, Volume VII, Fascicle VII.3".
646 /** T6 options as per the "Facsimile Coding Schemes and Coding Control Functions for Group 4
647 Facsimile Apparatus, Recommendation T.6, Volume VII, Fascicle VII.3".
651 /** The photometric interpretation setting.
653 TInt iPhotometricInterpretation;
659 /** The frame width in twips.
663 /** The frame height in twips.
665 TReal iHeightInTwips;
667 /** The number of rows per strip.
671 /** The number of TTiffImageStrips.
675 /** An array of TTiffImageStrips.
680 TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
683 // Identification UIDs for image types.
687 const TUid KImageTypeBMPUid = {0x101F45B0};
690 const TUid KImageTypeGIFUid = {0x101F45B3};
693 const TUid KImageTypeWMFUid = {0x101F45BA};
694 /** Image type WMF subtype Std.
696 const TUid KImageTypeWMFSubTypeStdUid = {0x101F45BB};
697 /** Image type WMF subtype Apm.
699 const TUid KImageTypeWMFSubTypeApmUid = {0x101F45BC};
700 /** Image type WMF subtype Clp.
702 const TUid KImageTypeWMFSubTypeClpUid = {0x101F45BD};
705 const TUid KImageTypeTIFFUid = {0x101F45C4};
706 /** Image type TIFF subtype LittleEndian.
708 const TUid KImageTypeTIFFSubTypeLittleEndianUid = {0x101F45C5};
709 /** Image type TIFF subtype BigEndian.
711 const TUid KImageTypeTIFFSubTypeBigEndianUid = {0x101F45C6};
714 const TUid KImageTypePNGUid = {0x101F45C9};
717 const TUid KImageTypeMBMUid = {0x101F45CC};
720 const TUid KImageTypeWBMPUid = {0x101F45CF};
723 const TUid KImageTypeOTAUid = {0x101F45D2};
726 const TUid KImageTypeICOUid = {0x101F45D5};
729 const TUid KImageTypeJPGUid = {0x101F45D8};
731 #endif // __IMAGECODECDATA_H__