epoc32/include/icl/imagedata.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.
williamr@2
     1
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __ImageData_h__
williamr@2
    17
#define __ImageData_h__
williamr@2
    18
williamr@2
    19
#include <e32base.h>
williamr@2
    20
#include <badesca.h>
williamr@2
    21
#include <gdi.h>
williamr@2
    22
#include <mm/mmcaf.h>
williamr@2
    23
williamr@2
    24
class CFrameImageData;
williamr@2
    25
williamr@2
    26
/**
williamr@2
    27
@publishedAll
williamr@2
    28
@released
williamr@2
    29
williamr@2
    30
The abstract base class for all format-specific frame data variants.
williamr@2
    31
*/
williamr@2
    32
class TFrameDataBlock
williamr@2
    33
	{
williamr@2
    34
public:
williamr@2
    35
	IMPORT_C TUid DataType() const;
williamr@2
    36
williamr@2
    37
protected:
williamr@2
    38
	IMPORT_C TFrameDataBlock(TUid aDataType);
williamr@2
    39
	/**
williamr@2
    40
	Provides a copy of an object that manages a list of frame and image block data,
williamr@2
    41
	but not a bitwise copy. It provides a new reference to the object.
williamr@2
    42
	@param aFrameImageData An object that manages a list of frame and image block data
williamr@2
    43
	*/
williamr@2
    44
	virtual TFrameDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const = 0;
williamr@2
    45
williamr@2
    46
private:
williamr@2
    47
	TUid iDataType;
williamr@2
    48
	TInt iReserved1;
williamr@2
    49
	TInt iReserved2;
williamr@2
    50
	TInt iReserved3;
williamr@2
    51
williamr@2
    52
friend class CFrameImageData;
williamr@2
    53
friend class RTImageDataTest;
williamr@2
    54
	};
williamr@2
    55
williamr@2
    56
/**
williamr@2
    57
@publishedAll
williamr@2
    58
@released
williamr@2
    59
williamr@2
    60
The abstract base class for all format-specific image data variants.
williamr@2
    61
*/
williamr@2
    62
class TImageDataBlock
williamr@2
    63
	{
williamr@2
    64
public:
williamr@2
    65
	IMPORT_C TUid DataType() const;
williamr@2
    66
williamr@2
    67
protected:
williamr@2
    68
	IMPORT_C TImageDataBlock(TUid aDataType);
williamr@2
    69
williamr@2
    70
private:
williamr@2
    71
	virtual TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const = 0;
williamr@2
    72
williamr@2
    73
private:
williamr@2
    74
	TUid iDataType;
williamr@2
    75
	TInt iReserved1;
williamr@2
    76
	TInt iReserved2;
williamr@2
    77
	TInt iReserved3;
williamr@2
    78
williamr@2
    79
friend class CFrameImageData;
williamr@2
    80
friend class RTImageDataTest;
williamr@2
    81
	};
williamr@2
    82
williamr@2
    83
williamr@2
    84
class CImageDataArray;
williamr@2
    85
williamr@2
    86
/**
williamr@2
    87
@publishedAll
williamr@2
    88
@released
williamr@2
    89
williamr@2
    90
Class to manage lists of frame and image block data.
williamr@2
    91
*/
williamr@2
    92
