1.1 --- a/epoc32/include/icl/imagedata.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/icl/imagedata.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,354 @@
1.4 -imagedata.h
1.5 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __ImageData_h__
1.21 +#define __ImageData_h__
1.22 +
1.23 +#include <e32base.h>
1.24 +#include <badesca.h>
1.25 +#include <gdi.h>
1.26 +#include <mm/mmcaf.h>
1.27 +
1.28 +class CFrameImageData;
1.29 +
1.30 +/**
1.31 +@publishedAll
1.32 +@released
1.33 +
1.34 +The abstract base class for all format-specific frame data variants.
1.35 +*/
1.36 +class TFrameDataBlock
1.37 + {
1.38 +public:
1.39 + IMPORT_C TUid DataType() const;
1.40 +
1.41 +protected:
1.42 + IMPORT_C TFrameDataBlock(TUid aDataType);
1.43 + /**
1.44 + Provides a copy of an object that manages a list of frame and image block data,
1.45 + but not a bitwise copy. It provides a new reference to the object.
1.46 + @param aFrameImageData An object that manages a list of frame and image block data
1.47 + */
1.48 + virtual TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const = 0;
1.49 +
1.50 +private:
1.51 + TUid iDataType;
1.52 + TInt iReserved1;
1.53 + TInt iReserved2;
1.54 + TInt iReserved3;
1.55 +
1.56 +friend class CFrameImageData;
1.57 +friend class RTImageDataTest;
1.58 + };
1.59 +
1.60 +/**
1.61 +@publishedAll
1.62 +@released
1.63 +
1.64 +The abstract base class for all format-specific image data variants.
1.65 +*/
1.66 +class TImageDataBlock
1.67 + {
1.68 +public:
1.69 + IMPORT_C TUid DataType() const;
1.70 +
1.71 +protected:
1.72 + IMPORT_C TImageDataBlock(TUid aDataType);
1.73 +
1.74 +private:
1.75 + virtual TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const = 0;
1.76 +
1.77 +private:
1.78 + TUid iDataType;
1.79 + TInt iReserved1;
1.80 + TInt iReserved2;
1.81 + TInt iReserved3;
1.82 +
1.83 +friend class CFrameImageData;
1.84 +friend class RTImageDataTest;
1.85 + };
1.86 +
1.87 +
1.88 +class CImageDataArray;
1.89 +
1.90 +/**
1.91 +@publishedAll
1.92 +@released
1.93 +
1.94 +Class to manage lists of frame and image block data.
1.95 +*/
1.96 +class CFrameImageData : public CBase
1.97 + {
1.98 +public:
1.99 + IMPORT_C static CFrameImageData* NewL();
1.100 + IMPORT_C static CFrameImageData* NewL(CImageDataArray& aImageData, TBool aImageDataOwner = EFalse);
1.101 + IMPORT_C CFrameImageData* AllocL() const;
1.102 + IMPORT_C ~CFrameImageData();
1.103 +
1.104 + // Access fns.
1.105 + // Append/insert/delete
1.106 + IMPORT_C TInt InsertImageData(const TImageDataBlock* aEntry, TInt aPos);
1.107 + IMPORT_C TInt AppendImageData(const TImageDataBlock* aEntry);
1.108 + IMPORT_C void RemoveImageData(TInt aIndex);
1.109 +
1.110 + IMPORT_C TInt InsertFrameData(const TFrameDataBlock* aEntry, TInt aPos);
1.111 + IMPORT_C TInt AppendFrameData(const TFrameDataBlock* aEntry);
1.112 + IMPORT_C void RemoveFrameData(TInt aIndex);
1.113 +
1.114 + // Get local image data.
1.115 + IMPORT_C const TImageDataBlock* GetImageData(TInt aIndex) const;
1.116 + IMPORT_C TImageDataBlock* GetImageData(TInt aIndex);
1.117 +
1.118 + IMPORT_C const TFrameDataBlock* GetFrameData(TInt aIndex) const;
1.119 + IMPORT_C TFrameDataBlock* GetFrameData(TInt aIndex);
1.120 +
1.121 + // Get num entries.
1.122 + IMPORT_C TInt ImageDataCount() const;
1.123 + IMPORT_C TInt FrameDataCount() const;
1.124 +
1.125 + // Append image buffers.
1.126 + IMPORT_C TInt AppendImageBuffer(const HBufC8* aImageBuffer);
1.127 +
1.128 +private:
1.129 + IMPORT_C CFrameImageData(CImageDataArray& aImageData, TBool aImageDataOwner = EFalse);
1.130 + IMPORT_C virtual void Reserved_1();
1.131 + IMPORT_C virtual void Reserved_2();
1.132 + IMPORT_C virtual void Reserved_3();
1.133 + IMPORT_C virtual void Reserved_4();
1.134 +
1.135 +private:
1.136 + // Image data for the frame. (Single frame formats)
1.137 + // Image data that is the same for all frames. (Multi frame formats)
1.138 + CImageDataArray& iImageData;
1.139 + TBool iImageDataOwner;
1.140 +
1.141 + // Image data that is for this frame only. (Multi frame formats only)
1.142 + RPointerArray<TFrameDataBlock> iFrameData;
1.143 +
1.144 + TAny* iReserved;
1.145 + };
1.146 +
1.147 +/**
1.148 +@publishedAll
1.149 +@released
1.150 +
1.151 +Class used to maintain frame information stored in
1.152 +codec specific resource files.
1.153 +*/
1.154 +class CFrameInfoStrings : public CBase
1.155 + {
1.156 +public:
1.157 + IMPORT_C static CFrameInfoStrings* NewL();
1.158 + IMPORT_C static CFrameInfoStrings* NewLC();
1.159 + IMPORT_C ~CFrameInfoStrings();
1.160 +
1.161 + IMPORT_C const TPtrC String(TInt aIndex) const;
1.162 + IMPORT_C TInt Count() const;
1.163 +
1.164 + IMPORT_C const TPtrC Decoder() const;
1.165 + IMPORT_C void SetDecoderL(const TDesC& aString);
1.166 + IMPORT_C const TPtrC Format() const;
1.167 + IMPORT_C void SetFormatL(const TDesC& aString);
1.168 + IMPORT_C const TPtrC Dimensions() const;
1.169 + IMPORT_C void SetDimensionsL(const TDesC& aString);
1.170 + IMPORT_C const TPtrC Depth() const;
1.171 + IMPORT_C void SetDepthL(const TDesC& aString);
1.172 + IMPORT_C const TPtrC Details() const;
1.173 + IMPORT_C void SetDetailsL(const TDesC& aString);
1.174 +
1.175 +private:
1.176 + CFrameInfoStrings();
1.177 + void ConstructL();
1.178 +
1.179 + void SetStringL(TInt aIndex, const TDesC& aString);
1.180 +
1.181 +private:
1.182 +
1.183 + enum TFrameInfoStringIndex
1.184 + {
1.185 + EDecoder = 0,
1.186 + EFormat = 1,
1.187 + EDimensions = 2,
1.188 + EDepth = 3,
1.189 + EDetails = 4
1.190 + };
1.191 +
1.192 + CDesCArray* iFrameInfoStrings;
1.193 + };
1.194 +
1.195 +/**
1.196 +@publishedAll
1.197 +@released
1.198 +
1.199 +General frame info provided by all plugins.
1.200 +*/
1.201 +class TFrameInfo
1.202 + {
1.203 +public:
1.204 + /**
1.205 + Flags that define the attributes of a frame. These can be combined using an OR operation.
1.206 + */
1.207 + enum TFrameInfoFlags
1.208 + {
1.209 + /** Indicates whether or not the frame is colour.
1.210 + */
1.211 + EColor = 0x00000001,
1.212 +
1.213 + /** Indicates if any part of the frame is transparent.
1.214 + */
1.215 + ETransparencyPossible = 0x00000002,
1.216 +
1.217 + /** Indicates whether or not the frame can be scaled.
1.218 + */
1.219 + EFullyScaleable = 0x00000004,
1.220 +
1.221 + /** Indicates whether or not the frame's aspect ratio must be maintained during scaling. If not
1.222 + set, the frame can be stretched.
1.223 + */
1.224 + EConstantAspectRatio = 0x00000008,
1.225 +
1.226 + /** Indicates if the frame can be decoded and drawn dithered. If this is not set, the bitmap
1.227 + must use the recommended display mode.
1.228 + */
1.229 + ECanDither = 0x00000010,
1.230 +
1.231 + /** Indicates if the frame contains alpha-blending information. This setting is only valid if
1.232 + ETransparencyPossible is set.
1.233 + */
1.234 + EAlphaChannel = 0x00000020,
1.235 +
1.236 + /** Mutually exclusive image disposal method 1, no disposal specified. Image is not disposed
1.237 + of and graphic is left in place.
1.238 + */
1.239 + ELeaveInPlace = 0x00000040,
1.240 +
1.241 + /** Mutually exclusive image disposal method 2, restore to background colour. The area used
1.242 + by the graphic must be restored to the background colour.
1.243 + */
1.244 + ERestoreToBackground = 0x00000080,
1.245 +
1.246 + /** Mutually exclusive image disposal method 3, restore to previous. The decoder is required
1.247 + to restore the area overwritten by the graphic with what was there prior to rendering the
1.248 + graphic.
1.249 + */
1.250 + ERestoreToPrevious = 0x00000100,
1.251 +
1.252 + /** If this flag is set and an image convert operation returns KErrUnderFlow, the partially
1.253 + decoded bitmap is not suitable for display.
1.254 + */
1.255 + EPartialDecodeInvalid = 0x00000200,
1.256 +
1.257 + /** This flag is used by Mng decoder to indicate that there are more frames to decode
1.258 + */
1.259 + EMngMoreFramesToDecode = 0x00000400,
1.260 +
1.261 + /** This flag is used to indicate that the code sets iFrameSizeInPixels
1.262 + */
1.263 + EUsesFrameSizeInPixels = 0x00000800
1.264 + };
1.265 +
1.266 + /**
1.267 + Indicates the current status of frame processing.
1.268 + */
1.269 + enum TFrameInfoState
1.270 + {
1.271 + /** The frame information has not been initialised.
1.272 + */
1.273 + EFrameInfoUninitialised,
1.274 +
1.275 + /** The frame header is being processed.
1.276 + */
1.277 + EFrameInfoProcessingFrameHeader,
1.278 +
1.279 + /** The frame is being processed.
1.280 + */
1.281 + EFrameInfoProcessingFrame,
1.282 +
1.283 + /** The frame has been processed.
1.284 + */
1.285 + EFrameInfoProcessingComplete
1.286 + };
1.287 +public:
1.288 + IMPORT_C TFrameInfoState CurrentFrameState() const;
1.289 + IMPORT_C void SetCurrentFrameState(TFrameInfoState aFrameInfoState);
1.290 + IMPORT_C TInt CurrentDataOffset() const;
1.291 + IMPORT_C void SetCurrentDataOffset(TInt aOffset);
1.292 + IMPORT_C TInt FrameDataOffset() const;
1.293 + IMPORT_C void SetFrameDataOffset(TInt aOffset);
1.294 +public:
1.295 + /**
1.296 + The coordinates of the frame within the screen in pixels.
1.297 + */
1.298 + TRect iFrameCoordsInPixels;
1.299 +
1.300 + /**
1.301 + The size of the frame in twips.
1.302 + */
1.303 + TSize iFrameSizeInTwips;
1.304 +
1.305 + /**
1.306 + The number of bits per pixel for the frame.
1.307 + */
1.308 + TInt iBitsPerPixel;
1.309 +
1.310 + /**
1.311 + The delay in microseconds before displaying the next frame.
1.312 + */
1.313 + TTimeIntervalMicroSeconds iDelay;
1.314 +
1.315 + /**
1.316 + Frame information flags. A combination of the values contained in the TFrameInfoFlags enum.
1.317 + */
1.318 + TUint32 iFlags;
1.319 +
1.320 + /**
1.321 + The size of the frame. A frame can occupy a rectangle within the overall image. In this case,
1.322 + the frame size is less than the overall image size.
1.323 + For a GIF image, the following applies:
1.324 + For the first frame of the image, iOverallSizeInPixels will be the greater of the logical screen size
1.325 + and the size of the first frame. The logical screen size is defined in the logical screen descriptor
1.326 + block of the GIF image. If the GIF is animated it will contain a set of frames. The first frame will
1.327 + be full size but subsequent frames are sub-frames and iOverallSizeInPixels may differ for each sub-frame.
1.328 + */
1.329 + TSize iOverallSizeInPixels;
1.330 +
1.331 + /**
1.332 + The display mode for the frame.
1.333 + */
1.334 + TDisplayMode iFrameDisplayMode;
1.335 +
1.336 + /**
1.337 + The background color for the frame.
1.338 + */
1.339 + TRgb iBackgroundColor;
1.340 +
1.341 +private:
1.342 + TInt iFrameDataOffset;
1.343 + TInt iCurrentDataOffset;
1.344 + TFrameInfoState iCurrentFrameState;
1.345 +
1.346 +public:
1.347 + /**
1.348 + The size of frame in pixels
1.349 + */
1.350 + TSize iFrameSizeInPixels;
1.351 +
1.352 +private:
1.353 + TInt iReserved_1;
1.354 +
1.355 +friend class CImageDecoderPriv;
1.356 + };
1.357 +
1.358 +#endif //__ImageData_h__