epoc32/include/imageframe.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2005-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@2
     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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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
williamr@2
    17
williamr@2
    18
/**
williamr@2
    19
 @file
williamr@2
    20
 @publishedAll
williamr@2
    21
 @released
williamr@2
    22
*/
williamr@2
    23
williamr@2
    24
#ifndef IMAGEFRAME_H
williamr@2
    25
#define IMAGEFRAME_H
williamr@2
    26
williamr@2
    27
#include <e32std.h>
williamr@2
    28
#include <e32base.h> 
williamr@2
    29
#include <imageframeconst.h>
williamr@2
    30
williamr@2
    31
/** 
williamr@2
    32
The base class for TFrameFormat. Users implement specific frame formats by deriving from this class. 
williamr@2
    33
Symbian provides a particular implementation in the TFrameFormat class.
williamr@2
    34
Each class derived from this class should be identified by a unique UID value, denoting its type.
williamr@2
    35
All subclasses should provide implementations of DuplicateL().
williamr@2
    36
williamr@2
    37
@see TFrameFormat
williamr@2
    38
*/ 
williamr@2
    39
class TFrameFormatBase
williamr@2
    40
	{
williamr@2
    41
public:	
williamr@2
    42
	IMPORT_C TUid Type() const;
williamr@2
    43
	
williamr@2
    44
	/** 
williamr@2
    45
	Creates a duplicate instance of the frame format object on the heap.
williamr@2
    46
	
williamr@2
    47
	@return The pointer to the newly created object cast as class TFrameFormatBase. 
williamr@2
    48
	*/
williamr@2
    49
	virtual TFrameFormatBase* DuplicateL() const=0;
williamr@2
    50
	
williamr@2
    51
protected:
williamr@2
    52
	IMPORT_C explicit TFrameFormatBase(TUid aType);
williamr@2
    53
	
williamr@2
    54
private:
williamr@2
    55
	// reserved for future expansion
williamr@2
    56
	IMPORT_C virtual void Reserved1();
williamr@2
    57
	IMPORT_C virtual void Reserved2();
williamr@2
    58
	IMPORT_C virtual void Reserved3();
williamr@2
    59
	IMPORT_C virtual void Reserved4();
williamr@2
    60
	
williamr@2
    61
private:
williamr@2
    62
	// Format of the specific type holder
williamr@2
    63
	TUid iType; 
williamr@2
    64
		
williamr@2
    65
	// reserved for future expansion
williamr@2
    66
	TInt iReserved1;
williamr@2
    67
	TInt iReserved2;
williamr@2
    68
	TInt iReserved3;
williamr@2
    69
	};
williamr@2
    70
williamr@2
    71
/** 
williamr@2
    72
This class is a specific implementation of TFrameFormatBase. An object of this class provides 
williamr@2
    73
colour space and sampling information based on a specific image format code. 
williamr@2
    74
*/
williamr@2
    75
class TFrameFormat: public TFrameFormatBase
williamr@2
    76
	{
williamr@2
    77
public:	
williamr@2
    78
	IMPORT_C explicit TFrameFormat(TUid aFormatCode);
williamr@2
    79
	IMPORT_C TFrameFormatBase* DuplicateL() const;
williamr@2
    80
	IMPORT_C TUid ColourSpace() const;
williamr@2
    81
	IMPORT_C TUid Sampling() const;
williamr@2
    82
	IMPORT_C TUid FormatCode() const;
williamr@2
    83
williamr@2
    84
	IMPORT_C void SetColourSpace(TUid aColourSpace);	
williamr@2
    85
	
williamr@2
    86
private: 
williamr@2
    87
	// The image frame colour space
williamr@2
    88
	TUid	iColourSpace;
williamr@2
    89
	// The frame sampling 
williamr@2
    90
	TUid 	iSampling;
williamr@2
    91
	// The image frame format code which uniquely identifies all other parameters. */  
williamr@2
    92
	TUid 	iFormatCode; 
williamr@2
    93
	};
williamr@2
    94
williamr@2
    95
/** 
williamr@2
    96
Base class for TFrameLayout. Individual subclasses are identified by their specific UID value.
williamr@2
    97
These classes are used to describe the memory layout of a specific Image Frame. 
williamr@2
    98
*/ 
williamr@2
    99