class CFrameImageData : public CBase
williamr@2
    93
	{
williamr@2
    94
public:
williamr@2
    95
	IMPORT_C static CFrameImageData* NewL();
williamr@2
    96
	IMPORT_C static CFrameImageData* NewL(CImageDataArray& aImageData, TBool aImageDataOwner = EFalse);
williamr@2
    97
	IMPORT_C CFrameImageData* AllocL() const;
williamr@2
    98
	IMPORT_C ~CFrameImageData();
williamr@2
    99
williamr@2
   100
	// Access fns.
williamr@2
   101
	// Append/insert/delete
williamr@2
   102
	IMPORT_C TInt InsertImageData(const TImageDataBlock* aEntry, TInt aPos);
williamr@2
   103
	IMPORT_C TInt AppendImageData(const TImageDataBlock* aEntry);
williamr@2
   104
	IMPORT_C void RemoveImageData(TInt aIndex);
williamr@2
   105
williamr@2
   106
	IMPORT_C TInt InsertFrameData(const TFrameDataBlock* aEntry, TInt aPos);
williamr@2
   107
	IMPORT_C TInt AppendFrameData(const TFrameDataBlock* aEntry);
williamr@2
   108
	IMPORT_C void RemoveFrameData(TInt aIndex);
williamr@2
   109
williamr@2
   110
	// Get local image data.
williamr@2
   111
	IMPORT_C const TImageDataBlock* GetImageData(TInt aIndex) const;
williamr@2
   112
	IMPORT_C TImageDataBlock* GetImageData(TInt aIndex);
williamr@2
   113
williamr@2
   114
	IMPORT_C const TFrameDataBlock* GetFrameData(TInt aIndex) const;
williamr@2
   115
	IMPORT_C TFrameDataBlock* GetFrameData(TInt aIndex);
williamr@2
   116
williamr@2
   117
	// Get num entries.
williamr@2
   118
	IMPORT_C TInt ImageDataCount() const;
williamr@2
   119
	IMPORT_C TInt FrameDataCount() const;
williamr@2
   120
williamr@2
   121
	// Append image buffers.
williamr@2
   122
	IMPORT_C TInt AppendImageBuffer(const HBufC8* aImageBuffer);
williamr@2
   123
williamr@2
   124
private:
williamr@4
   125
	CFrameImageData(CImageDataArray& aImageData, TBool aImageDataOwner = EFalse);
williamr@2
   126
	IMPORT_C virtual void Reserved_1();
williamr@2
   127
	IMPORT_C virtual void Reserved_2();
williamr@2
   128
	IMPORT_C virtual void Reserved_3();
williamr@2
   129
	IMPORT_C virtual void Reserved_4();
williamr@2
   130
williamr@2
   131
private:
williamr@2
   132
	// Image data for the frame. (Single frame formats)
williamr@2
   133
	// Image data that is the same for all frames. (Multi frame formats)
williamr@2
   134
	CImageDataArray& iImageData;
williamr@2
   135
	TBool iImageDataOwner;
williamr@2
   136
	
williamr@2
   137
	// Image data that is for this frame only. (Multi frame formats only)
williamr@2
   138
	RPointerArray<TFrameDataBlock> iFrameData;
williamr@2
   139
williamr@2
   140
	TAny* iReserved;
williamr@2
   141
	};
williamr@2
   142
williamr@2
   143
/**
williamr@2
   144
@publishedAll
williamr@2
   145
@released
williamr@2
   146
williamr@2
   147
Class used to maintain frame information stored in
williamr@2
   148
codec specific resource files.
williamr@2
   149
*/
williamr@2
   150
class CFrameInfoStrings : public CBase
williamr@2
   151
	{
williamr@2
   152
public:
williamr@2
   153
	IMPORT_C static CFrameInfoStrings* NewL();
williamr@2
   154
	IMPORT_C static CFrameInfoStrings* NewLC();
williamr@2
   155
	IMPORT_C ~CFrameInfoStrings();
williamr@2
   156
williamr@2
   157
	IMPORT_C const TPtrC String(TInt aIndex) const;
williamr@2
   158
	IMPORT_C TInt Count() const;
williamr@2
   159
williamr@2
   160
	IMPORT_C const TPtrC Decoder() const;
williamr@2
   161
	IMPORT_C void SetDecoderL(const TDesC& aString);
williamr@2
   162
	IMPORT_C const TPtrC Format() const;
williamr@2
   163
	IMPORT_C void SetFormatL(const TDesC& aString);
williamr@2
   164
	IMPORT_C const TPtrC Dimensions() const;
williamr@2
   165
	IMPORT_C void SetDimensionsL(const TDesC& aString);
williamr@2
   166
	IMPORT_C const TPtrC Depth() const;
williamr@2
   167
	IMPORT_C void SetDepthL(const TDesC& aString);
williamr@2
   168
	IMPORT_C const TPtrC Details() const;
williamr@2
   169
	IMPORT_C void SetDetailsL(const TDesC& aString);
williamr@2
   170
williamr@2
   171
private:
williamr@2
   172
	CFrameInfoStrings();
williamr@2
   173
	void ConstructL();
williamr@2
   174
williamr@2
   175
	void SetStringL(TInt aIndex, const TDesC& aString);
williamr@2
   176
williamr@2
   177
private:
williamr@2
   178
williamr@2
   179
	enum TFrameInfoStringIndex
williamr@2
   180
		{
williamr@2
   181
		EDecoder	= 0,
williamr@2
   182
		EFormat		= 1,
williamr@2
   183
		EDimensions = 2,
williamr@2
   184
		EDepth		= 3,
williamr@2
   185
		EDetails	= 4
williamr@2
   186
		};
williamr@2
   187
williamr@2
   188
	CDesCArray* iFrameInfoStrings;
williamr@2
   189
	};
