|
1 // Copyright (c) 1996-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 // Interface code for animated DLL's GC |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32std.h> |
|
19 #include "server.h" |
|
20 #include "playbackgc.h" |
|
21 #include "ANIM.H" |
|
22 #include "wsfont.h" |
|
23 #include "bitgditomwsgraphicscontextmappings.h" |
|
24 #include "devicemap.h" |
|
25 |
|
26 CWsAnimGc::CWsAnimGc(CWsAnim& aWsAnim) : iOwningWsAnim(aWsAnim), iUserActive(EFalse), iUseDrawingRegion(EFalse) |
|
27 { |
|
28 __DECLARE_NAME(_S("CWsAnimGc")); |
|
29 } |
|
30 |
|
31 CWsAnimGc::~CWsAnimGc() |
|
32 { |
|
33 iDrawingRegion.Close(); |
|
34 } |
|
35 |
|
36 void CWsAnimGc::Activate(const TRegion* aRegion, MWsGraphicsContext* aGc) |
|
37 { |
|
38 iBaseRegion = aRegion ? aRegion : iOwningWsAnim.ClientWindow()->DrawingRegion(); |
|
39 iGc = aGc; |
|
40 iUserActive = ETrue; |
|
41 Reset(); |
|
42 } |
|
43 |
|
44 void CWsAnimGc::Deactivate() |
|
45 { |
|
46 CloseCurrentFont(); |
|
47 iGc = NULL; |
|
48 iUserActive = EFalse; |
|
49 iUseDrawingRegion = EFalse; |
|
50 iDrawingRegion.Close(); |
|
51 } |
|
52 |
|
53 TBool CWsAnimGc::IsActive() const |
|
54 { |
|
55 return (iUserActive || (iGc != NULL)); |
|
56 } |
|
57 |
|
58 void CWsAnimGc::UserActivate() |
|
59 { |
|
60 if (iUserActive) |
|
61 { |
|
62 // Already active |
|
63 UserDeactivate(); |
|
64 iOwningWsAnim.SessionPanic(); |
|
65 } |
|
66 iUserActive = ETrue; |
|
67 } |
|
68 |
|
69 void CWsAnimGc::UserDeactivate() |
|
70 { |
|
71 CloseCurrentFont(); |
|
72 |
|
73 if (iUserActive) |
|
74 { |
|
75 iUserActive = EFalse; |
|
76 } |
|
77 } |
|
78 |
|
79 CGraphicsDevice* CWsAnimGc::Device() const |
|
80 { |
|
81 if (!iUserActive) |
|
82 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
83 |
|
84 return NULL; //deprecated |
|
85 } |
|
86 |
|
87 void CWsAnimGc::SetClippingRect(const TRect& aRect) |
|
88 { |
|
89 if (!iUserActive) |
|
90 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
91 |
|
92 if (iGc) |
|
93 { |
|
94 iClippingRect = aRect; |
|
95 iClippingRect.Move(iOwningWsAnim.ClientWindow()->Origin()); |
|
96 iClippingRect.Intersection(iOwningWsAnim.ClientWindow()->AbsRect()); |
|
97 |
|
98 STACK_REGION region; |
|
99 region.Copy(*iBaseRegion); |
|
100 if (iUseDrawingRegion) |
|
101 region.Intersect(iDrawingRegion); |
|
102 region.ClipRect(iClippingRect); |
|
103 region.Tidy(); |
|
104 |
|
105 iGc->SetClippingRegion(region); |
|
106 region.Close(); |
|
107 |
|
108 if (iGc->GetError()) |
|
109 iClippingRect = iOwningWsAnim.ClientWindow()->AbsRect(); // On error revert to the default clipping rect |
|
110 } |
|
111 } |
|
112 |
|
113 TInt CWsAnimGc::SetClippingRegion(const TRegion &aRegion) |
|
114 { |
|
115 if (!iUserActive) |
|
116 return KErrGeneral; |
|
117 |
|
118 TInt error = KErrNone; |
|
119 if (iGc) |
|
120 { |
|
121 STACK_REGION region; |
|
122 region.Copy(aRegion); |
|
123 region.Offset(iOwningWsAnim.ClientWindow()->Origin()); |
|
124 region.Intersect(*iBaseRegion); |
|
125 region.ClipRect(iClippingRect); |
|
126 region.Tidy(); |
|
127 |
|
128 iGc->SetClippingRegion(region); |
|
129 region.Close(); |
|
130 |
|
131 error = iGc->GetError(); |
|
132 if (!error) |
|
133 { // Need to keep a copy of the region in screen coordinates |
|
134 iDrawingRegion.Copy(aRegion); |
|
135 iDrawingRegion.Offset(iOwningWsAnim.ClientWindow()->Origin()); |
|
136 iUseDrawingRegion = ETrue; |
|
137 } |
|
138 } |
|
139 return error; |
|
140 } |
|
141 |
|
142 void CWsAnimGc::CancelClippingRegion() |
|
143 { |
|
144 if (!iUserActive) |
|
145 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
146 |
|
147 if (iGc) |
|
148 { |
|
149 iDrawingRegion.Close(); |
|
150 iUseDrawingRegion = EFalse; |
|
151 |
|
152 STACK_REGION region; |
|
153 region.Copy(*iBaseRegion); |
|
154 region.ClipRect(iClippingRect); |
|
155 region.Tidy(); |
|
156 iGc->SetClippingRegion(region); |
|
157 region.Close(); |
|
158 } |
|
159 } |
|
160 |
|
161 void CWsAnimGc::CancelClippingRect() |
|
162 { |
|
163 if (!iUserActive) |
|
164 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
165 |
|
166 if (iGc) |
|
167 { |
|
168 iClippingRect = iOwningWsAnim.ClientWindow()->AbsRect(); // Revert to the default clipping rect |
|
169 |
|
170 STACK_REGION region; |
|
171 region.Copy(*iBaseRegion); |
|
172 if (iUseDrawingRegion) |
|
173 region.Intersect(iDrawingRegion); |
|
174 region.ClipRect(iClippingRect); |
|
175 region.Tidy(); |
|
176 iGc->SetClippingRegion(region); |
|
177 region.Close(); |
|
178 } |
|
179 } |
|
180 |
|
181 void CWsAnimGc::SetDrawMode(TDrawMode aDrawingMode) |
|
182 { |
|
183 if (!iUserActive) |
|
184 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
185 |
|
186 if (iGc) |
|
187 iGc->SetDrawMode(BitGdiToMWsGraphicsContextMappings::LossyConvert(aDrawingMode)); |
|
188 } |
|
189 |
|
190 void CWsAnimGc::UseFont(const CFont *aFont) |
|
191 { |
|
192 CloseCurrentFont(); |
|
193 iFont=(CAnimFbsFont *)aFont; |
|
194 iFont->Open(); |
|
195 if (!iUserActive) |
|
196 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
197 if (iGc) |
|
198 iGc->SetFontNoDuplicate(iFont); |
|
199 } |
|
200 |
|
201 void CWsAnimGc::DiscardFont() |
|
202 { |
|
203 CloseCurrentFont(); |
|
204 if (!iUserActive) |
|
205 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
206 if (iGc) |
|
207 iGc->ResetFont(); |
|
208 } |
|
209 |
|
210 void CWsAnimGc::SetUnderlineStyle(TFontUnderline aUnderlineStyle) |
|
211 { |
|
212 if (!iUserActive) |
|
213 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
214 if (iGc) |
|
215 iGc->SetUnderlineStyle(BitGdiToMWsGraphicsContextMappings::Convert(aUnderlineStyle)); |
|
216 } |
|
217 |
|
218 void CWsAnimGc::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle) |
|
219 { |
|
220 if (!iUserActive) |
|
221 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
222 if (iGc) |
|
223 iGc->SetStrikethroughStyle(BitGdiToMWsGraphicsContextMappings::Convert(aStrikethroughStyle)); |
|
224 } |
|
225 |
|
226 void CWsAnimGc::SetWordJustification(TInt aExcessWidth,TInt aNumGaps) |
|
227 { |
|
228 if (!iUserActive) |
|
229 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
230 if (iGc) |
|
231 iGc->SetWordJustification(aExcessWidth,aNumGaps); |
|
232 } |
|
233 |
|
234 void CWsAnimGc::SetCharJustification(TInt aExcessWidth,TInt aNumChars) |
|
235 { |
|
236 if (!iUserActive) |
|
237 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
238 if (iGc) |
|
239 iGc->SetCharJustification(aExcessWidth,aNumChars); |
|
240 } |
|
241 |
|
242 void CWsAnimGc::SetPenColor(const TRgb &aColor) |
|
243 { |
|
244 if (!iUserActive) |
|
245 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
246 if (iGc) |
|
247 iGc->SetPenColor(aColor); |
|
248 } |
|
249 |
|
250 void CWsAnimGc::SetPenStyle(TPenStyle aPenStyle) |
|
251 { |
|
252 if (!iUserActive) |
|
253 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
254 if (iGc) |
|
255 iGc->SetPenStyle(BitGdiToMWsGraphicsContextMappings::Convert(aPenStyle)); |
|
256 } |
|
257 |
|
258 void CWsAnimGc::SetPenSize(const TSize& aSize) |
|
259 { |
|
260 if (!iUserActive) |
|
261 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
262 if (iGc) |
|
263 iGc->SetPenSize(aSize); |
|
264 } |
|
265 |
|
266 void CWsAnimGc::SetBrushColor(const TRgb &aColor) |
|
267 { |
|
268 if (!iUserActive) |
|
269 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
270 if (iGc) |
|
271 iGc->SetBrushColor(aColor); |
|
272 } |
|
273 |
|
274 void CWsAnimGc::SetBrushStyle(TBrushStyle aBrushStyle) |
|
275 { |
|
276 if (!iUserActive) |
|
277 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
278 if (iGc) |
|
279 iGc->SetBrushStyle(BitGdiToMWsGraphicsContextMappings::Convert(aBrushStyle)); |
|
280 } |
|
281 |
|
282 void CWsAnimGc::SetBrushOrigin(const TPoint &aOrigin) |
|
283 { |
|
284 if (!iUserActive) |
|
285 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
286 if (iGc) |
|
287 iGc->SetBrushOrigin(aOrigin); |
|
288 } |
|
289 |
|
290 void CWsAnimGc::UseBrushPattern(const CFbsBitmap *aBitmap) |
|
291 { |
|
292 if (!iUserActive) |
|
293 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
294 if (iGc) |
|
295 iGc->SetBrushPattern(*aBitmap); |
|
296 } |
|
297 |
|
298 void CWsAnimGc::DiscardBrushPattern() |
|
299 { |
|
300 if (!iUserActive) |
|
301 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
302 if (iGc) |
|
303 iGc->ResetBrushPattern(); |
|
304 } |
|
305 |
|
306 void CWsAnimGc::SetFaded(TBool /*aFaded*/) // Deprecated |
|
307 { |
|
308 if (!iUserActive) |
|
309 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
310 // Do nothing |
|
311 } |
|
312 |
|
313 void CWsAnimGc::SetFadingParameters(TUint8 /*aBlackMap*/,TUint8 /*aWhiteMap*/) // Deprecated |
|
314 { |
|
315 if (!iUserActive) |
|
316 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
317 // Do nothing |
|
318 } |
|
319 |
|
320 // |
|
321 // Drawing commands // |
|
322 // |
|
323 |
|
324 void CWsAnimGc::DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd) |
|
325 { |
|
326 if (!iUserActive) |
|
327 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
328 if (iGc) |
|
329 iGc->DrawArc(aRect,aStart,aEnd); |
|
330 } |
|
331 |
|
332 void CWsAnimGc::DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd) |
|
333 { |
|
334 if (!iUserActive) |
|
335 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
336 if (iGc) |
|
337 iGc->DrawPie(aRect,aStart,aEnd); |
|
338 } |
|
339 |
|
340 void CWsAnimGc::DrawLine(const TPoint &aPoint1,const TPoint &aPoint2) |
|
341 { |
|
342 if (!iUserActive) |
|
343 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
344 if (iGc) |
|
345 iGc->DrawLine(aPoint1, aPoint2); |
|
346 } |
|
347 |
|
348 void CWsAnimGc::DrawLineTo(const TPoint &aPoint) |
|
349 { |
|
350 if (!iUserActive) |
|
351 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
352 if (iGc) |
|
353 iGc->DrawLineTo(aPoint); |
|
354 } |
|
355 |
|
356 void CWsAnimGc::DrawLineBy(const TPoint &aPoint) |
|
357 { |
|
358 if (!iUserActive) |
|
359 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
360 if (iGc) |
|
361 iGc->DrawLineBy(aPoint); |
|
362 } |
|
363 |
|
364 void CWsAnimGc::DrawEllipse(const TRect &aRect) |
|
365 { |
|
366 if (!iUserActive) |
|
367 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
368 if (iGc) |
|
369 iGc->DrawEllipse(aRect); |
|
370 } |
|
371 |
|
372 void CWsAnimGc::DrawRect(const TRect &aRect) |
|
373 { |
|
374 if (!iUserActive) |
|
375 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
376 if (iGc) |
|
377 iGc->DrawRect(aRect); |
|
378 } |
|
379 |
|
380 void CWsAnimGc::DrawRoundRect(const TRect &aRect,const TSize &aCornerSize) |
|
381 { |
|
382 if (!iUserActive) |
|
383 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
384 if (iGc) |
|
385 iGc->DrawRoundRect(aRect, aCornerSize); |
|
386 } |
|
387 |
|
388 void CWsAnimGc::Clear(const TRect &aRect) |
|
389 { |
|
390 if (!iUserActive) |
|
391 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
392 if (iGc) |
|
393 iGc->Clear(aRect); |
|
394 } |
|
395 |
|
396 void CWsAnimGc::Clear() |
|
397 { |
|
398 if (!iUserActive) |
|
399 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
400 if (iGc) |
|
401 iGc->Clear(); |
|
402 } |
|
403 |
|
404 void CWsAnimGc::BitBlt(const TPoint &aPoint,const CFbsBitmap *aBitmap) |
|
405 { |
|
406 if (!iUserActive) |
|
407 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
408 if (iGc) |
|
409 iGc->BitBlt(aPoint, *aBitmap); |
|
410 } |
|
411 |
|
412 void CWsAnimGc::BitBlt(const TPoint &aDestination,const CFbsBitmap *aBitmap,const TRect &aSource) |
|
413 { |
|
414 if (!iUserActive) |
|
415 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
416 if (iGc) |
|
417 iGc->BitBlt(aDestination, *aBitmap, aSource); |
|
418 } |
|
419 |
|
420 void CWsAnimGc::BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask) |
|
421 { |
|
422 if (!iUserActive) |
|
423 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
424 if (iGc) |
|
425 iGc->BitBltMasked(aPoint, *aBitmap, aSourceRect, *aMaskBitmap, aInvertMask); |
|
426 } |
|
427 |
|
428 void CWsAnimGc::DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aSource) |
|
429 { |
|
430 if (!iUserActive) |
|
431 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
432 if (iGc) |
|
433 { |
|
434 // DrawBitmap(TPoint&, ) uses the size of the bitmap in twips, but |
|
435 // MWsGraphicsContext::DrawBitmap() takes a TRect in pixels, so we need to convert |
|
436 TRect destRect(iOwningWsAnim.ClientWindow()->Screen()->DeviceMap().TwipsToPixels(aSource->SizeInTwips())); |
|
437 destRect.Move(aTopLeft); //aTopLeft is defined in pixels, that's why we're not converting it |
|
438 iGc->DrawBitmap(destRect, *aSource); |
|
439 } |
|
440 } |
|
441 |
|
442 void CWsAnimGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource) |
|
443 { |
|
444 if (!iUserActive) |
|
445 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
446 if (iGc) |
|
447 iGc->DrawBitmap(aDestRect, *aSource); |
|
448 } |
|
449 |
|
450 void CWsAnimGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource, const TRect &aSrcRect) |
|
451 { |
|
452 if (!iUserActive) |
|
453 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
454 if (iGc) |
|
455 iGc->DrawBitmap(aDestRect, *aSource, aSrcRect); |
|
456 } |
|
457 |
|
458 void CWsAnimGc::DrawBitmapMasked(const TRect &aDestRect, const CFbsBitmap *aBitmap, const TRect &aSrcRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask) |
|
459 { |
|
460 if (!iUserActive) |
|
461 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
462 if (iGc) |
|
463 iGc->DrawBitmapMasked(aDestRect, *aBitmap, aSrcRect, *aMaskBitmap, aInvertMask); |
|
464 } |
|
465 |
|
466 void CWsAnimGc::DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSrcRect,const CWsBitmap* aMaskBitmap, TBool aInvertMask) |
|
467 { |
|
468 if (!iUserActive) |
|
469 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
470 if (iGc) |
|
471 iGc->DrawBitmapMasked(aDestRect, *aBitmap, aSrcRect, *aMaskBitmap, aInvertMask); |
|
472 } |
|
473 |
|
474 void CWsAnimGc::DrawPolyLine(const TPoint* aPointList,TInt aNumPoints) |
|
475 { |
|
476 if (!iUserActive) |
|
477 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
478 if (iGc) |
|
479 { |
|
480 TArrayWrapper<TPoint> points(aPointList, aNumPoints); |
|
481 iGc->DrawPolyLine(points); |
|
482 } |
|
483 } |
|
484 |
|
485 void CWsAnimGc::DrawPolyLine(const CArrayFix<TPoint> *aPointList) |
|
486 { |
|
487 if (!iUserActive) |
|
488 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
489 if (iGc) |
|
490 iGc->DrawPolyLine(aPointList->Array()); |
|
491 } |
|
492 |
|
493 TInt CWsAnimGc::DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule) |
|
494 { |
|
495 TInt result = KErrGeneral; |
|
496 if (!iUserActive) |
|
497 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
498 if (iGc) |
|
499 { |
|
500 TArrayWrapper<TPoint> pointsArray(aPointList, aNumPoints); |
|
501 iGc->DrawPolygon(pointsArray, BitGdiToMWsGraphicsContextMappings::Convert(aFillRule)); |
|
502 result = iGc->GetError(); |
|
503 } |
|
504 return result; |
|
505 } |
|
506 |
|
507 TInt CWsAnimGc::DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule) |
|
508 { |
|
509 if (!iUserActive) |
|
510 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
511 if(!aPointList) |
|
512 return KErrArgument; |
|
513 TInt result = KErrGeneral; |
|
514 if (iGc) |
|
515 { |
|
516 iGc->DrawPolygon(aPointList->Array(), BitGdiToMWsGraphicsContextMappings::Convert(aFillRule)); |
|
517 result = iGc->GetError(); |
|
518 } |
|
519 return result; |
|
520 } |
|
521 |
|
522 void CWsAnimGc::DrawText(const TDesC &aString,const TPoint &aPosition) |
|
523 { |
|
524 if (!iFont) |
|
525 iOwningWsAnim.Panic(EWservPanicNoFont); |
|
526 if (iGc) |
|
527 iGc->DrawText(aString, NULL, aPosition); |
|
528 } |
|
529 |
|
530 void CWsAnimGc::DrawText(const TDesC &aString,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz,TInt aLeftMrg) |
|
531 { |
|
532 if (!iFont) |
|
533 iOwningWsAnim.Panic(EWservPanicNoFont); |
|
534 if (iGc) |
|
535 iGc->DrawText(aString, NULL, aBox, aBaselineOffset, BitGdiToMWsGraphicsContextMappings::Convert(aHoriz), aLeftMrg); |
|
536 } |
|
537 |
|
538 void CWsAnimGc::MoveTo(const TPoint &aPoint) |
|
539 { |
|
540 if (!iUserActive) |
|
541 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
542 if (iGc) |
|
543 iGc->MoveTo(aPoint); |
|
544 } |
|
545 |
|
546 void CWsAnimGc::MoveBy(const TPoint &aPoint) |
|
547 { |
|
548 if (!iUserActive) |
|
549 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
550 if (iGc) |
|
551 iGc->MoveBy(aPoint); |
|
552 } |
|
553 |
|
554 void CWsAnimGc::Plot(const TPoint &aPoint) |
|
555 { |
|
556 if (!iUserActive) |
|
557 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
558 if (iGc) |
|
559 iGc->Plot(aPoint); |
|
560 } |
|
561 |
|
562 void CWsAnimGc::SetOrigin(const TPoint &aPoint) |
|
563 { |
|
564 if (!iUserActive) |
|
565 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
566 if (iGc) |
|
567 iGc->SetOrigin(iOwningWsAnim.ClientWindow()->Origin() + aPoint); |
|
568 } |
|
569 |
|
570 void CWsAnimGc::CopyRect(const TPoint& aOffset,const TRect& aRect) |
|
571 { |
|
572 if (!iUserActive) |
|
573 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
574 if (iGc) |
|
575 iGc->CopyRect(aOffset, aRect); |
|
576 } |
|
577 |
|
578 void CWsAnimGc::Reset() |
|
579 { |
|
580 CloseCurrentFont(); |
|
581 if (!iUserActive) |
|
582 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
583 if (iGc) |
|
584 iGc->Reset(); |
|
585 SetOrigin(TPoint(0,0)); |
|
586 CancelClippingRect(); |
|
587 CancelClippingRegion(); |
|
588 } |
|
589 |
|
590 void CWsAnimGc::CloseCurrentFont() |
|
591 { |
|
592 if (iFont) |
|
593 { |
|
594 iFont->Close(); |
|
595 iFont=NULL; |
|
596 } |
|
597 } |
|
598 |
|
599 /** |
|
600 @see CBitmapContext::AlphaBlendBitmaps()*/ |
|
601 TInt CWsAnimGc::AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt) |
|
602 { |
|
603 TInt result = KErrGeneral; |
|
604 if (!iUserActive) |
|
605 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
606 if (iGc) |
|
607 { |
|
608 iGc->BitBltMasked(aDestPt, *aSrcBmp, aSrcRect, *aAlphaBmp, aAlphaPt); |
|
609 result = iGc->GetError(); |
|
610 } |
|
611 return result; |
|
612 } |
|
613 |
|
614 /*Body stub implementation. The alternate AlphaBlendBitmap function using CFbsBitmaps should instead be used*/ |
|
615 TInt CWsAnimGc::AlphaBlendBitmaps(const TPoint& /*aDestPt*/, const CWsBitmap* /*aSrcBmp*/, const TRect& /*aSrcRect*/, const CWsBitmap* /*aAlphaBmp*/, const TPoint& /*aAlphaPt*/) |
|
616 { |
|
617 return KErrNone; |
|
618 }; |
|
619 |
|
620 /** |
|
621 @see CGraphicsContext::MapColors()*/ |
|
622 void CWsAnimGc::MapColors(const TRect& /*aRect*/,const TRgb* /*aColors*/,TInt /*aNumPairs*/,TBool /*aMapForwards*/) |
|
623 { |
|
624 if (!iUserActive) |
|
625 iOwningWsAnim.Panic(EWservPanicAnimLeave); |
|
626 } |
|
627 |
|
628 /** |
|
629 @see CGraphicsContext::DrawTextVertical()*/ |
|
630 void CWsAnimGc::DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp) |
|
631 { |
|
632 if (!iFont) |
|
633 iOwningWsAnim.Panic(EWservPanicNoFont); |
|
634 if (iGc) |
|
635 iGc->DrawTextVertical(aText, NULL, aPos, aUp); |
|
636 } |
|
637 |
|
638 /** |
|
639 @see CGraphicsContext::DrawTextVertical()*/ |
|
640 void CWsAnimGc::DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert,TInt aMargin) |
|
641 { |
|
642 if (!iFont) |
|
643 iOwningWsAnim.Panic(EWservPanicNoFont); |
|
644 if (iGc) |
|
645 iGc->DrawTextVertical(aText, NULL, aBox, aBaselineOffset, aUp, BitGdiToMWsGraphicsContextMappings::Convert(aVert), aMargin); |
|
646 } |
|
647 |