|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef ENHANCEFUNCTIONALITY_H |
|
17 #define ENHANCEFUNCTIONALITY_H |
|
18 |
|
19 #include <ecam/ecamplugin.h> |
|
20 #include <ecam/ecaminfoplugin.h> |
|
21 |
|
22 #include "ECamUnitTestPlugin.h" |
|
23 #include <fbs.h> |
|
24 |
|
25 #include <ecam/mcamerahistogram.h> |
|
26 #include <ecam/mcameraoverlay.h> |
|
27 #include <ecam/mcamerasnapshot.h> |
|
28 |
|
29 |
|
30 |
|
31 class CCamUnitTestPlugin; |
|
32 |
|
33 class CCamHistogram : public CBase, public MCameraHistogram |
|
34 { |
|
35 class CHistogram; |
|
36 public: |
|
37 static CCamHistogram* NewL(CCamUnitTestPlugin& aOwner); |
|
38 ~CCamHistogram(); |
|
39 TUint32 SupportedHistograms(); |
|
40 TUint PrepareHistogramL(CCamera::CCameraHistogram::THistogramType aType); |
|
41 TUint PrepareDSAHistogramL(CCamera::CCameraHistogram::THistogramType aType, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor); |
|
42 void StartHistogramL(TUint aHistHandle); |
|
43 void StopHistogramL(TUint aHistHandle); |
|
44 void DestroyHistogramL(TUint aHistHandle); |
|
45 void Release(); |
|
46 void GetActiveHistogramsL(RArray<TUint>& aActiveHistograms); |
|
47 void UpdateDSAHistogramPropertiesL(TUint aHistHandle, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor); |
|
48 void GetDSAHistogramPropertiesL(TUint aHistHandle, TPoint& aPosition, TSize& aSize, TRgb& aColor); |
|
49 MHistogramBuffer& HistogramDataL(); |
|
50 MHistogramBuffer& HistogramDataL(TUint aHistHandle); |
|
51 |
|
52 void ConstructL(); |
|
53 |
|
54 private: |
|
55 CCamHistogram(CCamUnitTestPlugin& aOwner); |
|
56 |
|
57 |
|
58 private: |
|
59 CCamUnitTestPlugin& iOwner; |
|
60 |
|
61 TBool iHistActive; |
|
62 TBool iDSAHistActive; |
|
63 |
|
64 TInt iHistogramCount; |
|
65 CArrayFixFlat<CHistogram*>* iHistograms; |
|
66 |
|
67 HBufC* iHistData; |
|
68 }; |
|
69 |
|
70 |
|
71 class CCamHistogram::CHistogram : public CBase |
|
72 { |
|
73 public: |
|
74 static CHistogram* NewL(TBool aDSA, CCamera::CCameraHistogram::THistogramType aType, TPoint aPosition, TSize aSize, TRgb iColor); |
|
75 |
|
76 public: |
|
77 CHistogram(TBool aDSA, CCamera::CCameraHistogram::THistogramType aType, TPoint aPosition, TSize aSize, TRgb iColor); |
|
78 ~CHistogram (); |
|
79 |
|
80 TBool IsActive(); |
|
81 |
|
82 public: |
|
83 TBool iDSA; |
|
84 CCamera::CCameraHistogram::THistogramType iType; |
|
85 TInt iAlpha; |
|
86 TPoint iPosition; |
|
87 TSize iSize; |
|
88 TRgb iColor; |
|
89 |
|
90 TBool iActive; // ETrue is StartHistogramL has been called |
|
91 |
|
92 }; |
|
93 |
|
94 // For Snapshot |
|
95 class CCamSnapshot : public CBase, public MCameraSnapshot |
|
96 { |
|
97 public: |
|
98 static CCamSnapshot* NewL(CCamUnitTestPlugin& aOwner); |
|
99 ~CCamSnapshot(); |
|
100 |
|
101 TUint32 SupportedFormats(); |
|
102 void PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio); |
|
103 void PrepareSnapshotL(CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio); |
|
104 |
|
105 void SetBgColorL(const TRgb& aBgColor); |
|
106 void SetPositionL(const TPoint& aPosition); |
|
107 |
|
108 TBool IsSnapshotActive() const; |
|
109 void StartSnapshot(); |
|
110 void StopSnapshot(); |
|
111 MCameraBuffer& SnapshotDataL(RArray<TInt>& aFrameIndexOrder); |
|
112 void Release(); |
|
113 |
|
114 private: |
|
115 CCamSnapshot(CCamUnitTestPlugin& aOwner); |
|
116 |
|
117 private: |
|
118 CCamUnitTestPlugin& iOwner; |
|
119 |
|
120 CCamera::TFormat iFormat; |
|
121 TSize iSize; |
|
122 TRgb iBgColor; |
|
123 TBool iAspRatio; |
|
124 TPoint iPos; |
|
125 TBool iActive; // ETrue is StartHistogramL has been called |
|
126 }; |
|
127 |
|
128 |
|
129 //For Overlay |
|
130 class CCamOverlay : public CBase, public MCameraOverlay, public MCameraOverlay2 |
|
131 { |
|
132 class COverlay; |
|
133 public: |
|
134 static CCamOverlay* NewL(CCamUnitTestPlugin& aOwner); |
|
135 ~CCamOverlay(); |
|
136 |
|
137 void ConstructL(); |
|
138 |
|
139 //from MCameraOverlay |
|
140 TUint CreateOverlayL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap); |
|
141 void SetOverlayBitmapL(TUint aOverlayHandleRef, const CFbsBitmap* aBitmap); |
|
142 void GetOverlayBitmapL(TUint aOverlayHandleRef, CFbsBitmap* aBitmap); |
|
143 void GetOverlayParametersL(TUint aOverlayHandle, CCamera::CCameraOverlay::TOverlayParameters& aInfo); |
|
144 void SetOverlayParametersL(TUint aOverlayHandle, const CCamera::CCameraOverlay::TOverlayParameters& aParameters); |
|
145 void ReleaseOverlay(TUint aOverlayHandleRef); |
|
146 void Release(); |
|
147 void GetOverlaySupport(CCamera::CCameraOverlay::TOverlaySupportInfo& aInfo); |
|
148 void GetAllOverlaysInZOrderL(RArray<TUint>& aOverlayHandles); |
|
149 void SetAllOverlaysInZOrderL(const RArray<TUint>& aOverlayHandles); |
|
150 |
|
151 //from MCameraOverlay2 |
|
152 void SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap); |
|
153 void GetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, RArray<TUint>& aOverlayHandles) const; |
|
154 void SetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, const RArray<TUint>& aOverlayHandles); |
|
155 |
|
156 private: |
|
157 CCamOverlay(CCamUnitTestPlugin& aOwner); |
|
158 |
|
159 public: |
|
160 TInt iRefCount; |
|
161 |
|
162 private: |
|
163 CCamUnitTestPlugin& iOwner; |
|
164 CArrayFixFlat<COverlay*>* iOverlays; |
|
165 |
|
166 CCamera::CCameraOverlay::TOverlaySupportInfo iSupportInfo; |
|
167 }; |
|
168 |
|
169 class CCamOverlay::COverlay : public CBase |
|
170 { |
|
171 public: |
|
172 static COverlay* NewL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap); |
|
173 |
|
174 public: |
|
175 ~COverlay (); |
|
176 void ConstructL(); |
|
177 |
|
178 private: |
|
179 COverlay(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap); |
|
180 |
|
181 public: |
|
182 CCamera::CCameraOverlay::TOverlayParameters iOverlayParms; |
|
183 CFbsBitmap* iBitmap; // doesn't own |
|
184 TUint iZOrderReverse; //for sorting on z-order |
|
185 }; |
|
186 |
|
187 |
|
188 class RCamSnapshotBuffer : public MCameraBuffer |
|
189 { |
|
190 public: |
|
191 RCamSnapshotBuffer(CFbsBitmap*& aFrame): iAvailable(ETrue), iFrame(aFrame) {} |
|
192 virtual TInt NumFrames() {return 0;} |
|
193 virtual TDesC8* DataL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return NULL; } |
|
194 virtual CFbsBitmap& BitmapL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return *iFrame;} |
|
195 virtual RChunk& ChunkL() { return iChunk;} |
|
196 virtual TInt ChunkOffsetL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0;} |
|
197 virtual TInt FrameSize(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0; } |
|
198 virtual void Release() {iAvailable = ETrue;} |
|
199 |
|
200 public: |
|
201 TBool iAvailable; |
|
202 CFbsBitmap*& iFrame; |
|
203 RChunk iChunk; |
|
204 }; |
|
205 |
|
206 #endif // ENHANCEFUNCTIONALITY_H |