williamr@2
   190
williamr@2
   191
/**
williamr@2
   192
@publishedAll
williamr@2
   193
@released
williamr@2
   194
williamr@2
   195
General frame info provided by all plugins.
williamr@2
   196
*/
williamr@2
   197
class TFrameInfo
williamr@2
   198
	{
williamr@2
   199
public:
williamr@2
   200
	/**
williamr@2
   201
	Flags that define the attributes of a frame. These can be combined using an OR operation.
williamr@2
   202
	*/
williamr@2
   203
	enum TFrameInfoFlags
williamr@2
   204
		{
williamr@2
   205
		/** Indicates whether or not the frame is colour.
williamr@2
   206
		*/
williamr@2
   207
		EColor					= 0x00000001,
williamr@2
   208
williamr@2
   209
		/** Indicates if any part of the frame is transparent.
williamr@2
   210
		*/
williamr@2
   211
		ETransparencyPossible	= 0x00000002,
williamr@2
   212
williamr@2
   213
		/** Indicates whether or not the frame can be scaled.
williamr@2
   214
		*/
williamr@2
   215
		EFullyScaleable			= 0x00000004,
williamr@2
   216
williamr@2
   217
		/** Indicates whether or not the frame's aspect ratio must be maintained during scaling. If not
williamr@2
   218
		set, the frame can be stretched.
williamr@2
   219
		*/
williamr@2
   220
		EConstantAspectRatio	= 0x00000008,
williamr@2
   221
williamr@2
   222
		/** Indicates if the frame can be decoded and drawn dithered. If this is not set, the bitmap
williamr@2
   223
		must use the recommended display mode. 
williamr@2
   224
		*/
williamr@2
   225
		ECanDither				= 0x00000010,
williamr@2
   226
williamr@2
   227
		/** Indicates if the frame contains alpha-blending information. This setting is only valid if
williamr@2
   228
		ETransparencyPossible is set.
williamr@2
   229
		*/
williamr@2
   230
		EAlphaChannel			= 0x00000020,
williamr@2
   231
williamr@2
   232
		/** Mutually exclusive image disposal method 1, no disposal specified. Image is not disposed
williamr@2
   233
		of and graphic is left in place.
williamr@2
   234
		*/
williamr@2
   235
		ELeaveInPlace			= 0x00000040,
williamr@2
   236
williamr@2
   237
		/** Mutually exclusive image disposal method 2, restore to background colour. The area used
williamr@2
   238
		by the graphic must be restored to the background colour.
williamr@2
   239
		*/
williamr@2
   240
		ERestoreToBackground	= 0x00000080,
williamr@2
   241
williamr@2
   242
		/** Mutually exclusive image disposal method 3, restore to previous. The decoder is required
williamr@2
   243
		to restore the area overwritten by the graphic with what was there prior to rendering the
williamr@2
   244
		graphic.
williamr@2
   245
		*/
williamr@2
   246
		ERestoreToPrevious		= 0x00000100,
williamr@2
   247
williamr@2
   248
		/** If this flag is set and an image convert operation returns KErrUnderFlow, the partially
williamr@2
   249
		decoded bitmap is not suitable for display.
williamr@2
   250
		*/
williamr@2
   251
		EPartialDecodeInvalid   = 0x00000200,
williamr@2
   252
williamr@2
   253
		/** This flag is used by Mng decoder to indicate that there are more frames to decode
williamr@2
   254
		*/
williamr@2
   255
		EMngMoreFramesToDecode   = 0x00000400,
williamr@2
   256
		
williamr@2
   257
		/** This flag is used to indicate that the code sets iFrameSizeInPixels
williamr@2
   258
		*/
williamr@2
   259
		EUsesFrameSizeInPixels = 0x00000800
williamr@2
   260
		};
williamr@2
   261
williamr@2
   262
	/**
williamr@2
   263
	Indicates the current status of frame processing.
williamr@2
   264
	*/
williamr@2
   265
	enum TFrameInfoState
williamr@2
   266
		{
williamr@2
   267
		/** The frame information has not been initialised.
williamr@2
   268
		*/
williamr@2
   269
		EFrameInfoUninitialised,
williamr@2
   270
williamr@2
   271
		/** The frame header is being processed.
williamr@2
   272
		*/
williamr@2
   273
		EFrameInfoProcessingFrameHeader,
williamr@2
   274
williamr@2
   275
		/** The frame is being processed.
williamr@2
   276
		*/
williamr@2
   277
		EFrameInfoProcessingFrame,
williamr@2
   278
williamr@2
   279
		/** The frame has been processed.
williamr@2
   280
		*/
williamr@2
   281
		EFrameInfoProcessingComplete
williamr@2
   282
		};
williamr@2
   283
public:
williamr@2
   284
	IMPORT_C TFrameInfoState CurrentFrameState() const;
williamr@2
   285
	IMPORT_C void SetCurrentFrameState(TFrameInfoState aFrameInfoState);
williamr@2
   286
	IMPORT_C TInt CurrentDataOffset() const;
williamr@2
   287
	IMPORT_C void SetCurrentDataOffset(TInt aOffset);
williamr@2
   288
	IMPORT_C TInt FrameDataOffset() const;
williamr@2
   289
	IMPORT_C void SetFrameDataOffset(TInt aOffset);
williamr@2
   290
public:
williamr@2
   291
	/**
williamr@2
   292
	The coordinates of the frame within the screen in pixels.
williamr@2
   293
	*/
williamr@2
   294
	TRect iFrameCoordsInPixels;
williamr@2
   295
williamr@2
   296
	/**
williamr@2
   297
	The size of the frame in twips.
williamr@2
   298
	*/
williamr@2
   299
	TSize iFrameSizeInTwips;
williamr@2
   300
williamr@2
   301
	/**
williamr@2
   302
	The number of bits per pixel for the frame.
williamr@2
   303
	*/
williamr@2
   304
	TInt iBitsPerPixel;
williamr@2
   305
williamr@2
   306
	/**
williamr@2
   307
	The delay in microseconds before displaying the next frame.
williamr@2
   308
	*/
williamr@2
   309
	TTimeIntervalMicroSeconds iDelay;
williamr@2
   310
williamr@2
   311
	/**
williamr@2
   312
	Frame information flags. A combination of the values contained in the TFrameInfoFlags enum.
williamr@2
   313
	*/
williamr@2
   314
	TUint32 iFlags;
williamr@2
   315
williamr@2
   316
	/**
williamr@2
   317
	The size of the frame. A frame can occupy a rectangle within the overall image. In this case, 
williamr@2
   318
	the frame size is less than the overall image size.
williamr@2
   319
	For a GIF image, the following applies:
williamr@2
   320
	For the first frame of the image, iOverallSizeInPixels will be the greater of the logical screen size 
williamr@2
   321
	and the size of the first frame. The logical screen size is defined in the logical screen descriptor 
williamr@2
   322
	block of the GIF image. If the GIF is animated it will contain a set of frames. The first frame will 
williamr@2
   323
	be full size but subsequent frames are sub-frames and iOverallSizeInPixels may differ for each sub-frame.
williamr@2
   324
	*/
williamr@2
   325
	TSize iOverallSizeInPixels;
williamr@2
   326
williamr@2
   327
	/**
williamr@2
   328
	The display mode for the frame.
williamr@2
   329
	*/
williamr@2
   330
	TDisplayMode iFrameDisplayMode;
williamr@2
   331
williamr@2
   332
	/**
williamr@2
   333
	The background color for the frame.
williamr@2
   334
	*/
williamr@2
   335
	TRgb iBackgroundColor;
williamr@2
   336
williamr@2
   337
private:	
williamr@2
   338
	TInt iFrameDataOffset;
williamr@2
   339
	TInt iCurrentDataOffset;
williamr@2
   340
	TFrameInfoState iCurrentFrameState;
williamr@2
   341
	
williamr@2
   342
public:
williamr@2
   343
	/**
williamr@2
   344
	The size of frame in pixels
williamr@2
   345
	*/
williamr@2
   346
	TSize iFrameSizeInPixels;
williamr@2
   347
williamr@2
   348
private:
williamr@2
   349
	TInt iReserved_1;
williamr@2
   350
williamr@2
   351
friend class CImageDecoderPriv;
williamr@2
   352
	};
williamr@2
   353
williamr@2
   354
#endif //__ImageData_h__