class TFrameLayoutBase
williamr@2
   100
	{	
williamr@2
   101
public:	
williamr@2
   102
	IMPORT_C TUid Type() const;
williamr@2
   103
	
williamr@2
   104
	/** 
williamr@2
   105
	Creates a duplicate instance of the frame layout object on the heap.
williamr@2
   106
	
williamr@2
   107
	@return The pointer to the newly created object cast as class TFrameLayoutBase. 
williamr@2
   108
	*/
williamr@2
   109
	virtual TFrameLayoutBase* DuplicateL() const=0;
williamr@2
   110
	
williamr@2
   111
protected: 
williamr@2
   112
	IMPORT_C explicit TFrameLayoutBase(TUid aType);
williamr@2
   113
williamr@2
   114
private:
williamr@2
   115
	// reserved for future expansion
williamr@2
   116
	IMPORT_C virtual void Reserved1();
williamr@2
   117
	IMPORT_C virtual void Reserved2();
williamr@2
   118
	IMPORT_C virtual void Reserved3();
williamr@2
   119
	IMPORT_C virtual void Reserved4();
williamr@2
   120
			
williamr@2
   121
private:
williamr@2
   122
	// Layout specific type holder
williamr@2
   123
	TUid iType; 
williamr@2
   124
		
williamr@2
   125
	// Reserved for future expansion
williamr@2
   126
	TInt iReserved1;
williamr@2
   127
	TInt iReserved2;
williamr@2
   128
	TInt iReserved3;
williamr@2
   129
	};
williamr@2
   130
williamr@2
   131
/** 
williamr@2
   132
Class TFrameLayout is a concrete implementation of TFrameLayoutBase class.
williamr@2
   133
It serves as a container for parameters that describe the memory organisation of 
williamr@2
   134
the data encapsulated by a specific CImageFrame object.
williamr@2
   135
Image data is stored in planes. Each plane is characterised by  
williamr@2
   136
the byte offset from the start of the image frame memory, and its maximum size, 
williamr@2
   137
current length and scanlength.
williamr@2
   138
*/	
williamr@2
   139
class TFrameLayout: public TFrameLayoutBase
williamr@2
   140
	{		
williamr@2
   141
 		
williamr@2
   142
public:
williamr@2
   143
	IMPORT_C explicit TFrameLayout(TInt aPlanes);
williamr@2
   144
	IMPORT_C TFrameLayoutBase* DuplicateL() const;	
williamr@2
   145
	
williamr@2
   146
    IMPORT_C TInt Planes() const;
williamr@2
   147
	IMPORT_C TInt Start(TInt aIndex) const;
williamr@2
   148
	IMPORT_C TInt Length(TInt aIndex) const;
williamr@2
   149
	IMPORT_C TInt CurrentLength(TInt aIndex) const;
williamr@2
   150
	IMPORT_C TInt ScanLength(TInt aIndex) const;
williamr@2
   151
	
williamr@2
   152
	IMPORT_C void SetStart(TInt aIndex, TInt aStart);
williamr@2
   153
	IMPORT_C void SetLength(TInt aIndex, TInt aLength );
williamr@2
   154
	IMPORT_C void SetCurrentLength(TInt aIndex, TInt aCurrentLength);
williamr@2
   155
	IMPORT_C void SetScanLength(TInt aIndex, TInt aScanLength);
williamr@2
   156
williamr@2
   157
private:
williamr@2
   158
	// The number of planes in this image. Value < KMaxPlanesInFrame. 
williamr@2
   159
	TInt iPlanes;				   
williamr@2
   160
	// The offset of each plane from the start of the memory referenced by this image frame. 
williamr@2
   161
	TInt iStart[KMaxPlanesInFrame]; 
williamr@2
   162
	// The length of each image plane in bytes.
williamr@2
   163
	TInt iLength[KMaxPlanesInFrame]; 
williamr@2
   164
	// The length of the data stored in each image plane in bytes.
williamr@2
   165
	TInt iCurrentLength[KMaxPlanesInFrame];	
williamr@2
   166
	// The width of the stride for each plane.
williamr@2
   167
	TInt iScanLength[KMaxPlanesInFrame];
williamr@2
   168
	};
williamr@2
   169
williamr@2
   170
/** 
williamr@2
   171
CImageFrame class exposes an API for accessing binary image data in a uniform way.
williamr@2
   172
It is implemented as a wrapper around TDes8 or RChunk objects. 
williamr@2
   173
*/	
williamr@2
   174
