sl@0
|
1 |
// Copyright (c) 2004-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 "TBitgdiScaling.h"
|
sl@0
|
17 |
//#pragma warning(disable: 4127)
|
sl@0
|
18 |
|
sl@0
|
19 |
//X and Y scaling factors.
|
sl@0
|
20 |
const TInt KScalingFactorX = 2;
|
sl@0
|
21 |
const TInt KScalingFactorY = 3;
|
sl@0
|
22 |
//Test bitmap
|
sl@0
|
23 |
_LIT(KTestBmp, "z:\\system\\data\\BmCTest.mbm");
|
sl@0
|
24 |
typedef CArrayFixFlat<TPoint> CPointArray;
|
sl@0
|
25 |
|
sl@0
|
26 |
|
sl@0
|
27 |
//Choises one of the installed fonts and sets it as a default font for the graphics context.
|
sl@0
|
28 |
static CFont* SetFontL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
TTypefaceSupport typeFaceSupport;
|
sl@0
|
31 |
aScreenDevice->TypefaceSupport(typeFaceSupport, 0);
|
sl@0
|
32 |
TFontSpec fontSpec;
|
sl@0
|
33 |
fontSpec.iTypeface = typeFaceSupport.iTypeface;
|
sl@0
|
34 |
fontSpec.iHeight = 10;
|
sl@0
|
35 |
CFont* font = NULL;
|
sl@0
|
36 |
User::LeaveIfError(aScreenDevice->GetNearestFontToDesignHeightInPixels(font, fontSpec));
|
sl@0
|
37 |
aGraphicsContext->UseFont(font);
|
sl@0
|
38 |
return font;
|
sl@0
|
39 |
}
|
sl@0
|
40 |
|
sl@0
|
41 |
//Clears the screen and displays after that the scaling origin point.
|
sl@0
|
42 |
static void Clear(CFbsBitGc* aGraphicsContext)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
45 |
aGraphicsContext->SetBrushColor(KRgbWhite);
|
sl@0
|
46 |
aGraphicsContext->Clear();
|
sl@0
|
47 |
aGraphicsContext->SetPenSize(TSize(2, 2));
|
sl@0
|
48 |
aGraphicsContext->SetPenColor(TRgb(0xFF, 0x00, 0x00));
|
sl@0
|
49 |
aGraphicsContext->Plot(TPoint(0, 0));
|
sl@0
|
50 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0x00, 0x00));
|
sl@0
|
51 |
aGraphicsContext->DrawText(_L("Scaling Origin"), TPoint(0, 0));
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
//CFbsBitGc::DrawBitmap() test
|
sl@0
|
55 |
void CTBitgdiScaling::TestDrawBitmapL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
INFO_PRINTF1(_L("DrawBitmap() - (0, 0) coord"));
|
sl@0
|
58 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
|
sl@0
|
59 |
CleanupStack::PushL(bitmap);
|
sl@0
|
60 |
|
sl@0
|
61 |
bitmap->Reset();
|
sl@0
|
62 |
User::LeaveIfError(bitmap->Load(KTestBmp, 0));
|
sl@0
|
63 |
|
sl@0
|
64 |
::Clear(aGraphicsContext);
|
sl@0
|
65 |
TSize size = bitmap->SizeInPixels();
|
sl@0
|
66 |
//RDebug::Print(_L("DrawBitmap %d, %d, %d, %d\r\n"), 0, 0, size.iWidth, size.iHeight);
|
sl@0
|
67 |
aGraphicsContext->DrawBitmap(TRect(0, 0, size.iWidth, size.iHeight), bitmap);
|
sl@0
|
68 |
aScreenDevice->Update();
|
sl@0
|
69 |
|
sl@0
|
70 |
CleanupStack::PopAndDestroy(bitmap);
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
//CFbsBitGc::Clear(), CFbsBitGc::Clear(const TRect& aRect), CFbsBitGc::DrawLine() test
|
sl@0
|
74 |
void CTBitgdiScaling::TestClear(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
75 |
{
|
sl@0
|
76 |
INFO_PRINTF1(_L("Clear(), DrawLine() - Neg.coord."));
|
sl@0
|
77 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
78 |
|
sl@0
|
79 |
TRect drawRect;
|
sl@0
|
80 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
81 |
|
sl@0
|
82 |
//RDebug::Print(_L("DrawRect %d, %d, %d, %d\r\n"), drawRect.iTl.iX, drawRect.iTl.iY, drawRect.iBr.iX, drawRect.iBr.iY);
|
sl@0
|
83 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
84 |
aGraphicsContext->DrawRect(drawRect);
|
sl@0
|
85 |
aScreenDevice->Update();
|
sl@0
|
86 |
|
sl@0
|
87 |
//RDebug::Print(_L("Clear\r\n"));
|
sl@0
|
88 |
aGraphicsContext->SetBrushColor(KRgbWhite);
|
sl@0
|
89 |
::Clear(aGraphicsContext);
|
sl@0
|
90 |
aScreenDevice->Update();
|
sl@0
|
91 |
|
sl@0
|
92 |
//RDebug::Print(_L("DrawRect %d, %d, %d, %d\r\n"), drawRect.iTl.iX, drawRect.iTl.iY, drawRect.iBr.iX, drawRect.iBr.iY);
|
sl@0
|
93 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
94 |
aGraphicsContext->DrawRect(drawRect);
|
sl@0
|
95 |
aScreenDevice->Update();
|
sl@0
|
96 |
|
sl@0
|
97 |
//RDebug::Print(_L("Clear(TRect) %d, %d, %d, %d\r\n"), drawRect.iTl.iX, drawRect.iTl.iY, drawRect.iBr.iX, drawRect.iBr.iY);
|
sl@0
|
98 |
aGraphicsContext->SetBrushColor(KRgbWhite);
|
sl@0
|
99 |
drawRect.Shrink(1, 1);
|
sl@0
|
100 |
aGraphicsContext->Clear(drawRect);
|
sl@0
|
101 |
aScreenDevice->Update();
|
sl@0
|
102 |
|
sl@0
|
103 |
drawRect.Grow(1, 1);
|
sl@0
|
104 |
CGraphicsContext::TPenStyle penStyle[] =
|
sl@0
|
105 |
{
|
sl@0
|
106 |
CGraphicsContext::ENullPen,
|
sl@0
|
107 |
CGraphicsContext::ESolidPen,
|
sl@0
|
108 |
CGraphicsContext::EDottedPen,
|
sl@0
|
109 |
CGraphicsContext::EDashedPen,
|
sl@0
|
110 |
CGraphicsContext::EDotDashPen,
|
sl@0
|
111 |
CGraphicsContext::EDotDotDashPen
|
sl@0
|
112 |
};
|
sl@0
|
113 |
struct TLineProps
|
sl@0
|
114 |
{
|
sl@0
|
115 |
TLineProps(const TPoint& aPt1, const TPoint& aPt2) :
|
sl@0
|
116 |
iPt1(aPt1),
|
sl@0
|
117 |
iPt2(aPt2)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
}
|
sl@0
|
120 |
TPoint iPt1;
|
sl@0
|
121 |
TPoint iPt2;
|
sl@0
|
122 |
};
|
sl@0
|
123 |
TLineProps lineProps[] =
|
sl@0
|
124 |
{
|
sl@0
|
125 |
TLineProps(drawRect.iTl, drawRect.iBr - TPoint(1, 1)),
|
sl@0
|
126 |
TLineProps(TPoint(drawRect.iTl.iX, drawRect.iBr.iY - 1), TPoint(drawRect.iBr.iX - 1, drawRect.iTl.iY))
|
sl@0
|
127 |
};
|
sl@0
|
128 |
for(TInt jj=0;jj<TInt(sizeof(lineProps)/sizeof(lineProps[0]));++jj)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
for(TInt ii=0;ii<TInt(sizeof(penStyle)/sizeof(penStyle[0]));++ii)
|
sl@0
|
131 |
{
|
sl@0
|
132 |
aGraphicsContext->SetPenStyle(penStyle[ii]);
|
sl@0
|
133 |
|
sl@0
|
134 |
//RDebug::Print(_L("DrawLine %d, %d, %d, %d\r\n"), lineProps[jj].iPt1.iX, lineProps[jj].iPt1.iY, lineProps[jj].iPt2.iX, lineProps[jj].iPt2.iY);
|
sl@0
|
135 |
::Clear(aGraphicsContext);
|
sl@0
|
136 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0xFF, 0x00));
|
sl@0
|
137 |
aGraphicsContext->SetPenSize(TSize(1, 1));
|
sl@0
|
138 |
aGraphicsContext->DrawLine(lineProps[jj].iPt1, lineProps[jj].iPt2);
|
sl@0
|
139 |
aScreenDevice->Update();
|
sl@0
|
140 |
|
sl@0
|
141 |
//RDebug::Print(_L("DrawLine %d, %d, %d, %d\r\n"), lineProps[jj].iPt1.iX, lineProps[jj].iPt1.iY, lineProps[jj].iPt2.iX, lineProps[jj].iPt2.iY);
|
sl@0
|
142 |
::Clear(aGraphicsContext);
|
sl@0
|
143 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0xFF, 0x00));
|
sl@0
|
144 |
aGraphicsContext->SetPenSize(TSize(2, 2));
|
sl@0
|
145 |
aGraphicsContext->DrawLine(lineProps[jj].iPt1, lineProps[jj].iPt2);
|
sl@0
|
146 |
aScreenDevice->Update();
|
sl@0
|
147 |
}
|
sl@0
|
148 |
}
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
//CFbsBitGc::Bitblt(), CFbsBitGc::BitbltMasked(), CFbsBitGc::DrawBitmap() test
|
sl@0
|
152 |
void CTBitgdiScaling::TestBitbltL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
153 |
{
|
sl@0
|
154 |
INFO_PRINTF1(_L("Bitblt(), BitbltMasked(), DrawBitmap() - Neg.coord."));
|
sl@0
|
155 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
|
sl@0
|
156 |
CleanupStack::PushL(bitmap);
|
sl@0
|
157 |
bitmap->Reset();
|
sl@0
|
158 |
User::LeaveIfError(bitmap->Load(KTestBmp, 0));
|
sl@0
|
159 |
TSize bmpSize = bitmap->SizeInPixels();
|
sl@0
|
160 |
TInt ii,jj;
|
sl@0
|
161 |
|
sl@0
|
162 |
CFbsBitmap* maskBitmap = new (ELeave) CFbsBitmap;
|
sl@0
|
163 |
CleanupStack::PushL(maskBitmap);
|
sl@0
|
164 |
User::LeaveIfError(maskBitmap->Create(bmpSize, EGray256));
|
sl@0
|
165 |
TBitmapUtil bmpUtil(maskBitmap);
|
sl@0
|
166 |
bmpUtil.Begin(TPoint(0, 0));
|
sl@0
|
167 |
for(ii=0;ii<bmpSize.iWidth;++ii)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
for(jj=0;jj<bmpSize.iHeight;++jj)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
bmpUtil.SetPos(TPoint(ii,jj));
|
sl@0
|
172 |
bmpUtil.SetPixel(0xAA555555);
|
sl@0
|
173 |
}
|
sl@0
|
174 |
}
|
sl@0
|
175 |
bmpUtil.End();
|
sl@0
|
176 |
|
sl@0
|
177 |
CFbsBitmap* maskBitmap2 = new (ELeave) CFbsBitmap;
|
sl@0
|
178 |
CleanupStack::PushL(maskBitmap2);
|
sl@0
|
179 |
User::LeaveIfError(maskBitmap2->Create(bmpSize, EGray16));
|
sl@0
|
180 |
TBitmapUtil bmpUtil2(maskBitmap2);
|
sl@0
|
181 |
bmpUtil2.Begin(TPoint(0, 0));
|
sl@0
|
182 |
for(ii=0;ii<bmpSize.iWidth;++ii)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
for(jj=0;jj<bmpSize.iHeight;++jj)
|
sl@0
|
185 |
{
|
sl@0
|
186 |
bmpUtil2.SetPos(TPoint(ii,jj));
|
sl@0
|
187 |
bmpUtil2.SetPixel(0xBBBBBB);
|
sl@0
|
188 |
}
|
sl@0
|
189 |
}
|
sl@0
|
190 |
bmpUtil2.End();
|
sl@0
|
191 |
|
sl@0
|
192 |
TRect drawRect;
|
sl@0
|
193 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
194 |
|
sl@0
|
195 |
for(TInt x=drawRect.iTl.iX;x<(drawRect.iBr.iX-bmpSize.iWidth);x+=10)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
for(TInt y=drawRect.iTl.iY;y<(drawRect.iBr.iY-bmpSize.iHeight);y+=10)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
::Clear(aGraphicsContext);
|
sl@0
|
200 |
|
sl@0
|
201 |
//RDebug::Print(_L("BitBlt %d, %d\r\n"), x, y);
|
sl@0
|
202 |
aGraphicsContext->BitBlt(TPoint(x, y), bitmap);
|
sl@0
|
203 |
|
sl@0
|
204 |
TRect rc(TPoint(x + bmpSize.iWidth + 1, y + bmpSize.iHeight + 1), bmpSize);
|
sl@0
|
205 |
//RDebug::Print(_L("DrawBitmap %d, %d, %d, %d\r\n"), rc.iTl.iX, rc.iTl.iY, rc.iBr.iX, rc.iBr.iY);
|
sl@0
|
206 |
aGraphicsContext->DrawBitmap(rc, bitmap);
|
sl@0
|
207 |
|
sl@0
|
208 |
TRect rc2(TPoint(x + bmpSize.iWidth * 2 + 1, y + bmpSize.iHeight * 2 + 1), bmpSize);
|
sl@0
|
209 |
//RDebug::Print(_L("BitBltMasked %d, %d, %d, %d\r\n"), rc2.iTl.iX, rc2.iTl.iY, rc2.iBr.iX, rc2.iBr.iY);
|
sl@0
|
210 |
aGraphicsContext->BitBltMasked(rc2.iTl, bitmap, TRect(0, 0, bmpSize.iWidth, bmpSize.iHeight), maskBitmap, EFalse);
|
sl@0
|
211 |
|
sl@0
|
212 |
TRect rc3(TPoint(x + bmpSize.iWidth * 3 + 1, y + bmpSize.iHeight * 3 + 1), bmpSize);
|
sl@0
|
213 |
//RDebug::Print(_L("BitBltMasked %d, %d, %d, %d\r\n"), rc3.iTl.iX, rc3.iTl.iY, rc3.iBr.iX, rc3.iBr.iY);
|
sl@0
|
214 |
aGraphicsContext->BitBltMasked(rc3.iTl, bitmap, TRect(0, 0, bmpSize.iWidth, bmpSize.iHeight), maskBitmap2, EFalse);
|
sl@0
|
215 |
|
sl@0
|
216 |
aScreenDevice->Update();
|
sl@0
|
217 |
}
|
sl@0
|
218 |
}
|
sl@0
|
219 |
CleanupStack::PopAndDestroy(3);//bitmap & maskBitmap & maskBitmap2
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
//CFbsBitGc::DrawArc(), CFbsBitGc::DrawPie(), CFbsBitGc::DrawRoundRect() test
|
sl@0
|
223 |
void CTBitgdiScaling::TestArcPie(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
INFO_PRINTF1(_L("DrawArc(), DrawPie(), DrawRoundRect() - Neg.coord."));
|
sl@0
|
226 |
|
sl@0
|
227 |
TRect drawRect;
|
sl@0
|
228 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
229 |
|
sl@0
|
230 |
const TSize arcSize(20, 20);
|
sl@0
|
231 |
|
sl@0
|
232 |
for(TInt x=drawRect.iTl.iX;x<(drawRect.iBr.iX-arcSize.iWidth);x+=10)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
for(TInt y=drawRect.iTl.iY;y<(drawRect.iBr.iY-arcSize.iHeight);y+=10)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
::Clear(aGraphicsContext);
|
sl@0
|
237 |
aGraphicsContext->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
238 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0x00, 0x00));
|
sl@0
|
239 |
aGraphicsContext->SetPenSize(TSize(1, 1));
|
sl@0
|
240 |
TPoint pt(x, y);
|
sl@0
|
241 |
TRect rc(pt, arcSize);
|
sl@0
|
242 |
TPoint pt1(x, y + arcSize.iHeight / 2);
|
sl@0
|
243 |
TPoint pt2(x + arcSize.iWidth, y + arcSize.iHeight / 2);
|
sl@0
|
244 |
//RDebug::Print(_L("DrawArc %d, %d, %d, %d || %d, %d, %d, %d\r\n"), rc.iTl.iX, rc.iTl.iY, rc.iBr.iX, rc.iBr.iY, pt1.iX, pt1.iY, pt2.iX, pt2.iY);
|
sl@0
|
245 |
aGraphicsContext->DrawArc(rc, pt1, pt2);
|
sl@0
|
246 |
//RDebug::Print(_L("DrawArc %d, %d, %d, %d || %d, %d, %d, %d\r\n"), rc.iTl.iX, rc.iTl.iY, rc.iBr.iX, rc.iBr.iY, pt2.iX, pt2.iY, pt1.iX, pt1.iY);
|
sl@0
|
247 |
aGraphicsContext->DrawArc(rc, pt2, pt1);
|
sl@0
|
248 |
//RDebug::Print(_L("DrawPie %d, %d, %d, %d || %d, %d, %d, %d\r\n"), rc.iTl.iX, rc.iTl.iY, rc.iBr.iX, rc.iBr.iY, pt1.iX, pt1.iY, pt2.iX, pt2.iY);
|
sl@0
|
249 |
aGraphicsContext->DrawPie(rc, pt1, pt2);
|
sl@0
|
250 |
//RDebug::Print(_L("DrawPie %d, %d, %d, %d || %d, %d, %d, %d\r\n"), rc.iTl.iX, rc.iTl.iY, rc.iBr.iX, rc.iBr.iY, pt2.iX, pt2.iY, pt1.iX, pt1.iY);
|
sl@0
|
251 |
aGraphicsContext->DrawPie(rc, pt2, pt1);
|
sl@0
|
252 |
|
sl@0
|
253 |
TRect rc2(TPoint(x + arcSize.iWidth + 1, y), arcSize);
|
sl@0
|
254 |
|
sl@0
|
255 |
//RDebug::Print(_L("DrawRoundRect %d, %d, %d, %d\r\n"), rc.iTl.iX, rc.iTl.iY, rc.iBr.iX, rc.iBr.iY);
|
sl@0
|
256 |
aGraphicsContext->DrawRoundRect(rc2, TSize(4, 4));
|
sl@0
|
257 |
aScreenDevice->Update();
|
sl@0
|
258 |
}
|
sl@0
|
259 |
}
|
sl@0
|
260 |
}
|
sl@0
|
261 |
|
sl@0
|
262 |
//CFbsBitGc::DrawPolyLine(), CFbsBitGc::DrawPolygon() test
|
sl@0
|
263 |
void CTBitgdiScaling::TestPolyL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
264 |
{
|
sl@0
|
265 |
INFO_PRINTF1(_L("DrawPolyLine(), DrawPolygon() - Neg.coord."));
|
sl@0
|
266 |
|
sl@0
|
267 |
TRect drawRect;
|
sl@0
|
268 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
269 |
|
sl@0
|
270 |
for(TInt x=drawRect.iTl.iX;x<drawRect.iBr.iX;x+=10)
|
sl@0
|
271 |
{
|
sl@0
|
272 |
for(TInt y=drawRect.iTl.iY;y<drawRect.iBr.iY;y+=10)
|
sl@0
|
273 |
{
|
sl@0
|
274 |
::Clear(aGraphicsContext);
|
sl@0
|
275 |
aGraphicsContext->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
276 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0x00, 0x00));
|
sl@0
|
277 |
aGraphicsContext->SetPenSize(TSize(1, 1));
|
sl@0
|
278 |
|
sl@0
|
279 |
CPointArray* points = new (ELeave) CPointArray (10);
|
sl@0
|
280 |
CleanupStack::PushL(points);
|
sl@0
|
281 |
TPoint pt(x, y);
|
sl@0
|
282 |
points->AppendL(pt);
|
sl@0
|
283 |
pt.SetXY(x + 20, y + 20);
|
sl@0
|
284 |
points->AppendL(pt);
|
sl@0
|
285 |
pt.SetXY(x + 20, y + 40);
|
sl@0
|
286 |
points->AppendL(pt);
|
sl@0
|
287 |
pt.SetXY(x - 5, y + 14);
|
sl@0
|
288 |
points->AppendL(pt);
|
sl@0
|
289 |
pt.SetXY(x, y);
|
sl@0
|
290 |
points->AppendL(pt);
|
sl@0
|
291 |
|
sl@0
|
292 |
TPoint pointList[3];
|
sl@0
|
293 |
pointList[0].SetXY(10,10);
|
sl@0
|
294 |
pointList[1].SetXY(50,50);
|
sl@0
|
295 |
pointList[2].SetXY(75,75);
|
sl@0
|
296 |
aGraphicsContext->DrawPolyLine(pointList,3);
|
sl@0
|
297 |
//RDebug::Print(_L("DrawPolyLine %d, %d\r\n"), x, y);
|
sl@0
|
298 |
aGraphicsContext->DrawPolyLine(points);
|
sl@0
|
299 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
300 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
301 |
//RDebug::Print(_L("DrawPolygon %d, %d\r\n"), x, y);
|
sl@0
|
302 |
aGraphicsContext->DrawPolygon(points, CGraphicsContext::EWinding);
|
sl@0
|
303 |
|
sl@0
|
304 |
aScreenDevice->Update();
|
sl@0
|
305 |
CleanupStack::PopAndDestroy(points);
|
sl@0
|
306 |
}
|
sl@0
|
307 |
}
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
//CFbsBitGc::DrawEllipse(), CFbsBitGc::DrawLine(), CFbsBitGc::DrawRect() test
|
sl@0
|
311 |
void CTBitgdiScaling::TestEllipseLineRect(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
312 |
{
|
sl@0
|
313 |
INFO_PRINTF1(_L("DrawEllipse(), DrawLine() - Neg.coord."));
|
sl@0
|
314 |
|
sl@0
|
315 |
TRect drawRect;
|
sl@0
|
316 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
317 |
|
sl@0
|
318 |
for(TInt x=drawRect.iTl.iX;x<drawRect.iBr.iX;x+=10)
|
sl@0
|
319 |
{
|
sl@0
|
320 |
for(TInt y=drawRect.iTl.iY;y<drawRect.iBr.iY;y+=10)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
::Clear(aGraphicsContext);
|
sl@0
|
323 |
aGraphicsContext->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
324 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0x00, 0x00));
|
sl@0
|
325 |
aGraphicsContext->SetPenSize(TSize(1, 1));
|
sl@0
|
326 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
327 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
328 |
//RDebug::Print(_L("DrawEllipse %d, %d %d %d\r\n"), x, y, x + 20, y + 10);
|
sl@0
|
329 |
aGraphicsContext->DrawEllipse(TRect(x, y, x + 20, y + 10));
|
sl@0
|
330 |
//RDebug::Print(_L("DrawEllipse %d, %d %d %d\r\n"), x + 20, y + 10, x + 40, y);
|
sl@0
|
331 |
aGraphicsContext->DrawLine(TPoint(x + 20, y + 10), TPoint(x + 40, y));
|
sl@0
|
332 |
//RDebug::Print(_L("DrawRect %d, %d %d %d\r\n"), x + 42, y, x + 52, y + 20);
|
sl@0
|
333 |
aGraphicsContext->DrawRect(TRect(x + 42, y, x + 52, y + 20));
|
sl@0
|
334 |
aScreenDevice->Update();
|
sl@0
|
335 |
}
|
sl@0
|
336 |
}
|
sl@0
|
337 |
}
|
sl@0
|
338 |
|
sl@0
|
339 |
//CFbsBitGc::DrawText() test
|
sl@0
|
340 |
void CTBitgdiScaling::TestText(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext, CFont*)
|
sl@0
|
341 |
{
|
sl@0
|
342 |
INFO_PRINTF1(_L("DrawText() - Neg.coord."));
|
sl@0
|
343 |
|
sl@0
|
344 |
TRect drawRect;
|
sl@0
|
345 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
346 |
|
sl@0
|
347 |
_LIT(KText,"T1234567890QWERTY");
|
sl@0
|
348 |
for(TInt xx=(drawRect.iTl.iX-40);xx<(drawRect.iBr.iX+40);xx+=22)
|
sl@0
|
349 |
{
|
sl@0
|
350 |
for(TInt yy=(drawRect.iTl.iY-40);yy<(drawRect.iBr.iY+40);yy+=17)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
::Clear(aGraphicsContext);
|
sl@0
|
353 |
aGraphicsContext->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
354 |
aGraphicsContext->SetPenColor(TRgb::Gray256(0x00));
|
sl@0
|
355 |
aGraphicsContext->SetPenSize(TSize(1,1));
|
sl@0
|
356 |
|
sl@0
|
357 |
//RDebug::Print(_L("DrawText %d, %d\r\n"), xx, yy);
|
sl@0
|
358 |
aGraphicsContext->DrawText(KText, TPoint(xx,yy));
|
sl@0
|
359 |
aScreenDevice->Update();
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
}
|
sl@0
|
363 |
|
sl@0
|
364 |
//CFbsBitGc::DrawTextVertical() test
|
sl@0
|
365 |
void CTBitgdiScaling::TestTextVertical(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext, CFont*)
|
sl@0
|
366 |
{
|
sl@0
|
367 |
INFO_PRINTF1(_L("DrawTextVertical() - Neg.coord."));
|
sl@0
|
368 |
|
sl@0
|
369 |
TRect drawRect;
|
sl@0
|
370 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
371 |
|
sl@0
|
372 |
for(TInt x=(drawRect.iTl.iX-40);x<(drawRect.iBr.iX+40);x+=22)
|
sl@0
|
373 |
{
|
sl@0
|
374 |
for(TInt y=(drawRect.iTl.iY-40);y<(drawRect.iBr.iY+40);y+=17)
|
sl@0
|
375 |
{
|
sl@0
|
376 |
::Clear(aGraphicsContext);
|
sl@0
|
377 |
aGraphicsContext->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
378 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0x00, 0x00));
|
sl@0
|
379 |
aGraphicsContext->SetPenSize(TSize(1, 1));
|
sl@0
|
380 |
|
sl@0
|
381 |
//RDebug::Print(_L("DrawTextVertical %d, %d Down\r\n"), x, y);
|
sl@0
|
382 |
aGraphicsContext->DrawTextVertical(_L("Test text"), TPoint(x, y), ETrue);
|
sl@0
|
383 |
//RDebug::Print(_L("DrawTextVertical %d, %d Up\r\n"), x + 10, y);
|
sl@0
|
384 |
aGraphicsContext->DrawTextVertical(_L("Test text"), TPoint(x + 10, y), EFalse);
|
sl@0
|
385 |
aGraphicsContext->DrawTextVertical(_L("Test text "),drawRect, EFalse);
|
sl@0
|
386 |
aGraphicsContext->DrawTextVertical(_L("Test text "),drawRect, ETrue);
|
sl@0
|
387 |
|
sl@0
|
388 |
aScreenDevice->Update();
|
sl@0
|
389 |
}
|
sl@0
|
390 |
}
|
sl@0
|
391 |
}
|
sl@0
|
392 |
|
sl@0
|
393 |
//CFbsBitGc::MapColors() test
|
sl@0
|
394 |
void CTBitgdiScaling::TestMapColors(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
395 |
{
|
sl@0
|
396 |
INFO_PRINTF1(_L("MapColors() - Neg.coord."));
|
sl@0
|
397 |
|
sl@0
|
398 |
::Clear(aGraphicsContext);
|
sl@0
|
399 |
|
sl@0
|
400 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
401 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
402 |
|
sl@0
|
403 |
TRect rc(-10, -10, 10, 10);
|
sl@0
|
404 |
aGraphicsContext->DrawRect(rc);
|
sl@0
|
405 |
aScreenDevice->Update();
|
sl@0
|
406 |
|
sl@0
|
407 |
TRgb colors[] = {TRgb(0xCC, 0x33, 0x66), TRgb(0x00, 0x00, 0xFF)};
|
sl@0
|
408 |
//RDebug::Print(_L("MapColors %d, %d, %d, %d\r\n"), rc.iTl.iX, rc.iTl.iY, rc.iBr.iX, rc.iBr.iY);
|
sl@0
|
409 |
aGraphicsContext->MapColors(rc, colors);
|
sl@0
|
410 |
aScreenDevice->Update();
|
sl@0
|
411 |
}
|
sl@0
|
412 |
|
sl@0
|
413 |
//CFbsBitGc::ShadowArea(), CFbsBitGc::FadeArea() test
|
sl@0
|
414 |
void CTBitgdiScaling::TestShadowFade(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
415 |
{
|
sl@0
|
416 |
INFO_PRINTF1(_L("ShadowArea(), FadeArea() - Neg.coord."));
|
sl@0
|
417 |
|
sl@0
|
418 |
TRect drawRect;
|
sl@0
|
419 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
420 |
|
sl@0
|
421 |
for(TInt x=(drawRect.iTl.iX - 20);x<(drawRect.iBr.iX+37);x+=17)
|
sl@0
|
422 |
{
|
sl@0
|
423 |
for(TInt y=(drawRect.iTl.iY-20);y<(drawRect.iBr.iY+37);y+=19)
|
sl@0
|
424 |
{
|
sl@0
|
425 |
TRect rc1(x, y, x + 20, y + 25);
|
sl@0
|
426 |
TRect rc2(x + 20, y + 5, x + 45, y + 20);
|
sl@0
|
427 |
|
sl@0
|
428 |
::Clear(aGraphicsContext);
|
sl@0
|
429 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
430 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
431 |
//RDebug::Print(_L("MapColors %d, %d, %d, %d\r\n"), rc1.iTl.iX, rc1.iTl.iY, rc1.iBr.iX, rc1.iBr.iY);
|
sl@0
|
432 |
aGraphicsContext->DrawRect(rc1);
|
sl@0
|
433 |
//RDebug::Print(_L("MapColors %d, %d, %d, %d\r\n"), rc2.iTl.iX, rc2.iTl.iY, rc2.iBr.iX, rc2.iBr.iY);
|
sl@0
|
434 |
aGraphicsContext->DrawRect(rc2);
|
sl@0
|
435 |
|
sl@0
|
436 |
RRegion shadowRgn;
|
sl@0
|
437 |
shadowRgn.AddRect(rc1);
|
sl@0
|
438 |
shadowRgn.AddRect(rc2);
|
sl@0
|
439 |
//RDebug::Print(_L("ShadowArea\r\n"));
|
sl@0
|
440 |
aGraphicsContext->ShadowArea(&shadowRgn);
|
sl@0
|
441 |
shadowRgn.Close();
|
sl@0
|
442 |
|
sl@0
|
443 |
aScreenDevice->Update();
|
sl@0
|
444 |
|
sl@0
|
445 |
::Clear(aGraphicsContext);
|
sl@0
|
446 |
aGraphicsContext->SetBrushColor(TRgb(0xFF, 0x00, 0xFF));
|
sl@0
|
447 |
//RDebug::Print(_L("MapColors %d, %d, %d, %d\r\n"), rc1.iTl.iX, rc1.iTl.iY, rc1.iBr.iX, rc1.iBr.iY);
|
sl@0
|
448 |
aGraphicsContext->DrawRect(rc1);
|
sl@0
|
449 |
//RDebug::Print(_L("MapColors %d, %d, %d, %d\r\n"), rc2.iTl.iX, rc2.iTl.iY, rc2.iBr.iX, rc2.iBr.iY);
|
sl@0
|
450 |
aGraphicsContext->DrawRect(rc2);
|
sl@0
|
451 |
|
sl@0
|
452 |
RRegion fadeRgn;
|
sl@0
|
453 |
fadeRgn.AddRect(rc1);
|
sl@0
|
454 |
fadeRgn.AddRect(rc2);
|
sl@0
|
455 |
//RDebug::Print(_L("FadeArea\r\n"));
|
sl@0
|
456 |
aGraphicsContext->FadeArea(&fadeRgn);
|
sl@0
|
457 |
fadeRgn.Close();
|
sl@0
|
458 |
|
sl@0
|
459 |
aScreenDevice->Update();
|
sl@0
|
460 |
}
|
sl@0
|
461 |
}
|
sl@0
|
462 |
}
|
sl@0
|
463 |
|
sl@0
|
464 |
/**
|
sl@0
|
465 |
@SYMTestCaseID GRAPHICS-CODEBASE-BITGDI-0004
|
sl@0
|
466 |
|
sl@0
|
467 |
@SYMPREQ PGM027
|
sl@0
|
468 |
|
sl@0
|
469 |
@SYMTestCaseDesc TestMove
|
sl@0
|
470 |
|
sl@0
|
471 |
@SYMTestPriority 1
|
sl@0
|
472 |
|
sl@0
|
473 |
@SYMTestStatus Implemented
|
sl@0
|
474 |
|
sl@0
|
475 |
@SYMTestActions Draw the line using using DrawLine and move the line using MoveLine(),MoveBy()
|
sl@0
|
476 |
Then test the same for all orientaion.
|
sl@0
|
477 |
|
sl@0
|
478 |
@SYMTestExpectedResults Test should perform graphics operations succesfully.
|
sl@0
|
479 |
|
sl@0
|
480 |
*/
|
sl@0
|
481 |
|
sl@0
|
482 |
void CTBitgdiScaling::TestMove(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
483 |
{
|
sl@0
|
484 |
INFO_PRINTF1(_L("CODEBASE TEST 1 - TestMove Started"));
|
sl@0
|
485 |
TRect drawRect;
|
sl@0
|
486 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
487 |
for(TInt x=drawRect.iTl.iX;x<drawRect.iBr.iX;x+=10)
|
sl@0
|
488 |
{
|
sl@0
|
489 |
for(TInt y=drawRect.iTl.iY;y<drawRect.iBr.iY;y+=10)
|
sl@0
|
490 |
{
|
sl@0
|
491 |
::Clear(aGraphicsContext);
|
sl@0
|
492 |
aGraphicsContext->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
493 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0x00, 0x00));
|
sl@0
|
494 |
aGraphicsContext->SetPenSize(TSize(1, 1));
|
sl@0
|
495 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
496 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
497 |
aGraphicsContext->DrawLine(TPoint(x + 20, y + 10), TPoint(x + 40, y));
|
sl@0
|
498 |
aGraphicsContext->MoveTo(TPoint(100,100));
|
sl@0
|
499 |
aGraphicsContext->DrawLine(TPoint(x + 40, y + 50), TPoint(x + 70, y));
|
sl@0
|
500 |
aGraphicsContext->MoveTo(TPoint(100,100));
|
sl@0
|
501 |
aGraphicsContext->MoveBy(TPoint(0,-70));
|
sl@0
|
502 |
aGraphicsContext->DrawLineBy(TPoint(0,60));
|
sl@0
|
503 |
aGraphicsContext->MoveBy(TPoint(-70,70));
|
sl@0
|
504 |
aGraphicsContext->DrawLineBy(TPoint(60,0));
|
sl@0
|
505 |
aScreenDevice->Update();
|
sl@0
|
506 |
|
sl@0
|
507 |
}
|
sl@0
|
508 |
}
|
sl@0
|
509 |
INFO_PRINTF1(_L("CODEBASE TEST 1 - TestMove Finished"));
|
sl@0
|
510 |
}
|
sl@0
|
511 |
|
sl@0
|
512 |
/**
|
sl@0
|
513 |
@SYMTestCaseID GRAPHICS-CODEBASE-BITGDI-0005
|
sl@0
|
514 |
|
sl@0
|
515 |
@SYMPREQ PGM027
|
sl@0
|
516 |
|
sl@0
|
517 |
@SYMTestCaseDesc TestEllipseRect
|
sl@0
|
518 |
|
sl@0
|
519 |
@SYMTestPriority 1
|
sl@0
|
520 |
|
sl@0
|
521 |
@SYMTestStatus Implemented
|
sl@0
|
522 |
|
sl@0
|
523 |
@SYMTestActions Draw the Rectangle with black color and pass the same rectagle in to the
|
sl@0
|
524 |
DrawEllipse() with red color brush then check for Ellipse and Rectangle color are properly
|
sl@0
|
525 |
drawn respectively then test the same for all orientaion.
|
sl@0
|
526 |
|
sl@0
|
527 |
@SYMTestExpectedResults Test should perform graphics operations succesfully.
|
sl@0
|
528 |
|
sl@0
|
529 |
*/
|
sl@0
|
530 |
|
sl@0
|
531 |
void CTBitgdiScaling::TestEllipseRect(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
532 |
{
|
sl@0
|
533 |
INFO_PRINTF1(_L(" TestEllipseRect Started"));
|
sl@0
|
534 |
TRect drawRect;
|
sl@0
|
535 |
aScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
536 |
aGraphicsContext->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
537 |
aGraphicsContext->SetPenColor(TRgb(0x00, 0x00, 0x00));
|
sl@0
|
538 |
aGraphicsContext->SetPenSize(TSize(4,4));
|
sl@0
|
539 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
540 |
aGraphicsContext->SetBrushColor(TRgb(0x00, 0x00, 0x255));
|
sl@0
|
541 |
TRect rrect1(20, 20, 40, 40);
|
sl@0
|
542 |
aGraphicsContext->DrawRect(rrect1);
|
sl@0
|
543 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
544 |
aGraphicsContext->SetBrushColor(TRgb(0x255, 0x00, 0x00));
|
sl@0
|
545 |
TRect erect1(20, 20, 40, 40);
|
sl@0
|
546 |
aGraphicsContext->DrawEllipse(erect1);
|
sl@0
|
547 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
548 |
aGraphicsContext->SetBrushColor(TRgb(0x00, 0x00, 0x255));
|
sl@0
|
549 |
TRect rrect2(40, 40, 60, 60);
|
sl@0
|
550 |
aGraphicsContext->DrawRect(rrect2);
|
sl@0
|
551 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
552 |
aGraphicsContext->SetBrushColor(TRgb(0x255, 0x00, 0x00));
|
sl@0
|
553 |
TRect erect2(40, 40, 60, 60);
|
sl@0
|
554 |
aGraphicsContext->DrawEllipse(erect2);
|
sl@0
|
555 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
556 |
aGraphicsContext->SetBrushColor(TRgb(0x00, 0x00, 0x255));
|
sl@0
|
557 |
TRect rllrect3(60, 60, 80, 80);
|
sl@0
|
558 |
aGraphicsContext->DrawRect(rllrect3);
|
sl@0
|
559 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
560 |
aGraphicsContext->SetBrushColor(TRgb(0x255, 0x00, 0x00));
|
sl@0
|
561 |
TRect ellrect3(60, 60, 80, 80);
|
sl@0
|
562 |
aGraphicsContext->DrawEllipse(ellrect3);
|
sl@0
|
563 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
564 |
aGraphicsContext->SetBrushColor(TRgb(0x00, 0x00, 0x255));
|
sl@0
|
565 |
TRect rllrect4(80, 80,100,100);
|
sl@0
|
566 |
aGraphicsContext->DrawRect(rllrect4);
|
sl@0
|
567 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
568 |
aGraphicsContext->SetBrushColor(TRgb(0x255, 0x00, 0x00));
|
sl@0
|
569 |
TRect ellrect4(80, 80,100,100);
|
sl@0
|
570 |
aGraphicsContext->DrawEllipse(ellrect4);
|
sl@0
|
571 |
aScreenDevice->Update();
|
sl@0
|
572 |
INFO_PRINTF1(_L(" TestEllipseRect Finished"));
|
sl@0
|
573 |
|
sl@0
|
574 |
}
|
sl@0
|
575 |
|
sl@0
|
576 |
/**
|
sl@0
|
577 |
@SYMTestCaseID GRAPHICS-CODEBASE-BITGDI-0006
|
sl@0
|
578 |
|
sl@0
|
579 |
@SYMPREQ PGM027
|
sl@0
|
580 |
|
sl@0
|
581 |
@SYMTestCaseDesc TestDrawBitmapNegL
|
sl@0
|
582 |
|
sl@0
|
583 |
@SYMTestPriority 1
|
sl@0
|
584 |
|
sl@0
|
585 |
@SYMTestStatus Implemented
|
sl@0
|
586 |
|
sl@0
|
587 |
@SYMTestActions Draw the Bitmap using DrawBitmap() with the TRect passing negative values.
|
sl@0
|
588 |
then test the same for all orientaion.
|
sl@0
|
589 |
|
sl@0
|
590 |
@SYMTestExpectedResults Test should perform graphics operations succesfully.
|
sl@0
|
591 |
|
sl@0
|
592 |
*/
|
sl@0
|
593 |
|
sl@0
|
594 |
void CTBitgdiScaling::TestDrawBitmapNegL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
595 |
{
|
sl@0
|
596 |
INFO_PRINTF1(_L(" TestDrawBitmapNegL Started"));
|
sl@0
|
597 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
|
sl@0
|
598 |
CleanupStack::PushL(bitmap);
|
sl@0
|
599 |
|
sl@0
|
600 |
bitmap->Reset();
|
sl@0
|
601 |
User::LeaveIfError(bitmap->Load(KTestBmp, 0));
|
sl@0
|
602 |
|
sl@0
|
603 |
::Clear(aGraphicsContext);
|
sl@0
|
604 |
TSize size = bitmap->SizeInPixels();
|
sl@0
|
605 |
//RDebug::Print(_L("DrawBitmap %d, %d, %d, %d\r\n"), 0, 0, size.iWidth, size.iHeight);
|
sl@0
|
606 |
aGraphicsContext->DrawBitmap(TRect(-100,-100, size.iWidth, size.iHeight), bitmap);
|
sl@0
|
607 |
aScreenDevice->Update();
|
sl@0
|
608 |
|
sl@0
|
609 |
CleanupStack::PopAndDestroy(bitmap);
|
sl@0
|
610 |
INFO_PRINTF1(_L(" TestDrawBitmapNegL Finished"));
|
sl@0
|
611 |
}
|
sl@0
|
612 |
/**
|
sl@0
|
613 |
@SYMTestCaseID GRAPHICS-CODEBASE-BITGDI-0007
|
sl@0
|
614 |
|
sl@0
|
615 |
@SYMPREQ PGM027
|
sl@0
|
616 |
|
sl@0
|
617 |
@SYMTestCaseDesc TestMapColorsZero
|
sl@0
|
618 |
|
sl@0
|
619 |
@SYMTestPriority 1
|
sl@0
|
620 |
|
sl@0
|
621 |
@SYMTestStatus Implemented
|
sl@0
|
622 |
|
sl@0
|
623 |
@SYMTestActions Mapthe pixels in the specified rectangle which size is zero using MapColors() with the TRect passing negative values.
|
sl@0
|
624 |
then test the same for all orientaion.
|
sl@0
|
625 |
|
sl@0
|
626 |
@SYMTestExpectedResults Test should perform graphics operations succesfully.
|
sl@0
|
627 |
|
sl@0
|
628 |
*/
|
sl@0
|
629 |
void CTBitgdiScaling::TestMapColorsZero(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
|
sl@0
|
630 |
{
|
sl@0
|
631 |
INFO_PRINTF1(_L(" TestMapColorsZero Started"));
|
sl@0
|
632 |
|
sl@0
|
633 |
::Clear(aGraphicsContext);
|
sl@0
|
634 |
|
sl@0
|
635 |
aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
636 |
aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
|
sl@0
|
637 |
|
sl@0
|
638 |
TRect rc(0, 0, 0, 0);
|
sl@0
|
639 |
aGraphicsContext->DrawRect(rc);
|
sl@0
|
640 |
aScreenDevice->Update();
|
sl@0
|
641 |
|
sl@0
|
642 |
TRgb colors[] = {TRgb(0xCC, 0x33, 0x66), TRgb(0x00, 0x00, 0xFF)};
|
sl@0
|
643 |
|
sl@0
|
644 |
aGraphicsContext->MapColors(rc, colors);
|
sl@0
|
645 |
aScreenDevice->Update();
|
sl@0
|
646 |
INFO_PRINTF1(_L(" TestMapColorsZero Finished"));
|
sl@0
|
647 |
}
|
sl@0
|
648 |
|
sl@0
|
649 |
/**
|
sl@0
|
650 |
@SYMTestCaseID GRAPHICS-BITGDI-0037
|
sl@0
|
651 |
|
sl@0
|
652 |
@SYMDEF
|
sl@0
|
653 |
|
sl@0
|
654 |
@SYMTestCaseDesc tests drawing various graphic primitives to the screen device set to different orientations
|
sl@0
|
655 |
|
sl@0
|
656 |
@SYMTestPriority High
|
sl@0
|
657 |
|
sl@0
|
658 |
@SYMTestStatus Implemented
|
sl@0
|
659 |
|
sl@0
|
660 |
@SYMTestActions Iterates through a series of screen rotations and draws graphic primitives to the screen
|
sl@0
|
661 |
|
sl@0
|
662 |
@SYMTestExpectedResults Test should perform graphics operations succesfully.
|
sl@0
|
663 |
*/
|
sl@0
|
664 |
void CTBitgdiScaling::RunTests2L()
|
sl@0
|
665 |
{
|
sl@0
|
666 |
CFont* font = ::SetFontL(iScreenDevice, iGraphicsContext);
|
sl@0
|
667 |
iGraphicsContext->Clear();
|
sl@0
|
668 |
//Scaling origin
|
sl@0
|
669 |
const TPoint ptOrigin(73, 53);
|
sl@0
|
670 |
TInt err = iScreenDevice->SetScalingFactor(ptOrigin, KScalingFactorX, KScalingFactorY, 1, 1);
|
sl@0
|
671 |
TEST2(err, KErrNone);
|
sl@0
|
672 |
iGraphicsContext->Activate(iScreenDevice);
|
sl@0
|
673 |
|
sl@0
|
674 |
const CFbsBitGc::TGraphicsOrientation KOrientation[] =
|
sl@0
|
675 |
{
|
sl@0
|
676 |
CFbsBitGc::EGraphicsOrientationNormal,
|
sl@0
|
677 |
CFbsBitGc::EGraphicsOrientationRotated90,
|
sl@0
|
678 |
CFbsBitGc::EGraphicsOrientationRotated180,
|
sl@0
|
679 |
CFbsBitGc::EGraphicsOrientationRotated270
|
sl@0
|
680 |
};
|
sl@0
|
681 |
|
sl@0
|
682 |
for(TInt ii=0;ii<TInt(sizeof(KOrientation)/sizeof(KOrientation[0]));++ii)
|
sl@0
|
683 |
{
|
sl@0
|
684 |
if(!iGraphicsContext->SetOrientation(KOrientation[ii]))
|
sl@0
|
685 |
{
|
sl@0
|
686 |
continue;
|
sl@0
|
687 |
}
|
sl@0
|
688 |
_LIT(KRotation,"===EOrientation%S===");
|
sl@0
|
689 |
INFO_PRINTF2(KRotation,&RotationName(KOrientation[ii]));
|
sl@0
|
690 |
RDebug::Print(KRotation,&RotationName(KOrientation[ii]));
|
sl@0
|
691 |
TRect drawRect;
|
sl@0
|
692 |
iScreenDevice->GetDrawRect(drawRect);
|
sl@0
|
693 |
INFO_PRINTF5(_L("Drawing rectangle: %d %d %d %d"),
|
sl@0
|
694 |
drawRect.iTl.iX, drawRect.iTl.iY, drawRect.iBr.iX, drawRect.iBr.iY);
|
sl@0
|
695 |
|
sl@0
|
696 |
TestDrawBitmapL(iScreenDevice, iGraphicsContext);
|
sl@0
|
697 |
TestClear(iScreenDevice, iGraphicsContext);
|
sl@0
|
698 |
TestBitbltL(iScreenDevice, iGraphicsContext);
|
sl@0
|
699 |
TestArcPie(iScreenDevice, iGraphicsContext);
|
sl@0
|
700 |
TestPolyL(iScreenDevice, iGraphicsContext);
|
sl@0
|
701 |
TestEllipseLineRect(iScreenDevice, iGraphicsContext);
|
sl@0
|
702 |
TestText(iScreenDevice, iGraphicsContext, font);
|
sl@0
|
703 |
iGraphicsContext->SetUnderlineStyle(EUnderlineOn);
|
sl@0
|
704 |
TestText(iScreenDevice, iGraphicsContext, font);
|
sl@0
|
705 |
iGraphicsContext->SetStrikethroughStyle(EStrikethroughOn);
|
sl@0
|
706 |
TestText(iScreenDevice, iGraphicsContext, font);
|
sl@0
|
707 |
iGraphicsContext->SetUnderlineStyle(EUnderlineOff);
|
sl@0
|
708 |
iGraphicsContext->SetStrikethroughStyle(EStrikethroughOff);
|
sl@0
|
709 |
TestTextVertical(iScreenDevice, iGraphicsContext, font);
|
sl@0
|
710 |
TestMapColors(iScreenDevice, iGraphicsContext);
|
sl@0
|
711 |
TestShadowFade(iScreenDevice, iGraphicsContext);
|
sl@0
|
712 |
((CTBitgdiScalingStep*)iStep)->RecordTestResultL();
|
sl@0
|
713 |
((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-BITGDI-0004"));
|
sl@0
|
714 |
TestMove(iScreenDevice, iGraphicsContext);
|
sl@0
|
715 |
((CTBitgdiScalingStep*)iStep)->RecordTestResultL();
|
sl@0
|
716 |
((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-BITGDI-0005"));
|
sl@0
|
717 |
TestEllipseRect(iScreenDevice, iGraphicsContext);
|
sl@0
|
718 |
((CTBitgdiScalingStep*)iStep)->RecordTestResultL();
|
sl@0
|
719 |
((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-BITGDI-0007"));
|
sl@0
|
720 |
TestMapColorsZero(iScreenDevice, iGraphicsContext);
|
sl@0
|
721 |
((CTBitgdiScalingStep*)iStep)->RecordTestResultL();
|
sl@0
|
722 |
((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-BITGDI-0007"));
|
sl@0
|
723 |
TestDrawBitmapNegL(iScreenDevice, iGraphicsContext);
|
sl@0
|
724 |
((CTBitgdiScalingStep*)iStep)->RecordTestResultL();
|
sl@0
|
725 |
iGraphicsContext->Clear();
|
sl@0
|
726 |
}
|
sl@0
|
727 |
|
sl@0
|
728 |
iGraphicsContext->Clear();
|
sl@0
|
729 |
iScreenDevice->ReleaseFont(font);
|
sl@0
|
730 |
iGraphicsContext->SetOrientation(CFbsBitGc::EGraphicsOrientationNormal);
|
sl@0
|
731 |
}
|