sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "EnhanceFunctionality.h"
|
sl@0
|
17 |
#include "AdvancedSettings.h"
|
sl@0
|
18 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
19 |
#include <ecam/cameraoverlayconst.h>
|
sl@0
|
20 |
#endif
|
sl@0
|
21 |
|
sl@0
|
22 |
CCamHistogram* CCamHistogram::NewL(CCamUnitTestPlugin& aOwner)
|
sl@0
|
23 |
{
|
sl@0
|
24 |
CCamHistogram* self = new (ELeave) CCamHistogram(aOwner);
|
sl@0
|
25 |
CleanupStack::PushL(self);
|
sl@0
|
26 |
self->ConstructL();
|
sl@0
|
27 |
CleanupStack::Pop(self);
|
sl@0
|
28 |
return self;
|
sl@0
|
29 |
}
|
sl@0
|
30 |
|
sl@0
|
31 |
void CCamHistogram::ConstructL()
|
sl@0
|
32 |
{
|
sl@0
|
33 |
iHistograms = new (ELeave) CArrayFixFlat<CHistogram*>(1);
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
CCamHistogram::CCamHistogram(CCamUnitTestPlugin& aOwner):iOwner(aOwner)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
CCamHistogram::~CCamHistogram()
|
sl@0
|
41 |
{
|
sl@0
|
42 |
if(iHistograms != NULL)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
TInt i=0;
|
sl@0
|
45 |
TInt count = iHistograms->Count();
|
sl@0
|
46 |
while(i<count)
|
sl@0
|
47 |
{
|
sl@0
|
48 |
delete iHistograms->At(i);
|
sl@0
|
49 |
i++;
|
sl@0
|
50 |
}
|
sl@0
|
51 |
iHistograms->Reset();
|
sl@0
|
52 |
delete iHistograms;
|
sl@0
|
53 |
iHistograms = NULL;
|
sl@0
|
54 |
}
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
TUint32 CCamHistogram::SupportedHistograms()
|
sl@0
|
58 |
{
|
sl@0
|
59 |
return CCamera::CCameraHistogram::ELuminance;
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
TUint CCamHistogram::PrepareHistogramL(CCamera::CCameraHistogram::THistogramType aType)
|
sl@0
|
63 |
{
|
sl@0
|
64 |
CHistogram* histogram = CHistogram::NewL(EFalse, aType, TPoint(0,0), TSize(0,0), TRgb(0));
|
sl@0
|
65 |
iHistograms->AppendL(histogram);
|
sl@0
|
66 |
TInt temp = iHistograms->Count();
|
sl@0
|
67 |
return --temp;
|
sl@0
|
68 |
}
|
sl@0
|
69 |
|
sl@0
|
70 |
TUint CCamHistogram::PrepareDSAHistogramL(CCamera::CCameraHistogram::THistogramType aType, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
CHistogram* histogram = CHistogram::NewL(ETrue, aType, aPosition, aSize, aColor);
|
sl@0
|
73 |
iHistograms->AppendL(histogram);
|
sl@0
|
74 |
TInt temp = iHistograms->Count();
|
sl@0
|
75 |
return --temp;
|
sl@0
|
76 |
}
|
sl@0
|
77 |
|
sl@0
|
78 |
void CCamHistogram::StartHistogramL(TUint aHistHandle)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
iHistograms->At(aHistHandle)->iActive = ETrue;
|
sl@0
|
81 |
if(iHistograms->At(aHistHandle)->iDSA == EFalse)
|
sl@0
|
82 |
{
|
sl@0
|
83 |
TUid myuid;
|
sl@0
|
84 |
myuid.iUid = KUidECamEventHistogramUidValue;
|
sl@0
|
85 |
iOwner.Notify(myuid,0);
|
sl@0
|
86 |
}
|
sl@0
|
87 |
}
|
sl@0
|
88 |
|
sl@0
|
89 |
void CCamHistogram::StopHistogramL(TUint aHistHandle)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
iHistograms->At(aHistHandle)->iActive = EFalse;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
void CCamHistogram::DestroyHistogramL(TUint aHistHandle)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
delete iHistograms->At(aHistHandle);
|
sl@0
|
97 |
iHistograms->Delete(aHistHandle);
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
void CCamHistogram::Release()
|
sl@0
|
101 |
{
|
sl@0
|
102 |
delete this;
|
sl@0
|
103 |
}
|
sl@0
|
104 |
|
sl@0
|
105 |
void CCamHistogram::GetActiveHistogramsL(RArray<TUint>& /*aActiveHistograms*/)
|
sl@0
|
106 |
{
|
sl@0
|
107 |
//Not implemented
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
void CCamHistogram::UpdateDSAHistogramPropertiesL(TUint aHistHandle, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
iHistograms->At(aHistHandle)->iPosition = aPosition;
|
sl@0
|
113 |
iHistograms->At(aHistHandle)->iSize = aSize;
|
sl@0
|
114 |
iHistograms->At(aHistHandle)->iColor = aColor;
|
sl@0
|
115 |
}
|
sl@0
|
116 |
|
sl@0
|
117 |
void CCamHistogram::GetDSAHistogramPropertiesL(TUint aHistHandle, TPoint& aPosition, TSize& aSize, TRgb& aColor)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
aPosition = iHistograms->At(aHistHandle)->iPosition;
|
sl@0
|
120 |
aSize = iHistograms->At(aHistHandle)->iSize;
|
sl@0
|
121 |
aColor = iHistograms->At(aHistHandle)->iColor;
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
MHistogramBuffer& CCamHistogram::HistogramDataL()
|
sl@0
|
125 |
{
|
sl@0
|
126 |
// not implemented
|
sl@0
|
127 |
TInt a = 10;
|
sl@0
|
128 |
return reinterpret_cast<MHistogramBuffer&> (a);
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
MHistogramBuffer& CCamHistogram::HistogramDataL(TUint /*aHistHandle*/)
|
sl@0
|
132 |
{
|
sl@0
|
133 |
// not implemented
|
sl@0
|
134 |
TInt a = 10;
|
sl@0
|
135 |
return reinterpret_cast<MHistogramBuffer&> (a);
|
sl@0
|
136 |
}
|
sl@0
|
137 |
|
sl@0
|
138 |
/**
|
sl@0
|
139 |
* Defination for CHistogram Class
|
sl@0
|
140 |
*/
|
sl@0
|
141 |
CCamHistogram::CHistogram * CCamHistogram::CHistogram::NewL(TBool aDSA, CCamera::CCameraHistogram::THistogramType aType, TPoint aPosition, TSize aSize, TRgb aColor)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
return new (ELeave) CCamHistogram::CHistogram(aDSA , aType, aPosition, aSize, aColor);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
CCamHistogram::CHistogram::CHistogram(TBool aDSA, CCamera::CCameraHistogram::THistogramType /*aType*/, TPoint aPosition, TSize aSize, TRgb aColor):iDSA(aDSA),iPosition(aPosition),iSize(aSize),iColor(aColor)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
CCamHistogram::CHistogram::~CHistogram()
|
sl@0
|
151 |
{
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
/**
|
sl@0
|
155 |
* For Snapshot
|
sl@0
|
156 |
*///-----------------------------------------------------------------------------------
|
sl@0
|
157 |
|
sl@0
|
158 |
CCamSnapshot* CCamSnapshot::NewL(CCamUnitTestPlugin& aOwner)
|
sl@0
|
159 |
{
|
sl@0
|
160 |
return new (ELeave) CCamSnapshot(aOwner);
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
CCamSnapshot::~CCamSnapshot()
|
sl@0
|
164 |
{
|
sl@0
|
165 |
}
|
sl@0
|
166 |
|
sl@0
|
167 |
CCamSnapshot::CCamSnapshot(CCamUnitTestPlugin& aOwner):iOwner(aOwner)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
TUint32 CCamSnapshot::SupportedFormats()
|
sl@0
|
172 |
{
|
sl@0
|
173 |
// Dummy implementation : Nothing to implement
|
sl@0
|
174 |
return CCamera::EFormatJpeg;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
void CCamSnapshot::PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
// Dummy implementation :
|
sl@0
|
180 |
iFormat = aFormat;
|
sl@0
|
181 |
iPos = aPosition;
|
sl@0
|
182 |
iSize = aSize;
|
sl@0
|
183 |
iBgColor = aBgColor;
|
sl@0
|
184 |
iAspRatio = aMaintainAspectRatio;
|
sl@0
|
185 |
}
|
sl@0
|
186 |
|
sl@0
|
187 |
void CCamSnapshot::PrepareSnapshotL(CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio)
|
sl@0
|
188 |
{
|
sl@0
|
189 |
iFormat = aFormat;
|
sl@0
|
190 |
iSize = aSize;
|
sl@0
|
191 |
iAspRatio = aMaintainAspectRatio;
|
sl@0
|
192 |
}
|
sl@0
|
193 |
|
sl@0
|
194 |
TBool CCamSnapshot::IsSnapshotActive() const
|
sl@0
|
195 |
{
|
sl@0
|
196 |
// Dummy implementation :
|
sl@0
|
197 |
return iActive;
|
sl@0
|
198 |
}
|
sl@0
|
199 |
|
sl@0
|
200 |
void CCamSnapshot::StartSnapshot()
|
sl@0
|
201 |
{
|
sl@0
|
202 |
// Dummy implementation
|
sl@0
|
203 |
iActive = ETrue;
|
sl@0
|
204 |
|
sl@0
|
205 |
TUid myuid;
|
sl@0
|
206 |
myuid.iUid = KUidECamEventSnapshotUidValue;
|
sl@0
|
207 |
iOwner.Notify(myuid,0);
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
void CCamSnapshot::StopSnapshot()
|
sl@0
|
211 |
{
|
sl@0
|
212 |
// Dummy implementation
|
sl@0
|
213 |
iActive = EFalse;
|
sl@0
|
214 |
}
|
sl@0
|
215 |
|
sl@0
|
216 |
MCameraBuffer& CCamSnapshot::SnapshotDataL(RArray<TInt>& aFrameIndexOrder)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
// Dummy implementation :
|
sl@0
|
219 |
aFrameIndexOrder.Append(1);
|
sl@0
|
220 |
TInt temp = 10;
|
sl@0
|
221 |
return reinterpret_cast <MCameraBuffer&> (temp);
|
sl@0
|
222 |
}
|
sl@0
|
223 |
|
sl@0
|
224 |
void CCamSnapshot::SetBgColorL(const TRgb& aBgColor)
|
sl@0
|
225 |
{
|
sl@0
|
226 |
iBgColor = aBgColor;
|
sl@0
|
227 |
if(iBgColor != aBgColor)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
User::Leave(KErrNotSupported);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|
sl@0
|
233 |
void CCamSnapshot::SetPositionL(const TPoint& aPosition)
|
sl@0
|
234 |
{
|
sl@0
|
235 |
iPos = aPosition;
|
sl@0
|
236 |
if(iPos != aPosition)
|
sl@0
|
237 |
{
|
sl@0
|
238 |
User::Leave(KErrNotSupported);
|
sl@0
|
239 |
}
|
sl@0
|
240 |
}
|
sl@0
|
241 |
|
sl@0
|
242 |
void CCamSnapshot::Release()
|
sl@0
|
243 |
{
|
sl@0
|
244 |
delete this;
|
sl@0
|
245 |
}
|
sl@0
|
246 |
|
sl@0
|
247 |
|
sl@0
|
248 |
/**
|
sl@0
|
249 |
* For Overlay
|
sl@0
|
250 |
*/// -----------------------------------------------------------------------------------
|
sl@0
|
251 |
|
sl@0
|
252 |
CCamOverlay* CCamOverlay::NewL(CCamUnitTestPlugin& aOwner)
|
sl@0
|
253 |
{
|
sl@0
|
254 |
CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
|
sl@0
|
255 |
|
sl@0
|
256 |
if(!globalData)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
globalData = new (ELeave) CDataGlobal;
|
sl@0
|
259 |
CleanupStack::PushL(globalData);
|
sl@0
|
260 |
|
sl@0
|
261 |
globalData->iReferenceCount = 0;
|
sl@0
|
262 |
globalData->iCamOverlay = new (ELeave) CCamOverlay(aOwner);
|
sl@0
|
263 |
CleanupStack::PushL(globalData->iCamOverlay);
|
sl@0
|
264 |
globalData->iCamOverlay->ConstructL();
|
sl@0
|
265 |
globalData->iCamOverlay->iRefCount = 1;
|
sl@0
|
266 |
CleanupStack::Pop(globalData->iCamOverlay);
|
sl@0
|
267 |
TInt error = Dll::SetTls(globalData);
|
sl@0
|
268 |
if (error)
|
sl@0
|
269 |
{
|
sl@0
|
270 |
delete globalData->iCamOverlay;
|
sl@0
|
271 |
User::Leave(error);
|
sl@0
|
272 |
}
|
sl@0
|
273 |
CleanupStack::Pop(globalData);
|
sl@0
|
274 |
|
sl@0
|
275 |
return static_cast <CCamOverlay*> (globalData->iCamOverlay);
|
sl@0
|
276 |
}
|
sl@0
|
277 |
else
|
sl@0
|
278 |
{
|
sl@0
|
279 |
CCamOverlay* self = globalData->iCamOverlay;
|
sl@0
|
280 |
|
sl@0
|
281 |
globalData->iReferenceCount++;
|
sl@0
|
282 |
self->iRefCount = globalData->iReferenceCount + 1;
|
sl@0
|
283 |
if (globalData->iReferenceCount == 1 )
|
sl@0
|
284 |
{
|
sl@0
|
285 |
delete globalData;
|
sl@0
|
286 |
Dll::FreeTls();
|
sl@0
|
287 |
}
|
sl@0
|
288 |
else
|
sl@0
|
289 |
{
|
sl@0
|
290 |
TInt error = Dll::SetTls(globalData);
|
sl@0
|
291 |
if (error)
|
sl@0
|
292 |
{
|
sl@0
|
293 |
delete globalData->iCamOverlay;
|
sl@0
|
294 |
User::Leave(error);
|
sl@0
|
295 |
}
|
sl@0
|
296 |
}
|
sl@0
|
297 |
return static_cast <CCamOverlay*> (self);
|
sl@0
|
298 |
}
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
void CCamOverlay::ConstructL()
|
sl@0
|
302 |
{
|
sl@0
|
303 |
iOverlays = new (ELeave) CArrayFixFlat<COverlay*>(1);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
CCamOverlay::CCamOverlay(CCamUnitTestPlugin& aOwner):iOwner(aOwner)
|
sl@0
|
307 |
{
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
CCamOverlay::~CCamOverlay()
|
sl@0
|
311 |
{
|
sl@0
|
312 |
Dll::FreeTls();
|
sl@0
|
313 |
// Dummy implementation
|
sl@0
|
314 |
if(iOverlays != NULL)
|
sl@0
|
315 |
{
|
sl@0
|
316 |
TInt i=0;
|
sl@0
|
317 |
TInt count = iOverlays->Count();
|
sl@0
|
318 |
while(i<count)
|
sl@0
|
319 |
{
|
sl@0
|
320 |
delete iOverlays->At(i);
|
sl@0
|
321 |
i++;
|
sl@0
|
322 |
}
|
sl@0
|
323 |
iOverlays->Reset();
|
sl@0
|
324 |
delete iOverlays;
|
sl@0
|
325 |
iOverlays = NULL;
|
sl@0
|
326 |
}
|
sl@0
|
327 |
}
|
sl@0
|
328 |
|
sl@0
|
329 |
void CCamOverlay::Release()
|
sl@0
|
330 |
{
|
sl@0
|
331 |
iRefCount--;
|
sl@0
|
332 |
if(!iRefCount)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
delete this;
|
sl@0
|
335 |
}
|
sl@0
|
336 |
}
|
sl@0
|
337 |
|
sl@0
|
338 |
TUint CCamOverlay::CreateOverlayL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap)
|
sl@0
|
339 |
{
|
sl@0
|
340 |
// Dummy implementation
|
sl@0
|
341 |
if((aParameters.Size() != sizeof(CCamera::CCameraOverlay::TOverlayParameters )) ||
|
sl@0
|
342 |
aParameters.Version() != KECamOverlayParametersCurrentVersion)
|
sl@0
|
343 |
{
|
sl@0
|
344 |
User::Leave(KErrNotSupported);
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
COverlay* overlay = COverlay::NewL(aParameters, aBitmap);
|
sl@0
|
348 |
overlay->iZOrderReverse = 100 - aParameters.iZOrder;
|
sl@0
|
349 |
iOverlays->AppendL(overlay);
|
sl@0
|
350 |
TInt temp = iOverlays->Count();
|
sl@0
|
351 |
return --temp;
|
sl@0
|
352 |
}
|
sl@0
|
353 |
|
sl@0
|
354 |
void CCamOverlay::SetOverlayBitmapL(TUint aOverlayHandleRef, const CFbsBitmap* aBitmap)
|
sl@0
|
355 |
{
|
sl@0
|
356 |
// Dummy implementation
|
sl@0
|
357 |
iOverlays->At(aOverlayHandleRef)->iBitmap = const_cast<CFbsBitmap*> (aBitmap);
|
sl@0
|
358 |
}
|
sl@0
|
359 |
|
sl@0
|
360 |
void CCamOverlay::GetOverlayBitmapL(TUint aOverlayHandleRef, CFbsBitmap* aBitmap)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
// Dummy implementation
|
sl@0
|
363 |
TSize size = aBitmap->SizeInPixels();
|
sl@0
|
364 |
TDisplayMode dispMode = aBitmap->DisplayMode();
|
sl@0
|
365 |
|
sl@0
|
366 |
User::LeaveIfError(aBitmap->Duplicate(iOverlays->At(aOverlayHandleRef)->iBitmap->Handle()));
|
sl@0
|
367 |
size = aBitmap->SizeInPixels();
|
sl@0
|
368 |
dispMode = aBitmap->DisplayMode();
|
sl@0
|
369 |
}
|
sl@0
|
370 |
|
sl@0
|
371 |
void CCamOverlay::GetOverlayParametersL(TUint aOverlayHandle, CCamera::CCameraOverlay::TOverlayParameters& aInfo)
|
sl@0
|
372 |
{
|
sl@0
|
373 |
// Dummy implementation
|
sl@0
|
374 |
|
sl@0
|
375 |
aInfo.iCurrentModes = iOverlays->At(aOverlayHandle)->iOverlayParms.iCurrentModes;
|
sl@0
|
376 |
aInfo.iCurrentTypes = iOverlays->At(aOverlayHandle)->iOverlayParms.iCurrentTypes;
|
sl@0
|
377 |
aInfo.iAlphaValue = iOverlays->At(aOverlayHandle)->iOverlayParms.iAlphaValue;
|
sl@0
|
378 |
aInfo.iPosition = iOverlays->At(aOverlayHandle)->iOverlayParms.iPosition;
|
sl@0
|
379 |
aInfo.iZOrder = iOverlays->At(aOverlayHandle)->iOverlayParms.iZOrder;
|
sl@0
|
380 |
|
sl@0
|
381 |
}
|
sl@0
|
382 |
|
sl@0
|
383 |
void CCamOverlay::SetOverlayParametersL(TUint aOverlayHandle, const CCamera::CCameraOverlay::TOverlayParameters& aParameters)
|
sl@0
|
384 |
{
|
sl@0
|
385 |
// Dummy implementation
|
sl@0
|
386 |
iOverlays->At(aOverlayHandle)->iOverlayParms.iCurrentModes = aParameters.iCurrentModes;
|
sl@0
|
387 |
iOverlays->At(aOverlayHandle)->iOverlayParms.iCurrentTypes = aParameters.iCurrentTypes;
|
sl@0
|
388 |
iOverlays->At(aOverlayHandle)->iOverlayParms.iAlphaValue = aParameters.iAlphaValue;
|
sl@0
|
389 |
iOverlays->At(aOverlayHandle)->iOverlayParms.iPosition = aParameters.iPosition;
|
sl@0
|
390 |
iOverlays->At(aOverlayHandle)->iOverlayParms.iZOrder = aParameters.iZOrder;
|
sl@0
|
391 |
|
sl@0
|
392 |
iOverlays->At(aOverlayHandle)->iZOrderReverse = 100 - aParameters.iZOrder;
|
sl@0
|
393 |
}
|
sl@0
|
394 |
|
sl@0
|
395 |
void CCamOverlay::ReleaseOverlay(TUint aOverlayHandle)
|
sl@0
|
396 |
{
|
sl@0
|
397 |
// Dummy implementation
|
sl@0
|
398 |
delete iOverlays->At(aOverlayHandle);
|
sl@0
|
399 |
iOverlays->Delete(aOverlayHandle);
|
sl@0
|
400 |
}
|
sl@0
|
401 |
|
sl@0
|
402 |
void CCamOverlay::GetOverlaySupport(CCamera::CCameraOverlay::TOverlaySupportInfo& aInfo)
|
sl@0
|
403 |
{
|
sl@0
|
404 |
// Dummy implementation
|
sl@0
|
405 |
if((aInfo.Size() != sizeof(CCamera::CCameraOverlay::TOverlaySupportInfo )) ||
|
sl@0
|
406 |
aInfo.Version() != KECamOverlaySupportInfoCurrentVersion)
|
sl@0
|
407 |
{
|
sl@0
|
408 |
User::Leave(KErrNotSupported);
|
sl@0
|
409 |
}
|
sl@0
|
410 |
|
sl@0
|
411 |
aInfo.iSupportedModes = (CCamera::CCameraOverlay::EModeStillImageBurst << 1) - 1;
|
sl@0
|
412 |
aInfo.iSupportedTypes = 1;
|
sl@0
|
413 |
aInfo.iPerPlane = CCamera::CCameraOverlay::EBinary;
|
sl@0
|
414 |
aInfo.iPerPixel = CCamera::CCameraOverlay::EBinary;
|
sl@0
|
415 |
aInfo.iCanOverlap = EFalse;
|
sl@0
|
416 |
}
|
sl@0
|
417 |
|
sl@0
|
418 |
void CCamOverlay::GetAllOverlaysInZOrderL(RArray<TUint>& /*aOverlayHandles*/)
|
sl@0
|
419 |
{
|
sl@0
|
420 |
// Dummy implementation
|
sl@0
|
421 |
}
|
sl@0
|
422 |
|
sl@0
|
423 |
void CCamOverlay::SetAllOverlaysInZOrderL(const RArray<TUint>& /*aOverlayHandles*/)
|
sl@0
|
424 |
{
|
sl@0
|
425 |
// Dummy implementation
|
sl@0
|
426 |
}
|
sl@0
|
427 |
|
sl@0
|
428 |
void CCamOverlay::SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
// Dummy implementation
|
sl@0
|
431 |
iOverlays->At(aOverlayHandle)->iBitmap = aBitmap;
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
void CCamOverlay::GetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, RArray<TUint>& aOverlayHandles) const
|
sl@0
|
435 |
{
|
sl@0
|
436 |
// Dummy implementation
|
sl@0
|
437 |
RArray<TInt> overlayFiltered;
|
sl@0
|
438 |
|
sl@0
|
439 |
aOverlayHandles.Reset();
|
sl@0
|
440 |
|
sl@0
|
441 |
// filter overlays for 'aOverlayCameraMode' and aViewFinderHandle (if applicable)
|
sl@0
|
442 |
for(TInt index=0; index<iOverlays->Count(); index++)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
if(iOverlays->At(index)->iOverlayParms.iCurrentModes & aOverlayCameraMode)
|
sl@0
|
445 |
{
|
sl@0
|
446 |
if(aOverlayCameraMode == CCamera::CCameraOverlay::EModeDirectViewfinder || aOverlayCameraMode == CCamera::CCameraOverlay::EModeClientViewfinder)
|
sl@0
|
447 |
{
|
sl@0
|
448 |
if(iOverlays->At(index)->iOverlayParms.iViewFinderHandle == aViewFinderHandle)
|
sl@0
|
449 |
{
|
sl@0
|
450 |
overlayFiltered.AppendL(index);
|
sl@0
|
451 |
}
|
sl@0
|
452 |
}
|
sl@0
|
453 |
else
|
sl@0
|
454 |
{
|
sl@0
|
455 |
overlayFiltered.AppendL(index);
|
sl@0
|
456 |
}
|
sl@0
|
457 |
}
|
sl@0
|
458 |
}
|
sl@0
|
459 |
|
sl@0
|
460 |
TUint zOrderMax = 0;
|
sl@0
|
461 |
TInt maxZOrderHandle =0;
|
sl@0
|
462 |
|
sl@0
|
463 |
while(overlayFiltered.Count())
|
sl@0
|
464 |
{
|
sl@0
|
465 |
zOrderMax = 0;
|
sl@0
|
466 |
maxZOrderHandle =0;
|
sl@0
|
467 |
|
sl@0
|
468 |
//find out max Zorder and the handle of the overlay which has this max z-order
|
sl@0
|
469 |
for(TInt index=0; index<overlayFiltered.Count(); index++)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
if(iOverlays->At(index)->iOverlayParms.iZOrder > zOrderMax)
|
sl@0
|
472 |
{
|
sl@0
|
473 |
zOrderMax = iOverlays->At(index)->iOverlayParms.iZOrder;
|
sl@0
|
474 |
maxZOrderHandle = index;
|
sl@0
|
475 |
}
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
aOverlayHandles.AppendL(maxZOrderHandle);
|
sl@0
|
479 |
overlayFiltered.Remove(maxZOrderHandle);
|
sl@0
|
480 |
}
|
sl@0
|
481 |
|
sl@0
|
482 |
overlayFiltered.Close() ;
|
sl@0
|
483 |
}
|
sl@0
|
484 |
|
sl@0
|
485 |
void CCamOverlay::SetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, const RArray<TUint>& aOverlayHandles)
|
sl@0
|
486 |
{
|
sl@0
|
487 |
//boundary checking
|
sl@0
|
488 |
TBool available = EFalse;
|
sl@0
|
489 |
TInt overlayIndex;
|
sl@0
|
490 |
|
sl@0
|
491 |
for(TInt index=0; index<iOverlays->Count(); index++)
|
sl@0
|
492 |
{
|
sl@0
|
493 |
if(iOverlays->At(index)->iOverlayParms.iCurrentModes & aOverlayCameraMode)
|
sl@0
|
494 |
{
|
sl@0
|
495 |
if(aOverlayCameraMode == CCamera::CCameraOverlay::EModeDirectViewfinder || aOverlayCameraMode == CCamera::CCameraOverlay::EModeClientViewfinder)
|
sl@0
|
496 |
{
|
sl@0
|
497 |
if(iOverlays->At(index)->iOverlayParms.iViewFinderHandle == aViewFinderHandle)
|
sl@0
|
498 |
{
|
sl@0
|
499 |
available = ETrue;
|
sl@0
|
500 |
}
|
sl@0
|
501 |
}
|
sl@0
|
502 |
else
|
sl@0
|
503 |
{
|
sl@0
|
504 |
available = ETrue;
|
sl@0
|
505 |
}
|
sl@0
|
506 |
}
|
sl@0
|
507 |
|
sl@0
|
508 |
overlayIndex = aOverlayHandles.Find(index);
|
sl@0
|
509 |
if(available)
|
sl@0
|
510 |
{
|
sl@0
|
511 |
if(overlayIndex == KErrNotFound)
|
sl@0
|
512 |
{
|
sl@0
|
513 |
User::Leave(KErrArgument);
|
sl@0
|
514 |
}
|
sl@0
|
515 |
}
|
sl@0
|
516 |
else
|
sl@0
|
517 |
{
|
sl@0
|
518 |
if(overlayIndex != KErrNotFound)
|
sl@0
|
519 |
{
|
sl@0
|
520 |
User::Leave(KErrArgument);
|
sl@0
|
521 |
}
|
sl@0
|
522 |
}
|
sl@0
|
523 |
}// boundary checking complete
|
sl@0
|
524 |
|
sl@0
|
525 |
//provide Z order values to aOverlayHandles
|
sl@0
|
526 |
TUint decZorder = 100;
|
sl@0
|
527 |
for(TInt index =0; index<aOverlayHandles.Count(); index++ )
|
sl@0
|
528 |
{
|
sl@0
|
529 |
iOverlays->At(aOverlayHandles[index])->iOverlayParms.iZOrder = decZorder;
|
sl@0
|
530 |
iOverlays->At(aOverlayHandles[index])->iZOrderReverse = 100 - decZorder;
|
sl@0
|
531 |
decZorder--;
|
sl@0
|
532 |
}
|
sl@0
|
533 |
|
sl@0
|
534 |
//setting the overlays in z-order
|
sl@0
|
535 |
TInt offset = _FOFF(CCamOverlay::COverlay, iZOrderReverse);
|
sl@0
|
536 |
TKeyArrayFix key(offset, ECmpTUint);
|
sl@0
|
537 |
User::LeaveIfError(iOverlays->Sort(key));
|
sl@0
|
538 |
}
|
sl@0
|
539 |
|
sl@0
|
540 |
|
sl@0
|
541 |
/**
|
sl@0
|
542 |
* Defination for COverlay Class
|
sl@0
|
543 |
*/
|
sl@0
|
544 |
CCamOverlay::COverlay* CCamOverlay::COverlay::NewL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap)
|
sl@0
|
545 |
{
|
sl@0
|
546 |
CCamOverlay::COverlay* self = new (ELeave) CCamOverlay::COverlay(aParameters, aBitmap);
|
sl@0
|
547 |
CleanupStack::PushL(self);
|
sl@0
|
548 |
self->ConstructL();
|
sl@0
|
549 |
CleanupStack::Pop(self);
|
sl@0
|
550 |
return self;
|
sl@0
|
551 |
}
|
sl@0
|
552 |
|
sl@0
|
553 |
void CCamOverlay::COverlay::ConstructL()
|
sl@0
|
554 |
{
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
CCamOverlay::COverlay::COverlay(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap):iOverlayParms(aParameters), iBitmap(aBitmap)
|
sl@0
|
558 |
{
|
sl@0
|
559 |
}
|
sl@0
|
560 |
|
sl@0
|
561 |
CCamOverlay::COverlay::~COverlay ()
|
sl@0
|
562 |
{
|
sl@0
|
563 |
}
|
sl@0
|
564 |
|