sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "tcontextbase.h"
|
sl@0
|
17 |
#include <gdi.h>
|
sl@0
|
18 |
#include <bitdev.h>
|
sl@0
|
19 |
|
sl@0
|
20 |
CTBitGdiContext::CTBitGdiContext() :
|
sl@0
|
21 |
iError(KErrNone)
|
sl@0
|
22 |
{
|
sl@0
|
23 |
|
sl@0
|
24 |
}
|
sl@0
|
25 |
|
sl@0
|
26 |
CTBitGdiContext* CTBitGdiContext::NewL(CFbsBitmapDevice* aDevice, TBool aActivate)
|
sl@0
|
27 |
{
|
sl@0
|
28 |
CTBitGdiContext* self = new (ELeave) CTBitGdiContext;
|
sl@0
|
29 |
CleanupStack::PushL (self);
|
sl@0
|
30 |
self->ConstructL (aDevice, aActivate);
|
sl@0
|
31 |
CleanupStack::Pop ();
|
sl@0
|
32 |
return self;
|
sl@0
|
33 |
}
|
sl@0
|
34 |
|
sl@0
|
35 |
void CTBitGdiContext::ConstructL(CFbsBitmapDevice* aDevice, TBool aActivate)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
if(aActivate)
|
sl@0
|
38 |
{
|
sl@0
|
39 |
User::LeaveIfError(aDevice->CreateContext (iGc));
|
sl@0
|
40 |
}
|
sl@0
|
41 |
else
|
sl@0
|
42 |
{
|
sl@0
|
43 |
iGc = CFbsBitGc::NewL();
|
sl@0
|
44 |
}
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
CTBitGdiContext::~CTBitGdiContext()
|
sl@0
|
48 |
{
|
sl@0
|
49 |
delete iGc;
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
TInt CTBitGdiContext::Activate(CBitmapDevice *aDevice)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
CFbsDevice* device = (CFbsDevice *)aDevice;
|
sl@0
|
55 |
iGc->Activate(device);
|
sl@0
|
56 |
return KErrNone;
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
void CTBitGdiContext::SetOrigin(const TPoint& aOrigin)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
iGc->SetOrigin (aOrigin);
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
void CTBitGdiContext::SetClippingRegion(const TRegion& aRegion)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
TInt result = iGc->SetClippingRegion (aRegion);
|
sl@0
|
67 |
SetError(result);
|
sl@0
|
68 |
}
|
sl@0
|
69 |
|
sl@0
|
70 |
void CTBitGdiContext::ResetClippingRegion()
|
sl@0
|
71 |
{
|
sl@0
|
72 |
iGc->CancelClipping();
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
void CTBitGdiContext::SetDrawMode(DirectGdi::TDrawMode aMode)
|
sl@0
|
76 |
{
|
sl@0
|
77 |
CGraphicsContext::TDrawMode mode = CGraphicsContext::EDrawModePEN;
|
sl@0
|
78 |
if (aMode == DirectGdi::EDrawModeWriteAlpha)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
mode = CGraphicsContext::EDrawModeWriteAlpha;
|
sl@0
|
81 |
}
|
sl@0
|
82 |
iGc->SetDrawMode(mode);
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
void CTBitGdiContext::SetPenColor(const TRgb& aColor)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
iGc->SetPenColor (aColor);
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
void CTBitGdiContext::SetPenStyle(DirectGdi::TPenStyle aStyle)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
// The CGraphicsContext::TPenStyle enumeration has the same values as the
|
sl@0
|
93 |
// DirectGdi::TPenStyle. If these change then this function will need to be updated.
|
sl@0
|
94 |
iGc->SetPenStyle(static_cast<CGraphicsContext::TPenStyle>(aStyle));
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|
sl@0
|
97 |
void CTBitGdiContext::SetPenSize(const TSize& aSize)
|
sl@0
|
98 |
{
|
sl@0
|
99 |
iGc->SetPenSize (aSize);
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
void CTBitGdiContext::SetTextShadowColor(const TRgb& aColor)
|
sl@0
|
103 |
{
|
sl@0
|
104 |
iGc->SetShadowColor(aColor);
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
void CTBitGdiContext::SetBrushColor(const TRgb& aColor)
|
sl@0
|
108 |
{
|
sl@0
|
109 |
iGc->SetBrushColor (aColor);
|
sl@0
|
110 |
}
|
sl@0
|
111 |
|
sl@0
|
112 |
void CTBitGdiContext::SetBrushStyle(DirectGdi::TBrushStyle aStyle)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
// The CGraphicsContext::TBrushStyle enumeration has the same values as the
|
sl@0
|
115 |
// DirectGdi::TBrushStyle. If these change then this function will need to be updated.
|
sl@0
|
116 |
iGc->SetBrushStyle(static_cast<CGraphicsContext::TBrushStyle>(aStyle));
|
sl@0
|
117 |
}
|
sl@0
|
118 |
|
sl@0
|
119 |
void CTBitGdiContext::SetBrushOrigin(const TPoint& aOrigin)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
iGc->SetBrushOrigin (aOrigin);
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
void CTBitGdiContext::SetBrushPattern(const CFbsBitmap& aPattern)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
iGc->UseBrushPattern (&aPattern);
|
sl@0
|
127 |
}
|
sl@0
|
128 |
|
sl@0
|
129 |
void CTBitGdiContext::SetBrushPattern(TInt aHandle)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
TInt result = iGc->UseBrushPattern(aHandle);
|
sl@0
|
132 |
SetError(result);
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
void CTBitGdiContext::ResetBrushPattern()
|
sl@0
|
136 |
{
|
sl@0
|
137 |
iGc->DiscardBrushPattern ();
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
void CTBitGdiContext::SetFont(const CFont* aFont)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
iGc->UseFont (aFont);
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
void CTBitGdiContext::ResetFont()
|
sl@0
|
146 |
{
|
sl@0
|
147 |
iGc->DiscardFont ();
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
void CTBitGdiContext::Reset()
|
sl@0
|
151 |
{
|
sl@0
|
152 |
iGc->Reset ();
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
TRgb CTBitGdiContext::BrushColor()
|
sl@0
|
156 |
{
|
sl@0
|
157 |
return iGc->BrushColor ();
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
TRgb CTBitGdiContext::PenColor()
|
sl@0
|
161 |
{
|
sl@0
|
162 |
return iGc->PenColor ();
|
sl@0
|
163 |
}
|
sl@0
|
164 |
|
sl@0
|
165 |
TRgb CTBitGdiContext::TextShadowColor()
|
sl@0
|
166 |
{
|
sl@0
|
167 |
TRgb shadowColor;
|
sl@0
|
168 |
iGc->GetShadowColor(shadowColor);
|
sl@0
|
169 |
return shadowColor;
|
sl@0
|
170 |
}
|
sl@0
|
171 |
|
sl@0
|
172 |
void CTBitGdiContext::Clear(const TRect& aRect)
|
sl@0
|
173 |
{
|
sl@0
|
174 |
iGc->Clear (aRect);
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
void CTBitGdiContext::Clear()
|
sl@0
|
178 |
{
|
sl@0
|
179 |
iGc->Clear ();
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
void CTBitGdiContext::MoveTo(const TPoint& aPoint)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
iGc->MoveTo (aPoint);
|
sl@0
|
185 |
}
|
sl@0
|
186 |
|
sl@0
|
187 |
void CTBitGdiContext::MoveBy(const TPoint& aVector)
|
sl@0
|
188 |
{
|
sl@0
|
189 |
iGc->MoveBy (aVector);
|
sl@0
|
190 |
}
|
sl@0
|
191 |
|
sl@0
|
192 |
void CTBitGdiContext::Plot(const TPoint& aPoint)
|
sl@0
|
193 |
{
|
sl@0
|
194 |
iGc->Plot (aPoint);
|
sl@0
|
195 |
}
|
sl@0
|
196 |
|
sl@0
|
197 |
void CTBitGdiContext::DrawLine(const TPoint& aStart, const TPoint& aEnd)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
iGc->DrawLine (aStart, aEnd);
|
sl@0
|
200 |
}
|
sl@0
|
201 |
|
sl@0
|
202 |
void CTBitGdiContext::DrawLineTo(const TPoint& aPoint)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
iGc->DrawLineTo (aPoint);
|
sl@0
|
205 |
}
|
sl@0
|
206 |
|
sl@0
|
207 |
void CTBitGdiContext::DrawLineBy(const TPoint& aVector)
|
sl@0
|
208 |
{
|
sl@0
|
209 |
iGc->DrawLineBy (aVector);
|
sl@0
|
210 |
}
|
sl@0
|
211 |
|
sl@0
|
212 |
void CTBitGdiContext::DrawRect(const TRect& aRect)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
iGc->DrawRect (aRect);
|
sl@0
|
215 |
}
|
sl@0
|
216 |
|
sl@0
|
217 |
void CTBitGdiContext::DrawRoundRect(const TRect& aRect,
|
sl@0
|
218 |
const TSize& aCornerSize)
|
sl@0
|
219 |
{
|
sl@0
|
220 |
iGc->DrawRoundRect (aRect, aCornerSize);
|
sl@0
|
221 |
}
|
sl@0
|
222 |
|
sl@0
|
223 |
void CTBitGdiContext::DrawPolyLine(const CArrayFix<TPoint>& aPointList)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
iGc->DrawPolyLine(&aPointList);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
|
sl@0
|
228 |
void CTBitGdiContext::DrawPolyLineNoEndPoint(const CArrayFix<TPoint>& aPointList)
|
sl@0
|
229 |
{
|
sl@0
|
230 |
iGc->DrawPolyLineNoEndPoint(&aPointList);
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|
sl@0
|
233 |
void CTBitGdiContext::DrawPolygon(const CArrayFix<TPoint>& aPoints, DirectGdi::TFillRule aRule)
|
sl@0
|
234 |
{
|
sl@0
|
235 |
TInt result = iGc->DrawPolygon(&aPoints, static_cast<CGraphicsContext::TFillRule>(aRule));
|
sl@0
|
236 |
SetError(result);
|
sl@0
|
237 |
}
|
sl@0
|
238 |
|
sl@0
|
239 |
void CTBitGdiContext::DrawArc(const TRect& aRect, const TPoint& aStart,
|
sl@0
|
240 |
const TPoint& aEnd)
|
sl@0
|
241 |
{
|
sl@0
|
242 |
iGc->DrawArc (aRect, aStart, aEnd);
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
void CTBitGdiContext::DrawPie(const TRect& aRect, const TPoint& aStart,
|
sl@0
|
246 |
const TPoint& aEnd)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
iGc->DrawPie (aRect, aStart, aEnd);
|
sl@0
|
249 |
}
|
sl@0
|
250 |
|
sl@0
|
251 |
void CTBitGdiContext::DrawEllipse(const TRect& aRect)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
iGc->DrawEllipse (aRect);
|
sl@0
|
254 |
}
|
sl@0
|
255 |
|
sl@0
|
256 |
void CTBitGdiContext::BitBltMasked(const TPoint& aDestPos,
|
sl@0
|
257 |
const CFbsBitmap& aBitmap, const TRect& aSourceRect,
|
sl@0
|
258 |
const CFbsBitmap& aAlpha, const TPoint& aAlphaPos)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
// This overload of BitBltMasked maps to AlphaBlendBitmaps in BitGDI, which has the same signiature.
|
sl@0
|
261 |
TInt result = iGc->AlphaBlendBitmaps(aDestPos, &aBitmap, aSourceRect, &aAlpha, aAlphaPos);
|
sl@0
|
262 |
SetError(result);
|
sl@0
|
263 |
}
|
sl@0
|
264 |
|
sl@0
|
265 |
void CTBitGdiContext::BitBlt(const TPoint& aPoint, const CFbsBitmap& aBitmap)
|
sl@0
|
266 |
{
|
sl@0
|
267 |
iGc->BitBlt (aPoint, &aBitmap);
|
sl@0
|
268 |
}
|
sl@0
|
269 |
|
sl@0
|
270 |
void CTBitGdiContext::DrawBitmap(const TRect& aDestRect,
|
sl@0
|
271 |
const CFbsBitmap& aSource)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
iGc->DrawBitmap (aDestRect, &aSource);
|
sl@0
|
274 |
}
|
sl@0
|
275 |
|
sl@0
|
276 |
void CTBitGdiContext::BitBlt(const TPoint& aDestPos,
|
sl@0
|
277 |
const CFbsBitmap& aBitmap, const TRect& aSrcRect)
|
sl@0
|
278 |
{
|
sl@0
|
279 |
iGc->BitBlt (aDestPos, &aBitmap, aSrcRect);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
void CTBitGdiContext::BitBltMasked(const TPoint& aDestPos,
|
sl@0
|
283 |
const CFbsBitmap& aBitmap, const TRect& aSrcRect,
|
sl@0
|
284 |
const CFbsBitmap& aMask, TBool aInvertMask)
|
sl@0
|
285 |
{
|
sl@0
|
286 |
iGc->BitBltMasked (aDestPos, &aBitmap, aSrcRect, &aMask, aInvertMask);
|
sl@0
|
287 |
}
|
sl@0
|
288 |
|
sl@0
|
289 |
void CTBitGdiContext::DrawBitmap(const TRect& aDestRect,
|
sl@0
|
290 |
const CFbsBitmap& aBitmap, const TRect& aSrcRect)
|
sl@0
|
291 |
{
|
sl@0
|
292 |
iGc->DrawBitmap (aDestRect, &aBitmap, aSrcRect);
|
sl@0
|
293 |
}
|
sl@0
|
294 |
|
sl@0
|
295 |
void CTBitGdiContext::DrawBitmapMasked(const TRect& aDestRect,
|
sl@0
|
296 |
const CFbsBitmap& aBitmap, const TRect& aSrcRect,
|
sl@0
|
297 |
const CFbsBitmap& aMask, TBool aInvertMask)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
iGc->DrawBitmapMasked (aDestRect, &aBitmap, aSrcRect, &aMask, aInvertMask);
|
sl@0
|
300 |
}
|
sl@0
|
301 |
|
sl@0
|
302 |
void CTBitGdiContext::CopyRect(const TPoint& aOffset, const TRect& aRect)
|
sl@0
|
303 |
{
|
sl@0
|
304 |
iGc->CopyRect (aOffset, aRect);
|
sl@0
|
305 |
}
|
sl@0
|
306 |
|
sl@0
|
307 |
TBool CTBitGdiContext::HasBrushPattern() const
|
sl@0
|
308 |
{
|
sl@0
|
309 |
return iGc->IsBrushPatternUsed ();
|
sl@0
|
310 |
}
|
sl@0
|
311 |
|
sl@0
|
312 |
TBool CTBitGdiContext::HasFont() const
|
sl@0
|
313 |
{
|
sl@0
|
314 |
return iGc->IsFontUsed ();
|
sl@0
|
315 |
}
|
sl@0
|
316 |
|
sl@0
|
317 |
void CTBitGdiContext::ExternalizeL(RWriteStream& aWriteStream)
|
sl@0
|
318 |
{
|
sl@0
|
319 |
iGc->ExternalizeL (aWriteStream);
|
sl@0
|
320 |
}
|
sl@0
|
321 |
|
sl@0
|
322 |
void CTBitGdiContext::InternalizeL(RReadStream& aReadStream)
|
sl@0
|
323 |
{
|
sl@0
|
324 |
iGc->InternalizeL (aReadStream);
|
sl@0
|
325 |
}
|
sl@0
|
326 |
|
sl@0
|
327 |
void CTBitGdiContext::SetCharJustification(TInt aExcessWidth, TInt aNumGaps)
|
sl@0
|
328 |
{
|
sl@0
|
329 |
iGc->SetCharJustification (aExcessWidth, aNumGaps);
|
sl@0
|
330 |
}
|
sl@0
|
331 |
|
sl@0
|
332 |
void CTBitGdiContext::SetWordJustification(TInt aExcessWidth, TInt aNumChars)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
iGc->SetWordJustification (aExcessWidth, aNumChars);
|
sl@0
|
335 |
}
|
sl@0
|
336 |
|
sl@0
|
337 |
void CTBitGdiContext::SetUnderlineStyle(DirectGdi::TFontUnderline aUnderlineStyle)
|
sl@0
|
338 |
{
|
sl@0
|
339 |
iGc->SetUnderlineStyle (static_cast<TFontUnderline>(aUnderlineStyle));
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
void CTBitGdiContext::SetStrikethroughStyle(DirectGdi::TFontStrikethrough aStrikethroughStyle)
|
sl@0
|
343 |
{
|
sl@0
|
344 |
iGc->SetStrikethroughStyle (static_cast<TFontStrikethrough>(aStrikethroughStyle));
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
void CTBitGdiContext::UpdateJustification(const TDesC& aText, const DirectGdi::TTextParameters* aParam)
|
sl@0
|
348 |
{
|
sl@0
|
349 |
iGc->UpdateJustification(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam));
|
sl@0
|
350 |
}
|
sl@0
|
351 |
|
sl@0
|
352 |
void CTBitGdiContext::UpdateJustificationVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, TBool aUp)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
iGc->UpdateJustificationVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aUp);
|
sl@0
|
355 |
}
|
sl@0
|
356 |
|
sl@0
|
357 |
void CTBitGdiContext::SetFontNoDuplicate(const CFont* /*aFont*/)
|
sl@0
|
358 |
{
|
sl@0
|
359 |
}
|
sl@0
|
360 |
|
sl@0
|
361 |
void CTBitGdiContext::SetError(TInt aErr)
|
sl@0
|
362 |
{
|
sl@0
|
363 |
if (KErrNone == iError)
|
sl@0
|
364 |
{
|
sl@0
|
365 |
iError = aErr;
|
sl@0
|
366 |
}
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
|
sl@0
|
370 |
TInt CTBitGdiContext::GetError()
|
sl@0
|
371 |
{
|
sl@0
|
372 |
TInt err = iError;
|
sl@0
|
373 |
iError = KErrNone;
|
sl@0
|
374 |
return err;
|
sl@0
|
375 |
}
|
sl@0
|
376 |
|
sl@0
|
377 |
// text drawing
|
sl@0
|
378 |
void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam)
|
sl@0
|
379 |
{
|
sl@0
|
380 |
iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam));
|
sl@0
|
381 |
}
|
sl@0
|
382 |
|
sl@0
|
383 |
void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition)
|
sl@0
|
384 |
{
|
sl@0
|
385 |
iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aPosition);
|
sl@0
|
386 |
}
|
sl@0
|
387 |
|
sl@0
|
388 |
void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox)
|
sl@0
|
389 |
{
|
sl@0
|
390 |
iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox);
|
sl@0
|
391 |
}
|
sl@0
|
392 |
|
sl@0
|
393 |
void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset,
|
sl@0
|
394 |
DirectGdi::TTextAlign aAlignment, TInt aMargin)
|
sl@0
|
395 |
{
|
sl@0
|
396 |
iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, static_cast<CGraphicsContext::TTextAlign>(aAlignment), aMargin);
|
sl@0
|
397 |
}
|
sl@0
|
398 |
|
sl@0
|
399 |
void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset,
|
sl@0
|
400 |
TInt aTextWidth, DirectGdi::TTextAlign aAlignment, TInt aMargin)
|
sl@0
|
401 |
{
|
sl@0
|
402 |
iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, aTextWidth, static_cast<CGraphicsContext::TTextAlign>(aAlignment), aMargin);
|
sl@0
|
403 |
}
|
sl@0
|
404 |
|
sl@0
|
405 |
void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, TBool aUp)
|
sl@0
|
406 |
{
|
sl@0
|
407 |
iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aUp);
|
sl@0
|
408 |
}
|
sl@0
|
409 |
|
sl@0
|
410 |
void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition, TBool aUp)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aPosition, aUp);
|
sl@0
|
413 |
}
|
sl@0
|
414 |
|
sl@0
|
415 |
void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TBool aUp)
|
sl@0
|
416 |
{
|
sl@0
|
417 |
iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aUp);
|
sl@0
|
418 |
}
|
sl@0
|
419 |
|
sl@0
|
420 |
void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset,
|
sl@0
|
421 |
TBool aUp, DirectGdi::TTextAlign aVerticalAlignment, TInt aMargin)
|
sl@0
|
422 |
{
|
sl@0
|
423 |
iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, aUp,
|
sl@0
|
424 |
static_cast<CGraphicsContext::TTextAlign>(aVerticalAlignment), aMargin);
|
sl@0
|
425 |
}
|
sl@0
|
426 |
|
sl@0
|
427 |
void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset,
|
sl@0
|
428 |
TInt aTextWidth, TBool aUp, DirectGdi::TTextAlign aVerticalAlignment, TInt aMargin)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, aTextWidth, aUp,
|
sl@0
|
431 |
static_cast<CGraphicsContext::TTextAlign>(aVerticalAlignment), aMargin);
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
void CTBitGdiContext::DrawResource(const TPoint& aPos,
|
sl@0
|
435 |
const TDrawableSourceAndEquivRotatedBmps& aSource,
|
sl@0
|
436 |
DirectGdi::TGraphicsRotation aRotation)
|
sl@0
|
437 |
{
|
sl@0
|
438 |
switch (aRotation)
|
sl@0
|
439 |
{
|
sl@0
|
440 |
case DirectGdi::EGraphicsRotation90:
|
sl@0
|
441 |
iGc->BitBlt(aPos, aSource.iBmpRot90);
|
sl@0
|
442 |
break;
|
sl@0
|
443 |
|
sl@0
|
444 |
case DirectGdi::EGraphicsRotation180:
|
sl@0
|
445 |
iGc->BitBlt(aPos, aSource.iBmpRot180);
|
sl@0
|
446 |
break;
|
sl@0
|
447 |
|
sl@0
|
448 |
case DirectGdi::EGraphicsRotation270:
|
sl@0
|
449 |
iGc->BitBlt(aPos, aSource.iBmpRot270);
|
sl@0
|
450 |
break;
|
sl@0
|
451 |
|
sl@0
|
452 |
default: // DirectGdi::EGraphicsRotationNone
|
sl@0
|
453 |
iGc->BitBlt(aPos, aSource.iBmpRotNone);
|
sl@0
|
454 |
break;
|
sl@0
|
455 |
}
|
sl@0
|
456 |
}
|
sl@0
|
457 |
|
sl@0
|
458 |
void CTBitGdiContext::DrawResource(const TRect& aDestRect,
|
sl@0
|
459 |
const TDrawableSourceAndEquivRotatedBmps& aSource,
|
sl@0
|
460 |
DirectGdi::TGraphicsRotation aRotation)
|
sl@0
|
461 |
{
|
sl@0
|
462 |
switch (aRotation)
|
sl@0
|
463 |
{
|
sl@0
|
464 |
case DirectGdi::EGraphicsRotation90:
|
sl@0
|
465 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRot90);
|
sl@0
|
466 |
break;
|
sl@0
|
467 |
|
sl@0
|
468 |
case DirectGdi::EGraphicsRotation180:
|
sl@0
|
469 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRot180);
|
sl@0
|
470 |
break;
|
sl@0
|
471 |
|
sl@0
|
472 |
case DirectGdi::EGraphicsRotation270:
|
sl@0
|
473 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRot270);
|
sl@0
|
474 |
break;
|
sl@0
|
475 |
|
sl@0
|
476 |
default: // DirectGdi::EGraphicsRotationNone
|
sl@0
|
477 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRotNone);
|
sl@0
|
478 |
break;
|
sl@0
|
479 |
}
|
sl@0
|
480 |
}
|
sl@0
|
481 |
|
sl@0
|
482 |
void CTBitGdiContext::DrawResource(const TRect& aDestRect,
|
sl@0
|
483 |
const TDrawableSourceAndEquivRotatedBmps& aSource,
|
sl@0
|
484 |
const TRect& aSrcRect,
|
sl@0
|
485 |
DirectGdi::TGraphicsRotation aRotation)
|
sl@0
|
486 |
{
|
sl@0
|
487 |
switch (aRotation)
|
sl@0
|
488 |
{
|
sl@0
|
489 |
case DirectGdi::EGraphicsRotation90:
|
sl@0
|
490 |
{
|
sl@0
|
491 |
// Adjust the src rect to take account of the rotated bitmap
|
sl@0
|
492 |
TRect rect = aSrcRect;
|
sl@0
|
493 |
rect.iBr.iX = aSrcRect.iTl.iX + aSrcRect.Height();
|
sl@0
|
494 |
rect.iBr.iY = aSrcRect.iTl.iY + aSrcRect.Width();
|
sl@0
|
495 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRot90, rect);
|
sl@0
|
496 |
break;
|
sl@0
|
497 |
}
|
sl@0
|
498 |
|
sl@0
|
499 |
case DirectGdi::EGraphicsRotation180:
|
sl@0
|
500 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRot180, aSrcRect);
|
sl@0
|
501 |
break;
|
sl@0
|
502 |
|
sl@0
|
503 |
case DirectGdi::EGraphicsRotation270:
|
sl@0
|
504 |
{
|
sl@0
|
505 |
// Adjust the src rect to take account of the rotated bitmap
|
sl@0
|
506 |
TRect rect = aSrcRect;
|
sl@0
|
507 |
rect.iBr.iX = aSrcRect.iTl.iX + aSrcRect.Height();
|
sl@0
|
508 |
rect.iBr.iY = aSrcRect.iTl.iY + aSrcRect.Width();
|
sl@0
|
509 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRot270, rect);
|
sl@0
|
510 |
break;
|
sl@0
|
511 |
}
|
sl@0
|
512 |
|
sl@0
|
513 |
default: // DirectGdi::EGraphicsRotationNone
|
sl@0
|
514 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRotNone, aSrcRect);
|
sl@0
|
515 |
break;
|
sl@0
|
516 |
}
|
sl@0
|
517 |
}
|
sl@0
|
518 |
|
sl@0
|
519 |
void CTBitGdiContext::DrawResource(const TRect& aDestRect,
|
sl@0
|
520 |
const TDrawableSourceAndEquivRotatedBmps& aSource,
|
sl@0
|
521 |
const TDesC8& /*aParam*/)
|
sl@0
|
522 |
{
|
sl@0
|
523 |
// NB we only support drawing drawable sources as images currently
|
sl@0
|
524 |
iGc->DrawBitmap(aDestRect, aSource.iBmpRotNone);
|
sl@0
|
525 |
}
|
sl@0
|
526 |
|
sl@0
|
527 |
TInt CTBitGdiContext::GetInterface(TUid /*aInterfaceId*/, TAny*& aInterface)
|
sl@0
|
528 |
{
|
sl@0
|
529 |
aInterface = NULL;
|
sl@0
|
530 |
return KErrNotSupported;
|
sl@0
|
531 |
}
|
sl@0
|
532 |
|
sl@0
|
533 |
void CTBitGdiContext::CopySettings(const CTContextBase& aGc)
|
sl@0
|
534 |
{
|
sl@0
|
535 |
CTBitGdiContext* gc = (CTBitGdiContext*)&aGc;
|
sl@0
|
536 |
iGc->CopySettings(*(gc->iGc));
|
sl@0
|
537 |
}
|