|
1 // Copyright (c) 1997-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 #include <metafile.h> |
|
17 #include <bitdev.h> |
|
18 #include <fbs.h> |
|
19 |
|
20 NONSHARABLE_CLASS(CFontStack) : public CBase |
|
21 { |
|
22 protected: |
|
23 CFontStack(CGraphicsDevice* aDevice); |
|
24 public: |
|
25 static CFontStack* NewL(CGraphicsDevice* aDevice); |
|
26 ~CFontStack(); |
|
27 void AddFontL(CFont* aFont); |
|
28 private: |
|
29 CGraphicsDevice* iDevice; |
|
30 CArrayPtrFlat<CFont>* iFontList; |
|
31 }; |
|
32 |
|
33 CFontStack::CFontStack(CGraphicsDevice* aDevice): |
|
34 iDevice(aDevice), |
|
35 iFontList(NULL) |
|
36 { |
|
37 __DECLARE_NAME(_S("CFontStack")); |
|
38 } |
|
39 |
|
40 CFontStack* CFontStack::NewL(CGraphicsDevice* aDevice) |
|
41 { |
|
42 CFontStack* fontstack=new(ELeave) CFontStack(aDevice); |
|
43 CleanupStack::PushL(fontstack); |
|
44 fontstack->iFontList=new(ELeave) CArrayPtrFlat<CFont>(8); |
|
45 CleanupStack::Pop(); |
|
46 return fontstack; |
|
47 } |
|
48 |
|
49 CFontStack::~CFontStack() |
|
50 { |
|
51 if (iFontList) |
|
52 { |
|
53 TInt count=iFontList->Count(); |
|
54 for (TInt i=0; i<count; i++) |
|
55 iDevice->ReleaseFont((*iFontList)[i]); |
|
56 delete iFontList; |
|
57 } |
|
58 } |
|
59 |
|
60 void CFontStack::AddFontL(CFont* aFont) |
|
61 { |
|
62 TRAPD(ret,iFontList->AppendL(aFont)); |
|
63 if (ret!=KErrNone) |
|
64 { |
|
65 iDevice->ReleaseFont(aFont); |
|
66 User::Leave(ret); |
|
67 } |
|
68 } |
|
69 |
|
70 enum TGraphicsContextCommandCode |
|
71 { |
|
72 EUseGc, // Not gc command |
|
73 EEndOfStream, |
|
74 |
|
75 ESetOrigin, |
|
76 ESetDrawMode, |
|
77 ESetClippingRect, |
|
78 ECancelClippingRect, |
|
79 EReset, |
|
80 EUseFont, |
|
81 EDiscardFont, |
|
82 ESetUnderlineStyle, |
|
83 ESetStrikethroughStyle, |
|
84 ESetWordJustification, |
|
85 ESetCharJustification, |
|
86 ESetPenColor, |
|
87 ESetPenStyle, |
|
88 ESetPenSize, |
|
89 ESetBrushColor, |
|
90 ESetBrushStyle, |
|
91 ESetBrushOrigin, |
|
92 EUseBrushPattern, |
|
93 EDiscardBrushPattern, |
|
94 EMoveTo, |
|
95 EMoveBy, |
|
96 EPlot, |
|
97 EDrawArc, |
|
98 EDrawLine, |
|
99 EDrawLineTo, |
|
100 EDrawLineBy, |
|
101 EDrawPolyLine1, |
|
102 EDrawPolyLine2, |
|
103 EDrawPie, |
|
104 EDrawEllipse, |
|
105 EDrawRect, |
|
106 EDrawRoundRect, |
|
107 EDrawPolygon1, |
|
108 EDrawPolygon2, |
|
109 EDrawBitmap1, |
|
110 EDrawBitmap2, |
|
111 EDrawBitmap3, |
|
112 EDrawText1, |
|
113 EDrawText2 |
|
114 }; |
|
115 |
|
116 inline RWriteStream& operator<<(RWriteStream& aStream,TGraphicsContextCommandCode aCommandCode) |
|
117 { |
|
118 aStream.WriteUint8L(TUint8(aCommandCode)); |
|
119 return aStream; |
|
120 } |
|
121 |
|
122 EXPORT_C CMetafileDevice::CMetafileDevice(CGraphicsDevice* aDevice): |
|
123 CGraphicsDevice(), |
|
124 iGcCount(0), |
|
125 iGcIndex(-1), |
|
126 iRealDevice(aDevice), |
|
127 iWriteStream(NULL) |
|
128 { |
|
129 __DECLARE_NAME(_S("CMetafileDevice")); |
|
130 } |
|
131 |
|
132 EXPORT_C CMetafileDevice* CMetafileDevice::NewL(CGraphicsDevice* aDevice) |
|
133 { |
|
134 CMetafileDevice* device=new(ELeave) CMetafileDevice(aDevice); |
|
135 return device; |
|
136 } |
|
137 |
|
138 EXPORT_C CMetafileDevice::~CMetafileDevice() |
|
139 { |
|
140 } |
|
141 |
|
142 EXPORT_C TInt CMetafileDevice::HorizontalTwipsToPixels(TInt aTwips) const |
|
143 { |
|
144 return iRealDevice->HorizontalTwipsToPixels(aTwips); |
|
145 } |
|
146 |
|
147 EXPORT_C TInt CMetafileDevice::VerticalTwipsToPixels(TInt aTwips) const |
|
148 { |
|
149 return iRealDevice->VerticalTwipsToPixels(aTwips); |
|
150 } |
|
151 |
|
152 EXPORT_C TInt CMetafileDevice::HorizontalPixelsToTwips(TInt aPixels) const |
|
153 { |
|
154 return iRealDevice->HorizontalPixelsToTwips(aPixels); |
|
155 } |
|
156 |
|
157 EXPORT_C TInt CMetafileDevice::VerticalPixelsToTwips(TInt aPixels) const |
|
158 { |
|
159 return iRealDevice->VerticalPixelsToTwips(aPixels); |
|
160 } |
|
161 |
|
162 EXPORT_C TInt CMetafileDevice::GetNearestFontInTwips(CFont*& aFont,const TFontSpec& aFontSpec) |
|
163 { |
|
164 return GetNearestFontToDesignHeightInTwips(aFont, aFontSpec); |
|
165 } |
|
166 |
|
167 EXPORT_C TInt CMetafileDevice::GetNearestFontToDesignHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec) |
|
168 { |
|
169 return iRealDevice->GetNearestFontToDesignHeightInTwips(aFont,aFontSpec); |
|
170 } |
|
171 |
|
172 EXPORT_C TInt CMetafileDevice::GetNearestFontToMaxHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec, TInt aMaxHeight) |
|
173 { |
|
174 return iRealDevice->GetNearestFontToMaxHeightInTwips(aFont, aFontSpec, aMaxHeight); |
|
175 } |
|
176 |
|
177 EXPORT_C void CMetafileDevice::ReleaseFont(CFont* aFont) |
|
178 { |
|
179 iRealDevice->ReleaseFont(aFont); |
|
180 } |
|
181 |
|
182 EXPORT_C TDisplayMode CMetafileDevice::DisplayMode() const |
|
183 { |
|
184 return iRealDevice->DisplayMode(); |
|
185 } |
|
186 |
|
187 EXPORT_C TSize CMetafileDevice::SizeInPixels() const |
|
188 { |
|
189 return iRealDevice->SizeInPixels(); |
|
190 } |
|
191 |
|
192 EXPORT_C TSize CMetafileDevice::SizeInTwips() const |
|
193 { |
|
194 return iRealDevice->SizeInTwips(); |
|
195 } |
|
196 |
|
197 EXPORT_C TInt CMetafileDevice::CreateContext(CGraphicsContext*& aGC) |
|
198 { |
|
199 CMetafileGc* gc=new CMetafileGc(this,iGcCount); |
|
200 if (!gc) |
|
201 return KErrNoMemory; |
|
202 iGcCount++; |
|
203 aGC=gc; |
|
204 return KErrNone; |
|
205 } |
|
206 |
|
207 EXPORT_C TInt CMetafileDevice::NumTypefaces() const |
|
208 { |
|
209 return iRealDevice->NumTypefaces(); |
|
210 } |
|
211 |
|
212 EXPORT_C void CMetafileDevice::TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const |
|
213 { |
|
214 iRealDevice->TypefaceSupport(aTypefaceSupport,aTypefaceIndex); |
|
215 } |
|
216 |
|
217 EXPORT_C TInt CMetafileDevice::FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const |
|
218 { |
|
219 return iRealDevice->FontHeightInTwips(aTypefaceIndex,aHeightIndex); |
|
220 } |
|
221 |
|
222 EXPORT_C void CMetafileDevice::PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const |
|
223 { |
|
224 iRealDevice->PaletteAttributes(aModifiable,aNumEntries); |
|
225 } |
|
226 |
|
227 EXPORT_C void CMetafileDevice::SetPalette(CPalette* aPalette) |
|
228 { |
|
229 iRealDevice->SetPalette(aPalette); |
|
230 } |
|
231 |
|
232 EXPORT_C TInt CMetafileDevice::GetPalette(CPalette*& aPalette) const |
|
233 { |
|
234 return iRealDevice->GetPalette(aPalette); |
|
235 } |
|
236 |
|
237 EXPORT_C void CMetafileDevice::UseGcL(TInt aGcIndex) |
|
238 { |
|
239 if (iGcIndex!=aGcIndex) |
|
240 { |
|
241 iGcIndex=aGcIndex; |
|
242 *iWriteStream << EUseGc; |
|
243 iWriteStream->WriteInt32L(iGcIndex); |
|
244 } |
|
245 } |
|
246 |
|
247 EXPORT_C void CMetafileDevice::StartOutputStreamL(RWriteStream& aStream) // Returns error code |
|
248 { |
|
249 iWriteStream=&aStream; |
|
250 TSize size(HorizontalPixelsToTwips(1000),VerticalPixelsToTwips(1000)); |
|
251 *iWriteStream << size; |
|
252 } |
|
253 |
|
254 EXPORT_C void CMetafileDevice::EndOfStreamL() // Returns error code |
|
255 { |
|
256 *iWriteStream << EEndOfStream; |
|
257 } |
|
258 |
|
259 EXPORT_C RWriteStream& CMetafileDevice::WriteStream() |
|
260 { |
|
261 return *iWriteStream; |
|
262 } |
|
263 |
|
264 EXPORT_C CMetafileGc::CMetafileGc(CMetafileDevice* aDevice,TInt anIndex): |
|
265 CGraphicsContext(), |
|
266 iDevice(aDevice), |
|
267 iIndex(anIndex) |
|
268 { |
|
269 } |
|
270 |
|
271 EXPORT_C CMetafileGc::~CMetafileGc() |
|
272 { |
|
273 } |
|
274 |
|
275 EXPORT_C CGraphicsDevice* CMetafileGc::Device() const |
|
276 { |
|
277 return iDevice; |
|
278 } |
|
279 |
|
280 EXPORT_C void CMetafileGc::SetOrigin(const TPoint& aPos) |
|
281 { |
|
282 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
283 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
284 iDevice->WriteStream() << ESetOrigin; |
|
285 iDevice->WriteStream() << aPos; |
|
286 } |
|
287 |
|
288 EXPORT_C void CMetafileGc::SetDrawMode(TDrawMode aDrawingMode) |
|
289 { |
|
290 TInt errCode = 0; |
|
291 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
292 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
293 iDevice->WriteStream() << ESetDrawMode; |
|
294 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aDrawingMode)); |
|
295 } |
|
296 |
|
297 EXPORT_C void CMetafileGc::SetClippingRect(const TRect& aRect) |
|
298 { |
|
299 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
300 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
301 iDevice->WriteStream() << ESetClippingRect; |
|
302 iDevice->WriteStream() << aRect; |
|
303 } |
|
304 |
|
305 EXPORT_C void CMetafileGc::CancelClippingRect() |
|
306 { |
|
307 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
308 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
309 iDevice->WriteStream() << ECancelClippingRect; |
|
310 } |
|
311 |
|
312 EXPORT_C void CMetafileGc::Reset() |
|
313 { |
|
314 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
315 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
316 iDevice->WriteStream() << EReset; |
|
317 } |
|
318 |
|
319 EXPORT_C void CMetafileGc::UseFont(const CFont* aFont) |
|
320 { |
|
321 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
322 TInt errCode = 0; |
|
323 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
324 iDevice->WriteStream() << EUseFont; |
|
325 iDevice->WriteStream() << aFont->FontSpecInTwips(); |
|
326 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aFont->HeightInPixels())); |
|
327 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aFont->BaselineOffsetInPixels())); |
|
328 } |
|
329 |
|
330 EXPORT_C void CMetafileGc::DiscardFont() |
|
331 { |
|
332 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
333 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
334 iDevice->WriteStream() << EDiscardFont; |
|
335 } |
|
336 |
|
337 EXPORT_C void CMetafileGc::SetUnderlineStyle(TFontUnderline aUnderlineStyle) |
|
338 { |
|
339 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
340 TInt errCode = 0; |
|
341 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
342 iDevice->WriteStream() << ESetUnderlineStyle; |
|
343 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aUnderlineStyle)); |
|
344 } |
|
345 |
|
346 EXPORT_C void CMetafileGc::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle) |
|
347 { |
|
348 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
349 TInt errCode = 0; |
|
350 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
351 iDevice->WriteStream() << ESetStrikethroughStyle; |
|
352 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aStrikethroughStyle)); |
|
353 } |
|
354 |
|
355 EXPORT_C void CMetafileGc::SetWordJustification(TInt aExcessWidth,TInt aNumGaps) |
|
356 { |
|
357 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
358 TInt errCode = 0; |
|
359 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
360 iDevice->WriteStream() << ESetWordJustification; |
|
361 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aExcessWidth)); |
|
362 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aNumGaps)); |
|
363 } |
|
364 |
|
365 EXPORT_C void CMetafileGc::SetCharJustification(TInt aExcessWidth,TInt aNumChars) |
|
366 { |
|
367 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
368 TInt errCode = 0; |
|
369 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
370 iDevice->WriteStream() << ESetCharJustification; |
|
371 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aExcessWidth)); |
|
372 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aNumChars)); |
|
373 } |
|
374 |
|
375 EXPORT_C void CMetafileGc::SetPenColor(const TRgb& aColor) |
|
376 { |
|
377 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
378 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
379 iDevice->WriteStream() << ESetPenColor; |
|
380 iDevice->WriteStream() << aColor; |
|
381 } |
|
382 |
|
383 EXPORT_C void CMetafileGc::SetPenStyle(TPenStyle aPenStyle) |
|
384 { |
|
385 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
386 TInt errCode = 0; |
|
387 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
388 iDevice->WriteStream() << ESetPenStyle; |
|
389 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aPenStyle)); |
|
390 } |
|
391 |
|
392 EXPORT_C void CMetafileGc::SetPenSize(const TSize& aSize) |
|
393 { |
|
394 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
395 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
396 iDevice->WriteStream() << ESetPenSize; |
|
397 iDevice->WriteStream() << aSize; |
|
398 } |
|
399 |
|
400 EXPORT_C void CMetafileGc::SetBrushColor(const TRgb& aColor) |
|
401 { |
|
402 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
403 TRAP_IGNORE( iDevice->UseGcL(iIndex)); |
|
404 iDevice->WriteStream() << ESetBrushColor; |
|
405 iDevice->WriteStream() << aColor; |
|
406 } |
|
407 |
|
408 EXPORT_C void CMetafileGc::SetBrushStyle(TBrushStyle aBrushStyle) |
|
409 { |
|
410 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
411 TInt errCode = 0; |
|
412 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
413 iDevice->WriteStream() << ESetBrushStyle; |
|
414 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aBrushStyle)); |
|
415 } |
|
416 |
|
417 EXPORT_C void CMetafileGc::SetBrushOrigin(const TPoint& aOrigin) |
|
418 { |
|
419 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
420 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
421 iDevice->WriteStream() << ESetBrushOrigin; |
|
422 iDevice->WriteStream() << aOrigin; |
|
423 } |
|
424 |
|
425 EXPORT_C void CMetafileGc::UseBrushPattern(const CFbsBitmap* aBitmap) |
|
426 { |
|
427 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
428 TInt errCode = 0; |
|
429 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
430 iDevice->WriteStream() << EUseBrushPattern; |
|
431 TRAP(errCode, aBitmap->ExternalizeL(iDevice->WriteStream())); |
|
432 } |
|
433 |
|
434 EXPORT_C void CMetafileGc::DiscardBrushPattern() |
|
435 { |
|
436 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
437 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
438 iDevice->WriteStream() << EDiscardBrushPattern; |
|
439 } |
|
440 |
|
441 EXPORT_C void CMetafileGc::MoveTo(const TPoint& aPoint) |
|
442 { |
|
443 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
444 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
445 iDevice->WriteStream() << EMoveTo; |
|
446 iDevice->WriteStream() << aPoint; |
|
447 } |
|
448 |
|
449 EXPORT_C void CMetafileGc::MoveBy(const TPoint& aVector) |
|
450 { |
|
451 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
452 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
453 iDevice->WriteStream() << EMoveBy; |
|
454 iDevice->WriteStream() << aVector; |
|
455 } |
|
456 |
|
457 EXPORT_C void CMetafileGc::Plot(const TPoint& aPoint) |
|
458 { |
|
459 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
460 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
461 iDevice->WriteStream() << EPlot; |
|
462 iDevice->WriteStream() << aPoint; |
|
463 } |
|
464 |
|
465 EXPORT_C void CMetafileGc::DrawArc(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd) |
|
466 { |
|
467 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
468 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
469 iDevice->WriteStream() << EDrawArc; |
|
470 iDevice->WriteStream() << aRect; |
|
471 iDevice->WriteStream() << aStart; |
|
472 iDevice->WriteStream() << aEnd; |
|
473 } |
|
474 |
|
475 EXPORT_C void CMetafileGc::DrawLine(const TPoint& aPoint1,const TPoint& aPoint2) |
|
476 { |
|
477 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
478 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
479 iDevice->WriteStream() << EDrawLine; |
|
480 iDevice->WriteStream() << aPoint1; |
|
481 iDevice->WriteStream() << aPoint2; |
|
482 } |
|
483 |
|
484 EXPORT_C void CMetafileGc::DrawLineTo(const TPoint& aPoint) |
|
485 { |
|
486 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
487 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
488 iDevice->WriteStream() << EDrawLineTo; |
|
489 iDevice->WriteStream() << aPoint; |
|
490 } |
|
491 |
|
492 EXPORT_C void CMetafileGc::DrawLineBy(const TPoint& aVector) |
|
493 { |
|
494 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
495 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
496 iDevice->WriteStream() << EDrawLineBy; |
|
497 iDevice->WriteStream() << aVector; |
|
498 } |
|
499 |
|
500 EXPORT_C void CMetafileGc::DrawPolyLine(const CArrayFix<TPoint>* aPointList) |
|
501 { |
|
502 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
503 TInt errCode = 0; |
|
504 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
505 iDevice->WriteStream() << EDrawPolyLine1; |
|
506 |
|
507 TInt numpoints=aPointList->Count(); |
|
508 TRAP(errCode, iDevice->WriteStream().WriteInt32L(numpoints)); |
|
509 for (TInt i=0; i<numpoints; i++) |
|
510 iDevice->WriteStream() << (*aPointList)[i]; |
|
511 } |
|
512 |
|
513 EXPORT_C void CMetafileGc::DrawPolyLine(const TPoint* aPointList,TInt aNumPoints) |
|
514 { |
|
515 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
516 TInt errCode = 0; |
|
517 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
518 iDevice->WriteStream() << EDrawPolyLine2; |
|
519 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aNumPoints)); |
|
520 TPoint *p=(TPoint*) aPointList,*pEnd=p+aNumPoints; |
|
521 for (; p<pEnd; p++) |
|
522 iDevice->WriteStream() << *p; |
|
523 } |
|
524 |
|
525 EXPORT_C void CMetafileGc::DrawPie(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd) |
|
526 { |
|
527 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
528 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
529 iDevice->WriteStream() << EDrawPie; |
|
530 iDevice->WriteStream() << aRect; |
|
531 iDevice->WriteStream() << aStart; |
|
532 iDevice->WriteStream() << aEnd; |
|
533 } |
|
534 |
|
535 EXPORT_C void CMetafileGc::DrawEllipse(const TRect& aRect) |
|
536 { |
|
537 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
538 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
539 iDevice->WriteStream() << EDrawEllipse; |
|
540 iDevice->WriteStream() << aRect; |
|
541 } |
|
542 |
|
543 EXPORT_C void CMetafileGc::DrawRect(const TRect& aRect) |
|
544 { |
|
545 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
546 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
547 iDevice->WriteStream() << EDrawRect; |
|
548 iDevice->WriteStream() << aRect; |
|
549 } |
|
550 |
|
551 EXPORT_C void CMetafileGc::DrawRoundRect(const TRect& aRect,const TSize& aCornerSize) |
|
552 { |
|
553 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
554 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
555 iDevice->WriteStream() << EDrawRoundRect; |
|
556 iDevice->WriteStream() << aRect; |
|
557 iDevice->WriteStream() << aCornerSize; |
|
558 } |
|
559 |
|
560 EXPORT_C TInt CMetafileGc::DrawPolygon(const CArrayFix<TPoint>* aPointList,TFillRule aFillRule) |
|
561 { |
|
562 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
563 TInt errCode = 0; |
|
564 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
565 iDevice->WriteStream() << EDrawPolygon1; |
|
566 TInt numpoints=aPointList->Count(); |
|
567 TRAP(errCode, iDevice->WriteStream().WriteInt32L(numpoints)); |
|
568 for (TInt i=0; i<numpoints; i++) |
|
569 iDevice->WriteStream() << (*aPointList)[i]; |
|
570 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aFillRule)); |
|
571 return KErrNone; |
|
572 } |
|
573 |
|
574 EXPORT_C TInt CMetafileGc::DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule) |
|
575 { |
|
576 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
577 TInt errCode = 0; |
|
578 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
579 iDevice->WriteStream() << EDrawPolygon2; |
|
580 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aNumPoints)); |
|
581 TPoint *p=(TPoint*) aPointList,*pEnd=p+aNumPoints; |
|
582 for (; p<pEnd; p++) |
|
583 iDevice->WriteStream() << *p; |
|
584 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aFillRule)); |
|
585 return KErrNone; |
|
586 } |
|
587 |
|
588 EXPORT_C void CMetafileGc::DrawBitmap(const TPoint& aTopLeft,const CFbsBitmap* aSource) |
|
589 { |
|
590 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
591 TInt errCode = 0; |
|
592 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
593 iDevice->WriteStream() << EDrawBitmap1; |
|
594 iDevice->WriteStream() << aTopLeft; |
|
595 TRAP(errCode, ExternalizeBitmapL(aSource)); |
|
596 } |
|
597 |
|
598 EXPORT_C void CMetafileGc::DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource) |
|
599 { |
|
600 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
601 TInt errCode = 0; |
|
602 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
603 iDevice->WriteStream() << EDrawBitmap2; |
|
604 iDevice->WriteStream() << aDestRect; |
|
605 TRAP(errCode, ExternalizeBitmapL(aSource)); |
|
606 } |
|
607 |
|
608 EXPORT_C void CMetafileGc::DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource,const TRect& aSourceRect) |
|
609 { |
|
610 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
611 TInt errCode = 0; |
|
612 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
613 iDevice->WriteStream() << EDrawBitmap3; |
|
614 iDevice->WriteStream() << aDestRect; |
|
615 TRAP(errCode, ExternalizeBitmapL(aSource)); |
|
616 iDevice->WriteStream() << aSourceRect; |
|
617 } |
|
618 |
|
619 EXPORT_C void CMetafileGc::DrawBitmapMasked(const TRect& /*aDestRect*/,const CFbsBitmap* /*aBitmap*/,const TRect& /*aSourceRect*/,const CFbsBitmap* /*aMaskBitmap*/,TBool /*aInvertMask*/) |
|
620 {} |
|
621 |
|
622 EXPORT_C void CMetafileGc::DrawBitmapMasked(const TRect& /*aDestRect*/,const CWsBitmap* /*aBitmap*/,const TRect& /*aSourceRect*/,const CWsBitmap* /*aMaskBitmap*/,TBool /*aInvertMask*/) |
|
623 {} |
|
624 |
|
625 EXPORT_C void CMetafileGc::MapColors(const TRect& /*aRect*/,const TRgb* /*aColors*/,TInt /*aNumPairs*/,TBool /*aMapForwards*/) |
|
626 {} |
|
627 |
|
628 EXPORT_C TInt CMetafileGc::SetClippingRegion(const TRegion &/*aRegion*/) |
|
629 { |
|
630 return KErrNone; |
|
631 } |
|
632 |
|
633 EXPORT_C void CMetafileGc::CancelClippingRegion() |
|
634 {} |
|
635 |
|
636 EXPORT_C void CMetafileGc::DrawTextVertical(const TDesC& /*aText*/,const TPoint& /*aPos*/,TBool /*aUp*/) |
|
637 {} |
|
638 |
|
639 EXPORT_C void CMetafileGc::DrawTextVertical(const TDesC& /*aText*/,const TRect& /*aBox*/,TInt /*aBaselineOffset*/,TBool /*aUp*/,TTextAlign /*aVert*/,TInt /*aMargin*/) |
|
640 {} |
|
641 |
|
642 EXPORT_C TInt CMetafileGc::AlphaBlendBitmaps(const TPoint& /*aDestPt*/, const CFbsBitmap* /*aSrcBmp*/, const TRect& /*aSrcRect*/, const CFbsBitmap* /*aAlphaBmp*/, const TPoint& /*aAlphaPt*/) |
|
643 { |
|
644 return KErrNone; |
|
645 } |
|
646 |
|
647 EXPORT_C TInt CMetafileGc::AlphaBlendBitmaps(const TPoint& /*aDestPt*/, const CWsBitmap* /*aSrcBmp*/, const TRect& /*aSrcRect*/, const CWsBitmap* /*aAlphaBmp*/, const TPoint& /*aAlphaPt*/) |
|
648 { |
|
649 return KErrNone; |
|
650 } |
|
651 |
|
652 |
|
653 EXPORT_C void CMetafileGc::DrawText(const TDesC& aString,const TPoint& aPosition) |
|
654 { |
|
655 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
656 TRAP_IGNORE(iDevice->UseGcL(iIndex)); |
|
657 iDevice->WriteStream() << EDrawText1; |
|
658 iDevice->WriteStream() << aString; |
|
659 iDevice->WriteStream() << aPosition; |
|
660 } |
|
661 |
|
662 EXPORT_C void CMetafileGc::DrawText(const TDesC& aString,const TRect& aBox,TInt aBaselineOffset,TTextAlign aHoriz,TInt aLeftMrg) |
|
663 { |
|
664 // TRAP and ignore the ERROR code due to this beeing a non-leaving method |
|
665 TInt errCode = 0; |
|
666 TRAP(errCode, iDevice->UseGcL(iIndex)); |
|
667 iDevice->WriteStream() << EDrawText2; |
|
668 iDevice->WriteStream() << aString; |
|
669 iDevice->WriteStream() << aBox; |
|
670 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aBaselineOffset)); |
|
671 TRAP(errCode, iDevice->WriteStream().WriteUint8L((TUint8) aHoriz)); |
|
672 TRAP(errCode, iDevice->WriteStream().WriteInt32L(aLeftMrg)); |
|
673 } |
|
674 |
|
675 void CMetafileGc::ExternalizeBitmapL(const CFbsBitmap* aSource) |
|
676 { |
|
677 CFbsBitmap* bitmap=new(ELeave) CFbsBitmap; |
|
678 CleanupStack::PushL(bitmap); |
|
679 User::LeaveIfError(bitmap->Create(aSource->SizeInPixels(),iDevice->DisplayMode())); |
|
680 CFbsBitmapDevice* bitmapdevice=CFbsBitmapDevice::NewL(bitmap); |
|
681 CleanupStack::PushL(bitmapdevice); |
|
682 CFbsBitGc* gc; |
|
683 User::LeaveIfError(bitmapdevice->CreateContext((CGraphicsContext*&) gc)); |
|
684 CleanupStack::PushL(gc); |
|
685 gc->BitBlt(TPoint(0,0),aSource); |
|
686 bitmap->ExternalizeL(iDevice->WriteStream()); |
|
687 CleanupStack::PopAndDestroy(3); |
|
688 } |
|
689 |
|
690 EXPORT_C CMetafilePlayback::CMetafilePlayback(CGraphicsDevice* aDevice): |
|
691 iDevice(aDevice) |
|
692 { |
|
693 __DECLARE_NAME(_S("CMetafilePlayback")); |
|
694 } |
|
695 |
|
696 EXPORT_C CMetafilePlayback* CMetafilePlayback::NewL(CGraphicsDevice* aDevice) |
|
697 { |
|
698 CMetafilePlayback* playback=new(ELeave) CMetafilePlayback(aDevice); |
|
699 return playback; |
|
700 } |
|
701 |
|
702 EXPORT_C CMetafilePlayback::~CMetafilePlayback() |
|
703 { |
|
704 } |
|
705 |
|
706 |
|
707 EXPORT_C void CMetafilePlayback::DrawL(RReadStream& aReadStream) |
|
708 { |
|
709 CArrayPtrFlat<CGraphicsContext>* gclist=new(ELeave) CArrayPtrFlat<CGraphicsContext>(8); |
|
710 CleanupStack::PushL(gclist); |
|
711 CFontStack* fontstack = CFontStack::NewL(iDevice); |
|
712 CleanupStack::PushL(fontstack); |
|
713 CArrayFixFlat<TPoint>* pointlist=new(ELeave) CArrayFixFlat<TPoint>(8); |
|
714 CleanupStack::PushL(pointlist); |
|
715 CFbsBitmap* bitmap=new(ELeave) CFbsBitmap; |
|
716 CleanupStack::PushL(bitmap); |
|
717 TSize kpixelsizeintwips; |
|
718 aReadStream >> kpixelsizeintwips; |
|
719 TGraphicsContextCommandCode code; |
|
720 TInt gcindex=0; |
|
721 do |
|
722 { |
|
723 code = (TGraphicsContextCommandCode) aReadStream.ReadUint8L(); |
|
724 switch (code) |
|
725 { |
|
726 case EUseGc: |
|
727 { |
|
728 TInt gcindex=aReadStream.ReadInt32L(); |
|
729 if (gcindex>=gclist->Count()) |
|
730 { |
|
731 for (TInt i=gclist->Count(); i<=gcindex; i++) |
|
732 { |
|
733 CGraphicsContext* gc; |
|
734 User::LeaveIfError(iDevice->CreateContext(gc)); |
|
735 CleanupStack::PushL(gc); |
|
736 gclist->AppendL(gc); |
|
737 } |
|
738 } |
|
739 |
|
740 break; |
|
741 } |
|
742 case EEndOfStream: |
|
743 { |
|
744 break; |
|
745 } |
|
746 case ESetOrigin: |
|
747 { |
|
748 TPoint pos; |
|
749 aReadStream >> pos; |
|
750 (*gclist)[gcindex]->SetOrigin(pos); |
|
751 break; |
|
752 } |
|
753 case ESetDrawMode: |
|
754 { |
|
755 CGraphicsContext::TDrawMode drawingmode; |
|
756 drawingmode = (CGraphicsContext::TDrawMode) aReadStream.ReadUint8L(); |
|
757 (*gclist)[gcindex]->SetDrawMode(drawingmode); |
|
758 break; |
|
759 } |
|
760 case ESetClippingRect: |
|
761 { |
|
762 TRect rect; |
|
763 aReadStream >> rect; |
|
764 (*gclist)[gcindex]->SetClippingRect(rect); |
|
765 break; |
|
766 } |
|
767 case ECancelClippingRect: |
|
768 { |
|
769 (*gclist)[gcindex]->CancelClippingRect(); |
|
770 break; |
|
771 } |
|
772 case EReset: |
|
773 { |
|
774 (*gclist)[gcindex]->CancelClippingRect(); |
|
775 break; |
|
776 } |
|
777 case EUseFont: |
|
778 { |
|
779 TFontSpec spec; |
|
780 aReadStream >> spec; |
|
781 aReadStream.ReadInt32L(); // height in pixels |
|
782 aReadStream.ReadInt32L(); // baseline offset in pixels |
|
783 spec.iHeight=((spec.iHeight*iDevice->VerticalPixelsToTwips(1000))+(kpixelsizeintwips.iHeight/2))/kpixelsizeintwips.iHeight; |
|
784 CFont* font; |
|
785 User::LeaveIfError(iDevice->GetNearestFontToDesignHeightInTwips(font,spec)); |
|
786 fontstack->AddFontL(font); |
|
787 (*gclist)[gcindex]->UseFont(font); |
|
788 break; |
|
789 } |
|
790 case EDiscardFont: |
|
791 { |
|
792 (*gclist)[gcindex]->DiscardFont(); |
|
793 break; |
|
794 } |
|
795 case ESetUnderlineStyle: |
|
796 { |
|
797 TFontUnderline underlinestyle; |
|
798 underlinestyle = (TFontUnderline) aReadStream.ReadUint8L(); |
|
799 (*gclist)[gcindex]->SetUnderlineStyle(underlinestyle); |
|
800 break; |
|
801 } |
|
802 case ESetStrikethroughStyle: |
|
803 { |
|
804 TFontStrikethrough strikethroughstyle; |
|
805 strikethroughstyle = (TFontStrikethrough) aReadStream.ReadUint8L(); |
|
806 (*gclist)[gcindex]->SetStrikethroughStyle(strikethroughstyle); |
|
807 break; |
|
808 } |
|
809 case ESetWordJustification: |
|
810 { |
|
811 TInt excesswidth,numgaps; |
|
812 excesswidth=aReadStream.ReadInt32L(); |
|
813 numgaps=aReadStream.ReadInt32L(); |
|
814 (*gclist)[gcindex]->SetWordJustification(excesswidth,numgaps); |
|
815 break; |
|
816 } |
|
817 case ESetCharJustification: |
|
818 { |
|
819 TInt excesswidth,numgaps; |
|
820 excesswidth=aReadStream.ReadInt32L(); |
|
821 numgaps=aReadStream.ReadInt32L(); |
|
822 (*gclist)[gcindex]->SetCharJustification(excesswidth,numgaps); |
|
823 break; |
|
824 } |
|
825 case ESetPenColor: |
|
826 { |
|
827 TRgb color; |
|
828 aReadStream >> color; |
|
829 (*gclist)[gcindex]->SetPenColor(color); |
|
830 break; |
|
831 } |
|
832 case ESetPenStyle: |
|
833 { |
|
834 CGraphicsContext::TPenStyle penstyle; |
|
835 penstyle=(CGraphicsContext::TPenStyle) aReadStream.ReadUint8L(); |
|
836 (*gclist)[gcindex]->SetPenStyle(penstyle); |
|
837 break; |
|
838 } |
|
839 case ESetPenSize: |
|
840 { |
|
841 TSize size; |
|
842 aReadStream >> size; |
|
843 (*gclist)[gcindex]->SetPenSize(size); |
|
844 break; |
|
845 } |
|
846 case ESetBrushColor: |
|
847 { |
|
848 TRgb color; |
|
849 aReadStream >> color; |
|
850 (*gclist)[gcindex]->SetBrushColor(color); |
|
851 break; |
|
852 } |
|
853 case ESetBrushStyle: |
|
854 { |
|
855 CGraphicsContext::TBrushStyle brushstyle; |
|
856 brushstyle = (CGraphicsContext::TBrushStyle) aReadStream.ReadUint8L(); |
|
857 (*gclist)[gcindex]->SetBrushStyle(brushstyle); |
|
858 break; |
|
859 } |
|
860 case ESetBrushOrigin: |
|
861 { |
|
862 TPoint origin; |
|
863 aReadStream >> origin; |
|
864 (*gclist)[gcindex]->SetBrushOrigin(origin); |
|
865 break; |
|
866 } |
|
867 case EUseBrushPattern: |
|
868 { |
|
869 bitmap->InternalizeL(aReadStream); |
|
870 (*gclist)[gcindex]->UseBrushPattern(bitmap); |
|
871 bitmap->Reset(); |
|
872 break; |
|
873 } |
|
874 case EDiscardBrushPattern: |
|
875 { |
|
876 (*gclist)[gcindex]->DiscardBrushPattern(); |
|
877 break; |
|
878 } |
|
879 case EMoveTo: |
|
880 { |
|
881 TPoint point; |
|
882 aReadStream >> point; |
|
883 (*gclist)[gcindex]->MoveTo(point); |
|
884 break; |
|
885 } |
|
886 case EMoveBy: |
|
887 { |
|
888 TPoint vector; |
|
889 aReadStream >> vector; |
|
890 (*gclist)[gcindex]->MoveBy(vector); |
|
891 break; |
|
892 } |
|
893 case EPlot: |
|
894 { |
|
895 TPoint point; |
|
896 aReadStream >> point; |
|
897 (*gclist)[gcindex]->Plot(point); |
|
898 break; |
|
899 } |
|
900 case EDrawArc: |
|
901 { |
|
902 TRect rect; |
|
903 aReadStream >> rect; |
|
904 TPoint start,end; |
|
905 aReadStream >> start; |
|
906 aReadStream >> end; |
|
907 (*gclist)[gcindex]->DrawArc(rect,start,end); |
|
908 break; |
|
909 } |
|
910 case EDrawLine: |
|
911 { |
|
912 TPoint point1,point2; |
|
913 aReadStream >> point1; |
|
914 aReadStream >> point2; |
|
915 (*gclist)[gcindex]->DrawLine(point1,point2); |
|
916 break; |
|
917 } |
|
918 case EDrawLineTo: |
|
919 { |
|
920 TPoint point; |
|
921 aReadStream >> point; |
|
922 (*gclist)[gcindex]->DrawLineTo(point); |
|
923 break; |
|
924 } |
|
925 case EDrawLineBy: |
|
926 { |
|
927 TPoint vector; |
|
928 aReadStream >> vector; |
|
929 (*gclist)[gcindex]->DrawLineBy(vector); |
|
930 break; |
|
931 } |
|
932 case EDrawPolyLine1: |
|
933 { |
|
934 } |
|
935 case EDrawPolyLine2: |
|
936 { |
|
937 TInt numpoints; |
|
938 numpoints=aReadStream.ReadInt32L(); |
|
939 for (TInt i=0; i<numpoints; i++) |
|
940 { |
|
941 TPoint point; |
|
942 aReadStream >> point; |
|
943 pointlist->AppendL(point); |
|
944 } |
|
945 (*gclist)[gcindex]->DrawPolyLine(pointlist); |
|
946 pointlist->Reset(); |
|
947 break; |
|
948 } |
|
949 case EDrawPie: |
|
950 { |
|
951 TRect rect; |
|
952 aReadStream >> rect; |
|
953 TPoint start,end; |
|
954 aReadStream >> start; |
|
955 aReadStream >> end; |
|
956 (*gclist)[gcindex]->DrawPie(rect,start,end); |
|
957 break; |
|
958 } |
|
959 case EDrawEllipse: |
|
960 { |
|
961 TRect rect; |
|
962 aReadStream >> rect; |
|
963 (*gclist)[gcindex]->DrawEllipse(rect); |
|
964 break; |
|
965 } |
|
966 case EDrawRect: |
|
967 { |
|
968 TRect rect; |
|
969 aReadStream >> rect; |
|
970 (*gclist)[gcindex]->DrawRect(rect); |
|
971 break; |
|
972 } |
|
973 case EDrawRoundRect: |
|
974 { |
|
975 TRect rect; |
|
976 aReadStream >> rect; |
|
977 TSize cornersize; |
|
978 aReadStream >> cornersize; |
|
979 (*gclist)[gcindex]->DrawRoundRect(rect,cornersize); |
|
980 break; |
|
981 } |
|
982 case EDrawPolygon1: |
|
983 { |
|
984 } |
|
985 case EDrawPolygon2: |
|
986 { |
|
987 TInt numpoints; |
|
988 numpoints=aReadStream.ReadInt32L(); |
|
989 for (TInt i=0; i<numpoints; i++) |
|
990 { |
|
991 TPoint point; |
|
992 aReadStream >> point; |
|
993 pointlist->AppendL(point); |
|
994 } |
|
995 CGraphicsContext::TFillRule fillrule=(CGraphicsContext::TFillRule) aReadStream.ReadUint8L(); |
|
996 (*gclist)[gcindex]->DrawPolygon(pointlist,fillrule); |
|
997 pointlist->Reset(); |
|
998 break; |
|
999 } |
|
1000 case EDrawBitmap1: |
|
1001 { |
|
1002 TPoint topleft; |
|
1003 aReadStream >> topleft; |
|
1004 bitmap->InternalizeL(aReadStream); |
|
1005 (*gclist)[gcindex]->DrawBitmap(topleft,bitmap); |
|
1006 bitmap->Reset(); |
|
1007 break; |
|
1008 } |
|
1009 case EDrawBitmap2: |
|
1010 { |
|
1011 TRect destrect; |
|
1012 aReadStream >> destrect; |
|
1013 bitmap->InternalizeL(aReadStream); |
|
1014 (*gclist)[gcindex]->DrawBitmap(destrect,bitmap); |
|
1015 bitmap->Reset(); |
|
1016 break; |
|
1017 } |
|
1018 case EDrawBitmap3: |
|
1019 { |
|
1020 TRect destrect; |
|
1021 aReadStream >> destrect; |
|
1022 bitmap->InternalizeL(aReadStream); |
|
1023 TRect sourcerect; |
|
1024 aReadStream >> sourcerect; |
|
1025 (*gclist)[gcindex]->DrawBitmap(destrect,bitmap,sourcerect); |
|
1026 bitmap->Reset(); |
|
1027 break; |
|
1028 } |
|
1029 case EDrawText1: |
|
1030 { |
|
1031 HBufC* string=HBufC::NewLC(aReadStream,KMaxTInt); |
|
1032 TPoint position; |
|
1033 aReadStream >> position; |
|
1034 (*gclist)[gcindex]->DrawText(*string,position); |
|
1035 CleanupStack::PopAndDestroy(); |
|
1036 break; |
|
1037 } |
|
1038 case EDrawText2: |
|
1039 { |
|
1040 HBufC* string=HBufC::NewLC(aReadStream,KMaxTInt); |
|
1041 TRect box; |
|
1042 aReadStream >> box; |
|
1043 TInt baselineoffset=aReadStream.ReadInt32L(); |
|
1044 CGraphicsContext::TTextAlign horiz=(CGraphicsContext::TTextAlign) aReadStream.ReadUint8L(); |
|
1045 TInt leftmrg=aReadStream.ReadInt32L(); |
|
1046 (*gclist)[gcindex]->DrawText(*string,box,baselineoffset,horiz,leftmrg); |
|
1047 CleanupStack::PopAndDestroy(); |
|
1048 break; |
|
1049 } |
|
1050 } |
|
1051 } |
|
1052 while (code!=EEndOfStream); |
|
1053 CleanupStack::PopAndDestroy(gclist->Count()+4); |
|
1054 } |