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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __ImageData_h__
17 #define __ImageData_h__
24 class CFrameImageData;
30 The abstract base class for all format-specific frame data variants.
35 IMPORT_C TUid DataType() const;
38 IMPORT_C TFrameDataBlock(TUid aDataType);
40 Provides a copy of an object that manages a list of frame and image block data,
41 but not a bitwise copy. It provides a new reference to the object.
42 @param aFrameImageData An object that manages a list of frame and image block data
44 virtual TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const = 0;
52 friend class CFrameImageData;
53 friend class RTImageDataTest;
60 The abstract base class for all format-specific image data variants.
65 IMPORT_C TUid DataType() const;
68 IMPORT_C TImageDataBlock(TUid aDataType);
71 virtual TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const = 0;
79 friend class CFrameImageData;
80 friend class RTImageDataTest;
84 class CImageDataArray;
90 Class to manage lists of frame and image block data.
92 class CFrameImageData : public CBase
95 IMPORT_C static CFrameImageData* NewL();
96 IMPORT_C static CFrameImageData* NewL(CImageDataArray& aImageData, TBool aImageDataOwner = EFalse);
97 IMPORT_C CFrameImageData* AllocL() const;
98 IMPORT_C ~CFrameImageData();
101 // Append/insert/delete
102 IMPORT_C TInt InsertImageData(const TImageDataBlock* aEntry, TInt aPos);
103 IMPORT_C TInt AppendImageData(const TImageDataBlock* aEntry);
104 IMPORT_C void RemoveImageData(TInt aIndex);
106 IMPORT_C TInt InsertFrameData(const TFrameDataBlock* aEntry, TInt aPos);
107 IMPORT_C TInt AppendFrameData(const TFrameDataBlock* aEntry);
108 IMPORT_C void RemoveFrameData(TInt aIndex);
110 // Get local image data.
111 IMPORT_C const TImageDataBlock* GetImageData(TInt aIndex) const;
112 IMPORT_C TImageDataBlock* GetImageData(TInt aIndex);
114 IMPORT_C const TFrameDataBlock* GetFrameData(TInt aIndex) const;
115 IMPORT_C TFrameDataBlock* GetFrameData(TInt aIndex);
118 IMPORT_C TInt ImageDataCount() const;
119 IMPORT_C TInt FrameDataCount() const;
121 // Append image buffers.
122 IMPORT_C TInt AppendImageBuffer(const HBufC8* aImageBuffer);
125 CFrameImageData(CImageDataArray& aImageData, TBool aImageDataOwner = EFalse);
126 IMPORT_C virtual void Reserved_1();
127 IMPORT_C virtual void Reserved_2();
128 IMPORT_C virtual void Reserved_3();
129 IMPORT_C virtual void Reserved_4();
132 // Image data for the frame. (Single frame formats)
133 // Image data that is the same for all frames. (Multi frame formats)
134 CImageDataArray& iImageData;
135 TBool iImageDataOwner;
137 // Image data that is for this frame only. (Multi frame formats only)
138 RPointerArray<TFrameDataBlock> iFrameData;
147 Class used to maintain frame information stored in
148 codec specific resource files.
150 class CFrameInfoStrings : public CBase
153 IMPORT_C static CFrameInfoStrings* NewL();
154 IMPORT_C static CFrameInfoStrings* NewLC();
155 IMPORT_C ~CFrameInfoStrings();
157 IMPORT_C const TPtrC String(TInt aIndex) const;
158 IMPORT_C TInt Count() const;
160 IMPORT_C const TPtrC Decoder() const;
161 IMPORT_C void SetDecoderL(const TDesC& aString);
162 IMPORT_C const TPtrC Format() const;
163 IMPORT_C void SetFormatL(const TDesC& aString);
164 IMPORT_C const TPtrC Dimensions() const;
165 IMPORT_C void SetDimensionsL(const TDesC& aString);
166 IMPORT_C const TPtrC Depth() const;
167 IMPORT_C void SetDepthL(const TDesC& aString);
168 IMPORT_C const TPtrC Details() const;
169 IMPORT_C void SetDetailsL(const TDesC& aString);
175 void SetStringL(TInt aIndex, const TDesC& aString);
179 enum TFrameInfoStringIndex
188 CDesCArray* iFrameInfoStrings;
195 General frame info provided by all plugins.
201 Flags that define the attributes of a frame. These can be combined using an OR operation.
205 /** Indicates whether or not the frame is colour.
209 /** Indicates if any part of the frame is transparent.
211 ETransparencyPossible = 0x00000002,
213 /** Indicates whether or not the frame can be scaled.
215 EFullyScaleable = 0x00000004,
217 /** Indicates whether or not the frame's aspect ratio must be maintained during scaling. If not
218 set, the frame can be stretched.
220 EConstantAspectRatio = 0x00000008,
222 /** Indicates if the frame can be decoded and drawn dithered. If this is not set, the bitmap
223 must use the recommended display mode.
225 ECanDither = 0x00000010,
227 /** Indicates if the frame contains alpha-blending information. This setting is only valid if
228 ETransparencyPossible is set.
230 EAlphaChannel = 0x00000020,
232 /** Mutually exclusive image disposal method 1, no disposal specified. Image is not disposed
233 of and graphic is left in place.
235 ELeaveInPlace = 0x00000040,
237 /** Mutually exclusive image disposal method 2, restore to background colour. The area used
238 by the graphic must be restored to the background colour.
240 ERestoreToBackground = 0x00000080,
242 /** Mutually exclusive image disposal method 3, restore to previous. The decoder is required
243 to restore the area overwritten by the graphic with what was there prior to rendering the
246 ERestoreToPrevious = 0x00000100,
248 /** If this flag is set and an image convert operation returns KErrUnderFlow, the partially
249 decoded bitmap is not suitable for display.
251 EPartialDecodeInvalid = 0x00000200,
253 /** This flag is used by Mng decoder to indicate that there are more frames to decode
255 EMngMoreFramesToDecode = 0x00000400,
257 /** This flag is used to indicate that the code sets iFrameSizeInPixels
259 EUsesFrameSizeInPixels = 0x00000800
263 Indicates the current status of frame processing.
267 /** The frame information has not been initialised.
269 EFrameInfoUninitialised,
271 /** The frame header is being processed.
273 EFrameInfoProcessingFrameHeader,
275 /** The frame is being processed.
277 EFrameInfoProcessingFrame,
279 /** The frame has been processed.
281 EFrameInfoProcessingComplete
284 IMPORT_C TFrameInfoState CurrentFrameState() const;
285 IMPORT_C void SetCurrentFrameState(TFrameInfoState aFrameInfoState);
286 IMPORT_C TInt CurrentDataOffset() const;
287 IMPORT_C void SetCurrentDataOffset(TInt aOffset);
288 IMPORT_C TInt FrameDataOffset() const;
289 IMPORT_C void SetFrameDataOffset(TInt aOffset);
292 The coordinates of the frame within the screen in pixels.
294 TRect iFrameCoordsInPixels;
297 The size of the frame in twips.
299 TSize iFrameSizeInTwips;
302 The number of bits per pixel for the frame.
307 The delay in microseconds before displaying the next frame.
309 TTimeIntervalMicroSeconds iDelay;
312 Frame information flags. A combination of the values contained in the TFrameInfoFlags enum.
317 The size of the frame. A frame can occupy a rectangle within the overall image. In this case,
318 the frame size is less than the overall image size.
319 For a GIF image, the following applies:
320 For the first frame of the image, iOverallSizeInPixels will be the greater of the logical screen size
321 and the size of the first frame. The logical screen size is defined in the logical screen descriptor
322 block of the GIF image. If the GIF is animated it will contain a set of frames. The first frame will
323 be full size but subsequent frames are sub-frames and iOverallSizeInPixels may differ for each sub-frame.
325 TSize iOverallSizeInPixels;
328 The display mode for the frame.
330 TDisplayMode iFrameDisplayMode;
333 The background color for the frame.
335 TRgb iBackgroundColor;
338 TInt iFrameDataOffset;
339 TInt iCurrentDataOffset;
340 TFrameInfoState iCurrentFrameState;
344 The size of frame in pixels
346 TSize iFrameSizeInPixels;
351 friend class CImageDecoderPriv;
354 #endif //__ImageData_h__