|
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 |
|
25 class CCamera; |
|
26 class MCameraDirectViewFinder; |
|
27 |
|
28 /** |
|
29 * Screen for viewfinder, may use bitmap viewfinder or direct viewfinder |
|
30 * depending on supported camera vf modes. |
|
31 * |
|
32 */ |
|
33 class CMccScreen : public CBase |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 enum TMccScreenType |
|
39 { |
|
40 EBitmapScreen, |
|
41 EDirectScreen |
|
42 }; |
|
43 |
|
44 public: |
|
45 |
|
46 static CMccScreen* NewL( CCamera* aCamera, |
|
47 TPoint aPos, |
|
48 TSize aArea, |
|
49 TInt aIndex, |
|
50 TInt aWindowOrdinalPosition, |
|
51 TInt aWindowOrdinalPriority ); |
|
52 |
|
53 ~CMccScreen(); |
|
54 |
|
55 |
|
56 |
|
57 public: |
|
58 |
|
59 virtual void StartL(); |
|
60 |
|
61 virtual void Stop(); |
|
62 |
|
63 virtual void Draw( CFbsBitmap& aFrame ); |
|
64 |
|
65 virtual TInt SetCamera( CCamera* aCamera ); |
|
66 |
|
67 protected: |
|
68 |
|
69 void StopCamera(); |
|
70 |
|
71 TBool VfStartPossible(); |
|
72 |
|
73 void ConstructL(); |
|
74 |
|
75 CMccScreen( TMccScreenType aScreenType, |
|
76 CCamera* aCamera, |
|
77 TPoint aPos, |
|
78 TSize aArea, |
|
79 TInt aIndex, |
|
80 TInt aWindowOrdinalPosition, |
|
81 TInt aWindowOrdinalPriority ); |
|
82 |
|
83 protected: |
|
84 |
|
85 CCamera* iCamera; |
|
86 TInt iDeviceIndex; |
|
87 TPoint iPosition; |
|
88 TSize iArea; |
|
89 TInt iWindowOrdinalPosition; |
|
90 TInt iWindowOrdinalPriority; |
|
91 |
|
92 RWsSession iRwSession; |
|
93 RWindowGroup* iRwGroup; |
|
94 RWindow* iRw; |
|
95 CWsScreenDevice* iDev; |
|
96 |
|
97 CWindowGc* iGraphicsContext; |
|
98 |
|
99 TMccScreenType iScreenType; |
|
100 |
|
101 |
|
102 #ifdef TEST_EUNIT |
|
103 friend class UT_CMccCameraHandler; |
|
104 friend class UT_CMccScreen; |
|
105 #endif |
|
106 |
|
107 }; |
|
108 |
|
109 /** |
|
110 * Bitamp viewfinder screen. Uses DSA to draw vf bitmaps. |
|
111 * |
|
112 */ |
|
113 class CMccScreenBitmap : public CMccScreen, |
|
114 public MDirectScreenAccess |
|
115 { |
|
116 |
|
117 public: |
|
118 |
|
119 static CMccScreenBitmap* NewL( CCamera* aCamera, |
|
120 TPoint aPos, |
|
121 TSize aArea, |
|
122 TInt aIndex, |
|
123 TInt aWindowOrdinalPosition, |
|
124 TInt aWindowOrdinalPriority ); |
|
125 |
|
126 ~CMccScreenBitmap(); |
|
127 |
|
128 public: // From CMccScreen |
|
129 |
|
130 virtual void StartL(); |
|
131 |
|
132 virtual void Stop(); |
|
133 |
|
134 virtual void Draw( CFbsBitmap& aFrame ); |
|
135 |
|
136 private: |
|
137 |
|
138 void ConstructL(); |
|
139 |
|
140 CMccScreenBitmap( CCamera* aCamera, |
|
141 TPoint aPos, |
|
142 TSize aArea, |
|
143 TInt aIndex, |
|
144 TInt aWindowOrdinalPosition, |
|
145 TInt aWindowOrdinalPriority ); |
|
146 |
|
147 void Restart( RDirectScreenAccess::TTerminationReasons aReason ); |
|
148 |
|
149 void AbortNow( RDirectScreenAccess::TTerminationReasons aReason ); |
|
150 |
|
151 void StartCameraL(); |
|
152 |
|
153 void StartDsaL(); |
|
154 |
|
155 TPoint UpdateViewFinderArea( TSize aViewFinderImageSize ); |
|
156 |
|
157 void DoDraw( CFbsBitmap& aFrame ); |
|
158 |
|
159 void DoScreenDeviceUpdate(); |
|
160 |
|
161 void AttachFrameL( CFbsBitmap* aFrame ); |
|
162 |
|
163 void DetachFrame(); |
|
164 |
|
165 void StoreFrameDataL( CFbsBitmap& aFrame ); |
|
166 |
|
167 CFbsBitmap* RestoreFrameLC(); |
|
168 |
|
169 void DrawBlackBorders(); |
|
170 |
|
171 private: |
|
172 |
|
173 CDirectScreenAccess* iDirectScreenAccess; |
|
174 CFbsBitGc* iGc; |
|
175 RRegion* iRegion; |
|
176 CFbsScreenDevice* iFbsDev; |
|
177 |
|
178 TRect iViewFinderImageRect; |
|
179 |
|
180 TBool iFirstImageDrawn; |
|
181 |
|
182 CFbsBitmap* iAttachedFrame; |
|
183 |
|
184 TBool iAborted; |
|
185 |
|
186 TSize iPausedFrameSize; |
|
187 TDisplayMode iPausedFrameDisplayMode; |
|
188 HBufC8* iPausedFrameData; |
|
189 |
|
190 TBool iStopped; |
|
191 |
|
192 #ifdef TEST_EUNIT |
|
193 friend class UT_CMccCameraHandler; |
|
194 friend class UT_CMccScreen; |
|
195 #endif |
|
196 |
|
197 }; |
|
198 |
|
199 /** |
|
200 * Direct viewfinder screen. |
|
201 * |
|
202 */ |
|
203 class CMccScreenDirect : public CMccScreen |
|
204 { |
|
205 |
|
206 public: |
|
207 |
|
208 static CMccScreenDirect* NewL( CCamera* aCamera, |
|
209 TPoint aPos, |
|
210 TSize aArea, |
|
211 TInt aIndex, |
|
212 TInt aWindowOrdinalPosition, |
|
213 TInt aWindowOrdinalPriority ); |
|
214 |
|
215 ~CMccScreenDirect(); |
|
216 |
|
217 |
|
218 |
|
219 public: // From CMccScreen |
|
220 |
|
221 virtual void StartL(); |
|
222 |
|
223 virtual void Stop(); |
|
224 |
|
225 virtual TInt SetCamera( CCamera* aCamera ); |
|
226 |
|
227 private: |
|
228 |
|
229 void ConstructL(); |
|
230 |
|
231 CMccScreenDirect( |
|
232 CCamera* aCamera, |
|
233 TPoint aPos, |
|
234 TSize aArea, |
|
235 TInt aIndex, |
|
236 TInt aWindowOrdinalPosition, |
|
237 TInt aWindowOrdinalPriority ); |
|
238 |
|
239 void StartDirectViewFinderL(); |
|
240 |
|
241 TInt HandleDirectViewFinder(); |
|
242 |
|
243 private: |
|
244 |
|
245 MCameraDirectViewFinder* iDirectViewFinder; |
|
246 |
|
247 #ifdef TEST_EUNIT |
|
248 friend class UT_CMccCameraHandler; |
|
249 friend class UT_CMccScreen; |
|
250 #endif |
|
251 |
|
252 }; |
|
253 |
|
254 #endif |