1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MCCSCREEN_H |
|
21 #define MCCSCREEN_H |
|
22 |
|
23 #include <w32std.h> |
|
24 #include "svptimerobserver.h" |
|
25 |
|
26 class CCamera; |
|
27 class MCameraDirectViewFinder; |
|
28 class CSVPTimer; |
|
29 |
|
30 /** |
|
31 * Screen for viewfinder, may use bitmap viewfinder or direct viewfinder |
|
32 * depending on supported camera vf modes. |
|
33 * |
|
34 */ |
|
35 class CMccScreen : public CBase |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 enum TMccScreenType |
|
41 { |
|
42 EBitmapScreen, |
|
43 EDirectScreen |
|
44 }; |
|
45 |
|
46 public: |
|
47 |
|
48 static CMccScreen* NewL( CCamera* aCamera, |
|
49 TPoint aPos, |
|
50 TSize aArea, |
|
51 TInt aIndex, |
|
52 TInt aWindowOrdinalPosition, |
|
53 TInt aWindowOrdinalPriority, |
|
54 TBool aSecondary, |
|
55 RDrawableWindow* aParentWindow = 0); |
|
56 |
|
57 ~CMccScreen(); |
|
58 |
|
59 |
|
60 |
|
61 public: |
|
62 |
|
63 virtual void StartL(); |
|
64 |
|
65 virtual void Stop(); |
|
66 |
|
67 virtual void Draw( CFbsBitmap& aFrame ); |
|
68 |
|
69 virtual TInt SetCamera( CCamera* aCamera ); |
|
70 |
|
71 void SetPrimaryRectL(TRect aRect); |
|
72 void SetSecondaryRectL(TRect aRect); |
|
73 |
|
74 void Update(TBool aIsForeground); |
|
75 |
|
76 protected: |
|
77 |
|
78 void StopCamera(); |
|
79 |
|
80 TBool VfStartPossible(); |
|
81 |
|
82 void ConstructL(); |
|
83 |
|
84 CMccScreen( TMccScreenType aScreenType, |
|
85 CCamera* aCamera, |
|
86 TPoint aPos, |
|
87 TSize aArea, |
|
88 TInt aIndex, |
|
89 TInt aWindowOrdinalPosition, |
|
90 TInt aWindowOrdinalPriority, |
|
91 TBool aSecondary = EFalse, |
|
92 RDrawableWindow* aParentWindow = 0); |
|
93 |
|
94 protected: |
|
95 |
|
96 CCamera* iCamera; |
|
97 TInt iDeviceIndex; |
|
98 TPoint iPosition; |
|
99 TSize iArea; |
|
100 TInt iWindowOrdinalPosition; |
|
101 TInt iWindowOrdinalPriority; |
|
102 |
|
103 RWsSession iRwSession; |
|
104 RWindowGroup* iRwGroup; |
|
105 RWindow* iRw; |
|
106 CWsScreenDevice* iDev; |
|
107 |
|
108 CWindowGc* iGraphicsContext; |
|
109 |
|
110 TMccScreenType iScreenType; |
|
111 |
|
112 TBool iSecondary; |
|
113 TRect iPrimaryRect; |
|
114 TRect iSecondaryRect; |
|
115 |
|
116 RDrawableWindow* iParentWindow; |
|
117 |
|
118 |
|
119 |
|
120 #ifdef TEST_EUNIT |
|
121 friend class UT_CMccCameraHandler; |
|
122 friend class UT_CMccScreen; |
|
123 #endif |
|
124 |
|
125 }; |
|
126 |
|
127 /** |
|
128 * Bitamp viewfinder screen. Uses DSA to draw vf bitmaps. |
|
129 * |
|
130 */ |
|
131 class CMccScreenBitmap : public CMccScreen, |
|
132 public MDirectScreenAccess, |
|
133 public MSVPTimerObserver |
|
134 { |
|
135 |
|
136 public: |
|
137 |
|
138 static CMccScreenBitmap* NewL( CCamera* aCamera, |
|
139 TPoint aPos, |
|
140 TSize aArea, |
|
141 TInt aIndex, |
|
142 TInt aWindowOrdinalPosition, |
|
143 TInt aWindowOrdinalPriority, |
|
144 TBool aSecondary, |
|
145 RDrawableWindow* aParentWindow = 0); |
|
146 |
|
147 ~CMccScreenBitmap(); |
|
148 |
|
149 public: // From CMccScreen |
|
150 |
|
151 virtual void StartL(); |
|
152 |
|
153 virtual void Stop(); |
|
154 |
|
155 virtual void Draw( CFbsBitmap& aFrame ); |
|
156 |
|
157 void TimedOut( TInt aTimerId ); |
|
158 |
|
159 private: |
|
160 |
|
161 void ConstructL(); |
|
162 |
|
163 CMccScreenBitmap( CCamera* aCamera, |
|
164 TPoint aPos, |
|
165 TSize aArea, |
|
166 TInt aIndex, |
|
167 TInt aWindowOrdinalPosition, |
|
168 TInt aWindowOrdinalPriority, |
|
169 TBool aSecondary, |
|
170 RDrawableWindow* aParentWindow = 0); |
|
171 |
|
172 void Restart( RDirectScreenAccess::TTerminationReasons aReason ); |
|
173 |
|
174 void AbortNow( RDirectScreenAccess::TTerminationReasons aReason ); |
|
175 |
|
176 void StartCameraL(); |
|
177 |
|
178 void StartDsaL(); |
|
179 |
|
180 TPoint UpdateViewFinderArea( TSize aViewFinderImageSize ); |
|
181 |
|
182 void DoDraw( CFbsBitmap& aFrame ); |
|
183 |
|
184 void DoScreenDeviceUpdate(); |
|
185 |
|
186 void AttachFrameL( CFbsBitmap* aFrame ); |
|
187 |
|
188 void DetachFrame(); |
|
189 |
|
190 void StoreFrameDataL( CFbsBitmap& aFrame ); |
|
191 |
|
192 CFbsBitmap* RestoreFrameLC(); |
|
193 |
|
194 void DrawBlackBorders(); |
|
195 |
|
196 private: |
|
197 |
|
198 CDirectScreenAccess* iDirectScreenAccess; |
|
199 CFbsBitGc* iGc; |
|
200 RRegion* iRegion; |
|
201 CFbsScreenDevice* iFbsDev; |
|
202 |
|
203 TRect iViewFinderImageRect; |
|
204 |
|
205 TBool iFirstImageDrawn; |
|
206 |
|
207 CFbsBitmap* iAttachedFrame; |
|
208 |
|
209 TBool iAborted; |
|
210 |
|
211 TSize iPausedFrameSize; |
|
212 TDisplayMode iPausedFrameDisplayMode; |
|
213 HBufC8* iPausedFrameData; |
|
214 |
|
215 TBool iStopped; |
|
216 |
|
217 CSVPTimer* iTimer; |
|
218 |
|
219 |
|
220 #ifdef TEST_EUNIT |
|
221 friend class UT_CMccCameraHandler; |
|
222 friend class UT_CMccScreen; |
|
223 #endif |
|
224 |
|
225 }; |
|
226 |
|
227 /** |
|
228 * Direct viewfinder screen. |
|
229 * |
|
230 */ |
|
231 class CMccScreenDirect : public CMccScreen |
|
232 { |
|
233 |
|
234 public: |
|
235 |
|
236 static CMccScreenDirect* NewL( CCamera* aCamera, |
|
237 TPoint aPos, |
|
238 TSize aArea, |
|
239 TInt aIndex, |
|
240 TInt aWindowOrdinalPosition, |
|
241 TInt aWindowOrdinalPriority ); |
|
242 |
|
243 ~CMccScreenDirect(); |
|
244 |
|
245 |
|
246 |
|
247 public: // From CMccScreen |
|
248 |
|
249 virtual void StartL(); |
|
250 |
|
251 virtual void Stop(); |
|
252 |
|
253 virtual TInt SetCamera( CCamera* aCamera ); |
|
254 |
|
255 private: |
|
256 |
|
257 void ConstructL(); |
|
258 |
|
259 CMccScreenDirect( |
|
260 CCamera* aCamera, |
|
261 TPoint aPos, |
|
262 TSize aArea, |
|
263 TInt aIndex, |
|
264 TInt aWindowOrdinalPosition, |
|
265 TInt aWindowOrdinalPriority ); |
|
266 |
|
267 void StartDirectViewFinderL(); |
|
268 |
|
269 TInt HandleDirectViewFinder(); |
|
270 |
|
271 private: |
|
272 |
|
273 MCameraDirectViewFinder* iDirectViewFinder; |
|
274 |
|
275 #ifdef TEST_EUNIT |
|
276 friend class UT_CMccCameraHandler; |
|
277 friend class UT_CMccScreen; |
|
278 #endif |
|
279 |
|
280 }; |
|
281 |
|
282 #endif |
|