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