class CImageFrame : public CBase 
williamr@2
   175
    {
williamr@2
   176
public:  
williamr@2
   177
    IMPORT_C static CImageFrame* NewL(const TDes8& aBuffer, TInt aMaxBufferSize);
williamr@2
   178
 								  
williamr@2
   179
    IMPORT_C static CImageFrame* NewL(const TDes8& aBuffer,
williamr@2
   180
    								  TInt aMaxBufferSize, 
williamr@2
   181
				 	   				  const TSize& aFrameSize, 
williamr@2
   182
				 					  const TFrameFormatBase& aFrameFormat,
williamr@2
   183
									  const TFrameLayoutBase& aFrameLayout); 
williamr@2
   184
										  
williamr@2
   185
	IMPORT_C static CImageFrame* NewL(const RChunk* aBuffer, 
williamr@2
   186
									  TInt aMaxBufferSize,		
williamr@2
   187
						   			  TInt aDataOffset);
williamr@2
   188
williamr@2
   189
	IMPORT_C static CImageFrame* NewL(const RChunk* aBuffer,
williamr@2
   190
									  TInt aMaxBufferSize, 
williamr@2
   191
								      TInt aDataOffset, 
williamr@2
   192
		 					 	  	  const TSize& aFrameSize,
williamr@2
   193
		 					 	  	  const TFrameFormatBase& aFrameFormat,
williamr@2
   194
		 					 	  	  const TFrameLayoutBase& aFrameLayout); 
williamr@2
   195
    
williamr@2
   196
	IMPORT_C virtual const TFrameFormatBase& FrameFormat() const;	
williamr@2
   197
	IMPORT_C virtual void SetFrameFormatL(const TFrameFormatBase& aFormat);
williamr@2
   198
	
williamr@2
   199
	IMPORT_C virtual const TFrameLayoutBase& FrameLayout() const;	
williamr@2
   200
	IMPORT_C virtual void SetFrameLayoutL(const TFrameLayoutBase& aFrameLayout);
williamr@2
   201
williamr@2
   202
	IMPORT_C virtual const TSize& FrameSizeInPixels() const;	
williamr@2
   203
	IMPORT_C virtual void SetFrameSizeInPixels(const TSize& aFrameSize);
williamr@2
   204
williamr@2
   205
	IMPORT_C virtual TDes8& Data();
williamr@2
   206
	IMPORT_C virtual const TDesC8& Data() const;
williamr@2
   207
	
williamr@2
   208
    IMPORT_C virtual TInt MaxBufferSize() const;
williamr@2
   209
    IMPORT_C virtual TBool IsChunk() const;
williamr@2
   210
williamr@2
   211
	IMPORT_C virtual RChunk& DataChunk();
williamr@2
   212
	IMPORT_C virtual TInt DataOffset() const;
williamr@2
   213
    
williamr@2
   214
    IMPORT_C ~CImageFrame();
williamr@2
   215
	
williamr@2
   216
protected:
williamr@2
   217
	IMPORT_C CImageFrame();
williamr@2
   218
	
williamr@2
   219
    IMPORT_C void ConstructL(const TDes8& aBuffer, TInt aMaxBufferSize);
williamr@2
   220
 								  
williamr@2
   221
    IMPORT_C void ConstructL(const TDes8& aBuffer, 
williamr@2
   222
    						 TInt aMaxBufferSize,
williamr@2
   223
				 	   		 const TSize& aFrameSize, 
williamr@2
   224
				 			 const TFrameFormatBase& aFrameFormat,
williamr@2
   225
							 const TFrameLayoutBase& aFrameLayout); 
williamr@2
   226
										  
williamr@2
   227
	IMPORT_C void ConstructL(const RChunk* aBuffer, 
williamr@2
   228
							 TInt aMaxBufferSize, 
williamr@2
   229
							 TInt aDataOffset);
williamr@2
   230
williamr@2
   231
	IMPORT_C void ConstructL(const RChunk* aBuffer, 
williamr@2
   232
							 TInt aMaxBufferSize,
williamr@2
   233
						  	 TInt aDataOffset, 
williamr@2
   234
 					 	     const TSize& aFrameSize,
williamr@2
   235
 					 	  	 const TFrameFormatBase& aFrameFormat,									
williamr@2
   236
 					 	  	 const TFrameLayoutBase& aFrameLayout); 
williamr@2
   237
williamr@2
   238
private: 					 	  	 
williamr@2
   239
	// for future development
williamr@2
   240
	IMPORT_C virtual void Reserved1();
williamr@2
   241
	IMPORT_C virtual void Reserved2();
williamr@2
   242
	IMPORT_C virtual void Reserved3();
williamr@2
   243
	IMPORT_C virtual void Reserved4();
williamr@2
   244
	
williamr@2
   245
private:
williamr@2
   246
    class CBody; 
williamr@2
   247
    CBody* iBody;
williamr@2
   248
    };
williamr@2
   249
williamr@2
   250
#endif // IMAGEFRAME_H