windowing/windowserver/tauto/TAlphaChannel.CPP
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // An alpha channel test case. 
       
    15 // Output different graphics primitives in each window using three graphics modes
       
    16 // for pen and brush : semi-transparent,transparent, opaque
       
    17 // Test also exercises anti-aliasing and fading for 16MA display mode
       
    18 // Moves sprite on the window. Tests a sprite functionality.
       
    19 // Creates RBackedUpWindow window and moves it over transparent window,
       
    20 // hides and shows it.
       
    21 // Moves windows on the screen, overlaps them
       
    22 // Actions:
       
    23 // Create a background window, and five foreground windows:
       
    24 // -transparent and semi-transparent 
       
    25 // -transparent with transparency factor
       
    26 // -not transparent
       
    27 // 
       
    28 //
       
    29 
       
    30 #include "TAlphaChannel.H"
       
    31 
       
    32 const TInt KWindowIndention = 2;
       
    33 const TInt KSizeKoeff = 15;
       
    34 
       
    35 
       
    36 LOCAL_D TPtrC ColumnName[]={
       
    37 	_L("Opaque"),
       
    38 	_L("Semi-transparent"),
       
    39 	_L("Transparent"),
       
    40 	_L(""),
       
    41 	_L(""),
       
    42 	_L(""),
       
    43 	};
       
    44 
       
    45 LOCAL_D TPtrC RowName[]={
       
    46 	_L("n"),
       
    47 	_L("and"),
       
    48 	_L("or"),
       
    49 	_L("xor"),
       
    50 	_L(""),
       
    51 	_L(""),
       
    52 	};
       
    53 
       
    54 
       
    55 //
       
    56 //
       
    57 CTAlphaChannel::CTAlphaChannel(CTestStep* aStep):
       
    58 	CTWsGraphicsBase(aStep), iArrWindow(8)
       
    59 	{
       
    60 	}
       
    61 
       
    62 CTAlphaChannel::~CTAlphaChannel()
       
    63 	{
       
    64 	delete iBitmap64K_1;
       
    65 	delete iBitmap16MA_1;
       
    66 	delete iBitmap64K_2;
       
    67 	delete iBitmap16MA_2;
       
    68 	delete iBitmap64K_3;
       
    69 	delete iBitmap16MA_3;
       
    70 
       
    71 	delete iBitmapMask;
       
    72 	delete iBitmapGray256Mask;
       
    73 	
       
    74 	delete iBitmapContext64K_1;
       
    75 	delete iBitmapContext16MA_1;
       
    76 	delete iBitmapContext64K_2;
       
    77 	delete iBitmapContext16MA_2;
       
    78 	delete iBitmapContext64K_3;
       
    79 	delete iBitmapContext16MA_3;
       
    80 
       
    81 	delete iBitmapDevice64K_1;
       
    82 	delete iBitmapDevice16MA_1;
       
    83 	delete iBitmapDevice64K_2;
       
    84 	delete iBitmapDevice16MA_2;
       
    85 	delete iBitmapDevice64K_3;
       
    86 	delete iBitmapDevice16MA_3;
       
    87 
       
    88 	delete iBackgroundWindow;
       
    89 	
       
    90 	
       
    91 	iArrWindow.ResetAndDestroy();
       
    92 	
       
    93 	if(iFont)
       
    94 		TheClient->iScreen->ReleaseFont(iFont);
       
    95 	if(iFont1)
       
    96 		TheClient->iScreen->ReleaseFont(iFont1);
       
    97 	
       
    98 	BaseWin->SetVisible(ETrue);
       
    99 	TestWin->SetVisible(ETrue);
       
   100 	}
       
   101 
       
   102 void CTAlphaChannel::ConstructL()
       
   103 	{
       
   104 	const TInt KIndent = 10;
       
   105 	BaseWin->SetVisible(EFalse);
       
   106 	TestWin->SetVisible(EFalse);
       
   107 
       
   108 	iText = _L("This is a text");
       
   109 	iBrushStyle = CGraphicsContext::ESolidBrush;
       
   110 	iPenTable = KRgbBlack;
       
   111 
       
   112 	TSize screenSize=TheClient->iGroup->Size();
       
   113 	TInt winWidth=(screenSize.iWidth)-KIndent;
       
   114 	TInt winHeight=screenSize.iHeight-KIndent;
       
   115 	TDisplayMode dispMode = EColor64K;
       
   116 	
       
   117 	//background opaque window
       
   118 	iBackgroundWindow = new (ELeave) CTWinAlpha();
       
   119 	iBackgroundWindow->SetUpL(TPoint(5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc, &dispMode);
       
   120 	RWindow *theWin = (RWindow*) (iBackgroundWindow->DrawableWin());
       
   121 	theWin->SetBackgroundColor(TRgb(255, 0, 0));
       
   122 	iBackgroundWindow->DrawNow();
       
   123 
       
   124 	iSizeForegroundWindow.iWidth = (winWidth - KWindowIndention * 4) / 5 ;
       
   125 	iSizeForegroundWindow.iHeight = winHeight;
       
   126 	
       
   127 	CalculateSizePrimitives(iSizeForegroundWindow);
       
   128 
       
   129 	//-------------create bitmaps
       
   130 	//create 64K bitmap
       
   131 	iBitmap64K_1 = new (ELeave) CFbsBitmap ;
       
   132 	iBitmap64K_1->Create(iBitmapSize,EColor64K);
       
   133 	iBitmap64K_2 = new (ELeave) CFbsBitmap ;
       
   134 	iBitmap64K_2->Create(iBitmapSize,EColor64K);
       
   135 	iBitmap64K_3 = new (ELeave) CFbsBitmap ;
       
   136 	iBitmap64K_3->Create(iBitmapSize,EColor64K);
       
   137 	iBitmapDevice64K_1 = CFbsBitmapDevice::NewL(iBitmap64K_1);
       
   138 	iBitmapDevice64K_1->CreateContext(iBitmapContext64K_1);
       
   139 	iBitmapDevice64K_2 = CFbsBitmapDevice::NewL(iBitmap64K_2);
       
   140 	iBitmapDevice64K_2->CreateContext(iBitmapContext64K_2);
       
   141 	iBitmapDevice64K_3 = CFbsBitmapDevice::NewL(iBitmap64K_3);
       
   142 	iBitmapDevice64K_3->CreateContext(iBitmapContext64K_3);
       
   143 	
       
   144 	//create 16MA bitmap
       
   145 	iBitmap16MA_1 = new (ELeave) CFbsBitmap ;
       
   146 	iBitmap16MA_1->Create(iBitmapSize, EColor16MA);
       
   147 	iBitmap16MA_2 = new (ELeave) CFbsBitmap ;
       
   148 	iBitmap16MA_2->Create(iBitmapSize, EColor16MA);
       
   149 	iBitmap16MA_3 = new (ELeave) CFbsBitmap ;
       
   150 	iBitmap16MA_3->Create(iBitmapSize, EColor16MA);
       
   151 
       
   152 	iBitmapDevice16MA_1 = CFbsBitmapDevice::NewL(iBitmap16MA_1);
       
   153 	iBitmapDevice16MA_1->CreateContext(iBitmapContext16MA_1);
       
   154 	iBitmapDevice16MA_2 = CFbsBitmapDevice::NewL(iBitmap16MA_2);
       
   155 	iBitmapDevice16MA_2->CreateContext(iBitmapContext16MA_2);
       
   156 	iBitmapDevice16MA_3 = CFbsBitmapDevice::NewL(iBitmap16MA_3);
       
   157 	iBitmapDevice16MA_3->CreateContext(iBitmapContext16MA_3);
       
   158 
       
   159 	//create mask bitmap
       
   160 	iBitmapMask = new (ELeave) CFbsBitmap ;
       
   161 	iBitmapMask->Create(iBitmapSize, EGray2);
       
   162 	
       
   163 	CFbsBitmapDevice* theBitmapDevice = CFbsBitmapDevice::NewL(iBitmapMask);
       
   164 	CGraphicsContext*  theBitmapContext = NULL;
       
   165 	theBitmapDevice->CreateContext(theBitmapContext);
       
   166 	TRect rect = TRect(iBitmapMask->SizeInPixels());
       
   167 	theBitmapContext->SetBrushColor(KRgbWhite);
       
   168    	theBitmapContext->SetPenColor(KRgbWhite);
       
   169    	theBitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   170 	theBitmapContext->DrawRect(rect);
       
   171 
       
   172 	rect.Shrink(4, 4);
       
   173 	theBitmapContext->SetBrushColor(KRgbBlack);
       
   174 	theBitmapContext->SetPenColor(KRgbBlack);
       
   175 	theBitmapContext->DrawEllipse(rect);
       
   176 	delete theBitmapContext;
       
   177 	delete theBitmapDevice;
       
   178 	
       
   179 	//create 256gray bitmap mask
       
   180 	iBitmapGray256Mask = new (ELeave) CFbsBitmap;
       
   181 	iBitmapGray256Mask->Create(iBitmapSize, EGray256);
       
   182 	theBitmapDevice = CFbsBitmapDevice::NewL(iBitmapGray256Mask);
       
   183 	theBitmapDevice->CreateContext(theBitmapContext);
       
   184 	
       
   185 	if(iBitmapSize != TSize(0, 0))
       
   186 		{
       
   187 	//fill bitmap with 256 gradation of gray
       
   188 		TInt theStep = 256 / iBitmapGray256Mask->SizeInPixels().iWidth;
       
   189 	
       
   190 		for(TInt ii = 0; ii < iBitmapGray256Mask->SizeInPixels().iWidth; ii++)
       
   191 			{
       
   192 			TInt theSingleCol = theStep * ii; 
       
   193 			TRgb theCol(theSingleCol, theSingleCol, theSingleCol);
       
   194 			theBitmapContext->SetBrushColor(theCol);
       
   195 			theBitmapContext->SetPenColor(theCol);
       
   196 			TPoint ptFrom(ii, 0);
       
   197 			TPoint ptTo(ii, iBitmapGray256Mask->SizeInPixels().iHeight);
       
   198 			theBitmapContext->DrawLine(ptFrom, ptTo);
       
   199 			}
       
   200 		}
       
   201 	delete theBitmapContext;
       
   202 	delete theBitmapDevice;
       
   203 	//--------------
       
   204 	TFontSpec fontSpec(KTestFontTypefaceName,600);
       
   205 
       
   206 	fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
       
   207 	fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
       
   208 	
       
   209 	User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(iFont, fontSpec));
       
   210 	
       
   211 	TFontSpec fontSpec1(KTestFontTypefaceName,100);
       
   212 	User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(iFont1, fontSpec1));
       
   213 	}
       
   214 
       
   215 void CTAlphaChannel::CalculateSizePrimitives(const TSize& aSize)
       
   216 	{
       
   217 	TInt theLen = aSize.iWidth / KSizeKoeff;
       
   218 	
       
   219 	iBitmapSize = TSize(2 * theLen, 2 * theLen);
       
   220 	iRectangleSize = TSize(2 * theLen, 2 * theLen);
       
   221 	iEllipseSize = TSize(4 * theLen, 2 * theLen);
       
   222 	iTriangleSize = TSize(3 * theLen, 2 * theLen);
       
   223 	iFirstCellWidth = static_cast <TInt> (1.2 * theLen);
       
   224 	iFirstCellHeight = static_cast <TInt> (1.5 * theLen);
       
   225 	}
       
   226 
       
   227 void CTAlphaChannel::DrawOffscreenBitmapsL(const TRgb& /*aPen*/, const TRgb& aBrush,
       
   228 										CGraphicsContext* aBitmapContext64K, CGraphicsContext* aBitmapContext16MA, 
       
   229 										CFbsBitmap* aBitmap64K, CFbsBitmap* aBitmap16MA)
       
   230 	{
       
   231 
       
   232 	if(aBitmapContext64K && aBitmap64K)
       
   233 		{
       
   234 		SEpocBitmapHeader header = aBitmap64K->Header();
       
   235 		TInt source_buffer_size = header.iBitmapSize / header.iSizeInPixels.iHeight * header.iBitsPerPixel ;
       
   236 		TUint8* buffer = new(ELeave) TUint8[source_buffer_size];
       
   237 		TPtr8 source_ptr(buffer, source_buffer_size, source_buffer_size);
       
   238 		
       
   239 		TUint16* bufferCur = reinterpret_cast<TUint16*> (buffer);
       
   240 		TInt ii;
       
   241 		for(ii = 0; ii < header.iSizeInPixels.iWidth; ++ii)
       
   242 			{
       
   243 			*bufferCur = aBrush._Color64K();
       
   244 			bufferCur ++;
       
   245 			}
       
   246 	
       
   247 		for(ii = 0; ii < header.iSizeInPixels.iHeight; ++ii)
       
   248 			{
       
   249 			aBitmap64K -> SetScanLine(source_ptr, ii);
       
   250 			}
       
   251 		
       
   252 		delete [] buffer;
       
   253 		}
       
   254 		
       
   255 	if(aBitmapContext16MA && aBitmap16MA)
       
   256 		{
       
   257 		SEpocBitmapHeader header = aBitmap16MA -> Header();
       
   258 		TInt source_buffer_size = header.iBitmapSize / header.iSizeInPixels.iHeight * header.iBitsPerPixel ;
       
   259 		TUint8* buffer = new(ELeave) TUint8[source_buffer_size];
       
   260 		TPtr8 source_ptr(buffer, source_buffer_size, source_buffer_size);
       
   261 		
       
   262 		TUint32* bufferCur = reinterpret_cast<TUint32*> (buffer);
       
   263 		TInt ii;
       
   264 		for(ii = 0; ii < header.iSizeInPixels.iWidth; ++ii)
       
   265 			{
       
   266 			*bufferCur = aBrush._Color16MA();
       
   267 			bufferCur ++;
       
   268 			}
       
   269 	
       
   270 		for(ii = 0; ii < header.iSizeInPixels.iHeight; ++ii)
       
   271 			{
       
   272 			aBitmap16MA -> SetScanLine(source_ptr, ii);
       
   273 			}
       
   274 		
       
   275 		delete [] buffer;
       
   276 		}
       
   277 	
       
   278 	}
       
   279 
       
   280 enum {EOpaque, ESemiTrans, ETrans};
       
   281 
       
   282 TRgb CTAlphaChannel::GetBrush(TInt aIndex) const
       
   283 	{
       
   284 	switch(aIndex)
       
   285 		{
       
   286 			case EOpaque:
       
   287 			return TRgb(0, 0, 255, 255);
       
   288 			case ESemiTrans:
       
   289 			return TRgb(0, 0, 255, 128);
       
   290 			case ETrans:
       
   291 			return TRgb(0, 0, 255, 0);
       
   292 			default : break;
       
   293 		}
       
   294 		
       
   295 	return 	TRgb(0, 0, 255, 255);
       
   296 	}
       
   297 
       
   298 TRgb CTAlphaChannel::GetPen(TInt aIndex) const
       
   299 	{
       
   300 	switch(aIndex)
       
   301 		{
       
   302 			case EOpaque:
       
   303 			return TRgb(0, 0, 255, 255);
       
   304 			case ESemiTrans:
       
   305 			return TRgb(0, 0, 255, 128);
       
   306 			case ETrans:
       
   307 			return TRgb(0, 0, 255, 0);
       
   308 			default : break;
       
   309 		}
       
   310 		
       
   311 	return 	TRgb(0, 0, 255, 255);
       
   312 	}
       
   313    
       
   314 CGraphicsContext::TDrawMode CTAlphaChannel::GetDrawMode(TInt /*aIndex*/) const
       
   315 	{
       
   316 	return CGraphicsContext::EDrawModePEN;
       
   317 	}
       
   318 
       
   319 enum {EAll64K, EAll16MA, EAllDifferent};// later may add EAll16M
       
   320 void CTAlphaChannel::SetDisplayModeConfiguration(TInt aConfig)
       
   321 	{
       
   322 	switch (aConfig)
       
   323 		{
       
   324 	case EAll64K:
       
   325 		if(iForegroundWindowOpaque)
       
   326 			iForegroundWindowOpaque->SetDisplayMode(EColor64K);
       
   327 		if(iForegroundWindowSemiTrans)
       
   328 			iForegroundWindowSemiTrans->SetDisplayMode(EColor64K);
       
   329 		if(iForegroundWindowTrans)
       
   330 			iForegroundWindowTrans->SetDisplayMode(EColor64K);
       
   331 		break;
       
   332 	case EAll16MA:
       
   333 		if(iForegroundWindowOpaque)
       
   334 			iForegroundWindowOpaque->SetDisplayMode(EColor16MA);
       
   335 		if(iForegroundWindowSemiTrans)
       
   336 			iForegroundWindowSemiTrans->SetDisplayMode(EColor16MA);
       
   337 		if(iForegroundWindowTrans)
       
   338 			iForegroundWindowTrans->SetDisplayMode(EColor16MA);
       
   339 		break;
       
   340 	case EAllDifferent:
       
   341 		if(iForegroundWindowOpaque)
       
   342 			iForegroundWindowOpaque->SetDisplayMode(EColor256);
       
   343 		if(iForegroundWindowSemiTrans)
       
   344 			iForegroundWindowSemiTrans->SetDisplayMode(EColor64K);
       
   345 		if(iForegroundWindowTrans)
       
   346 			iForegroundWindowTrans->SetDisplayMode(EColor16MA);
       
   347 		break;
       
   348 		}
       
   349 	}
       
   350 
       
   351 enum {ETiled, EOverlapping};
       
   352 
       
   353 void CTAlphaChannel::SetPositionConfiguration(TInt aConfig)
       
   354 	{
       
   355 	TSize screenSize=TheClient->iGroup->Size();
       
   356 	TInt winWidth=(screenSize.iWidth)-10;
       
   357 	TInt winHeight=screenSize.iHeight-10;
       
   358 	if (aConfig==ETiled)
       
   359 		{
       
   360 		if(iForegroundWindowOpaque)
       
   361 			iForegroundWindowOpaque->SetPos(TPoint(winWidth/5, 0));
       
   362 		if(iForegroundWindowSemiTrans)
       
   363 			iForegroundWindowSemiTrans->SetPos(TPoint(2*winWidth/5, 0));
       
   364 		if(iForegroundWindowTrans)
       
   365 			iForegroundWindowTrans->SetPos(TPoint(3*winWidth/5, 0));
       
   366 		}
       
   367 	else
       
   368 		{
       
   369 		if(iForegroundWindowOpaque)
       
   370 			iForegroundWindowOpaque->SetPos(TPoint(winWidth/3, -winHeight/3));
       
   371 		if(iForegroundWindowSemiTrans)
       
   372 			iForegroundWindowSemiTrans->SetPos(TPoint(2*winWidth/5, winHeight/3));
       
   373 		if(iForegroundWindowTrans)
       
   374 			iForegroundWindowTrans->SetPos(TPoint(winWidth/2, -winHeight/3));
       
   375 		}
       
   376 	if (iForegroundWindowBottom)
       
   377 		iForegroundWindowBottom->SetPos(TPoint(0, 0));
       
   378 	if (iForegroundWindowTop)
       
   379 		iForegroundWindowTop->SetPos(TPoint(4*winWidth/5, 0));
       
   380 	}
       
   381 
       
   382 enum {EVaryingTransparency, EVaryingColour};
       
   383 
       
   384 void CTAlphaChannel::SetColourConfiguration(TInt aConfig)
       
   385 	{
       
   386 	RWindow* win;
       
   387 	if (aConfig==EVaryingTransparency)
       
   388 		{
       
   389 		// red background, green foregrounds of varying transparency
       
   390 		win = (RWindow*)(iBackgroundWindow->DrawableWin());
       
   391 		win->SetBackgroundColor(TRgb(255,0,0,255));
       
   392 
       
   393 		if(iForegroundWindowOpaque)
       
   394 			iForegroundWindowOpaque->SetBackgroundColor(TRgb(0,255,0,255));
       
   395 		if(iForegroundWindowSemiTrans)
       
   396 			iForegroundWindowSemiTrans->SetBackgroundColor(TRgb(0,255,0,128));
       
   397 		if(iForegroundWindowTrans)
       
   398 			iForegroundWindowTrans->SetBackgroundColor(TRgb(0,255,0,0));
       
   399 		}
       
   400 	else
       
   401 		{
       
   402 		// white background, semi-transparent foregrounds in primary colours
       
   403 		win = (RWindow*)(iBackgroundWindow->DrawableWin());
       
   404 		win->SetBackgroundColor(TRgb(255,255,255,255));
       
   405 
       
   406 		if(iForegroundWindowOpaque)
       
   407 			iForegroundWindowOpaque->SetBackgroundColor(TRgb(255,0,0,128));
       
   408 		if(iForegroundWindowSemiTrans)
       
   409 			iForegroundWindowSemiTrans->SetBackgroundColor(TRgb(0,255,0,128));
       
   410 		if(iForegroundWindowTrans)
       
   411 			iForegroundWindowTrans->SetBackgroundColor(TRgb(0,0,255,128));
       
   412 		}
       
   413 	}
       
   414 
       
   415 void CTAlphaChannel::DoMoving()
       
   416 	{
       
   417 	TPoint pos;
       
   418 	for (TInt i = 0; i<20; i++)
       
   419 		{
       
   420 		if (iForegroundWindowBottom)
       
   421 			{
       
   422 			pos = iForegroundWindowBottom->Position();
       
   423 			pos += TPoint(1,5);
       
   424 			iForegroundWindowBottom->SetPos(pos);
       
   425 			}
       
   426 
       
   427 		if (iForegroundWindowOpaque)
       
   428 			{
       
   429 			pos = iForegroundWindowOpaque->Position();
       
   430 			pos += TPoint(1,5);
       
   431 			iForegroundWindowOpaque->SetPos(pos);
       
   432 			}
       
   433 
       
   434 		if (iForegroundWindowSemiTrans)
       
   435 			{
       
   436 			pos = iForegroundWindowSemiTrans->Position();
       
   437 			pos += TPoint(1,5);
       
   438 			iForegroundWindowSemiTrans->SetPos(pos);
       
   439 			}
       
   440 
       
   441 		if (iForegroundWindowTrans)
       
   442 			{
       
   443 			pos = iForegroundWindowTrans->Position();
       
   444 			pos += TPoint(1,5);
       
   445 			iForegroundWindowTrans->SetPos(pos);
       
   446 			}
       
   447 
       
   448 		if (iForegroundWindowTop)
       
   449 			{
       
   450 			pos = iForegroundWindowTop->Position();
       
   451 			pos += TPoint(1,5);
       
   452 			iForegroundWindowTop->SetPos(pos);
       
   453 			}
       
   454 
       
   455 		TheClient->iWs.Flush();	
       
   456 		User::After(TTimeIntervalMicroSeconds32(50000));
       
   457 		}
       
   458 
       
   459 	}
       
   460 
       
   461 void CTAlphaChannel::DoMoveBehind()
       
   462 	{
       
   463 	TPoint pos = iBackgroundWindow->Position();
       
   464 	for (TInt i = 0; i<20; i++)
       
   465 		{
       
   466 		pos += TPoint(0,5);
       
   467 		iBackgroundWindow->SetPos(pos);
       
   468 
       
   469 		TheClient->iWs.Flush();	
       
   470 		User::After(TTimeIntervalMicroSeconds32(50000));
       
   471 		}
       
   472 	iBackgroundWindow->SetPos(TPoint(5,5));
       
   473 	}
       
   474 
       
   475 void CTAlphaChannel::DoInvisibility()
       
   476 	{
       
   477 	RWindow* win;
       
   478 	if (iForegroundWindowBottom)
       
   479 		{
       
   480 		win = (RWindow*)(iForegroundWindowBottom->DrawableWin());
       
   481 		win->SetVisible(EFalse);
       
   482 		TheClient->iWs.Flush();	
       
   483 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   484 
       
   485 		win->SetVisible(ETrue);
       
   486 		TheClient->iWs.Flush();	
       
   487 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   488 		}
       
   489 	if (iForegroundWindowOpaque)
       
   490 		{
       
   491 		win = (RWindow*)(iForegroundWindowOpaque->DrawableWin());
       
   492 		win->SetVisible(EFalse);
       
   493 		TheClient->iWs.Flush();	
       
   494 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   495 
       
   496 		win->SetVisible(ETrue);
       
   497 		TheClient->iWs.Flush();	
       
   498 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   499 		}
       
   500 	if (iForegroundWindowSemiTrans)
       
   501 		{
       
   502 		win = (RWindow*)(iForegroundWindowSemiTrans->DrawableWin());
       
   503 		win->SetVisible(EFalse);
       
   504 		TheClient->iWs.Flush();	
       
   505 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   506 
       
   507 		win->SetVisible(ETrue);
       
   508 		TheClient->iWs.Flush();	
       
   509 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   510 		}
       
   511 	if (iForegroundWindowTrans)
       
   512 		{
       
   513 		win = (RWindow*)(iForegroundWindowTrans->DrawableWin());
       
   514 		win->SetVisible(EFalse);
       
   515 		TheClient->iWs.Flush();	
       
   516 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   517 
       
   518 		win->SetVisible(ETrue);
       
   519 		TheClient->iWs.Flush();	
       
   520 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   521 		}
       
   522 	if (iForegroundWindowTop)
       
   523 		{
       
   524 		win = (RWindow*)(iForegroundWindowTop->DrawableWin());
       
   525 		win->SetVisible(EFalse);
       
   526 		TheClient->iWs.Flush();	
       
   527 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   528 
       
   529 		win->SetVisible(ETrue);
       
   530 		TheClient->iWs.Flush();	
       
   531 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   532 		}
       
   533 	}
       
   534 
       
   535 /** 
       
   536 	@SYMTestCaseID	GRAPHICS-WSERV-0328
       
   537   	
       
   538   	@SYMTestCaseDesc			Testing a Fading.
       
   539   	
       
   540   	@SYMTestPriority			High
       
   541   	
       
   542   	@SYMTestStatus      		Implemented
       
   543   	
       
   544   	@SYMTestActions		
       
   545 		 Set fading parameters. Draw all graphics primitives and bitmaps with 
       
   546 		 various transparency				.
       
   547  
       
   548   	@SYMTestExpectedResults
       
   549  				All windows should be drawn according their fading values. 
       
   550  */
       
   551 
       
   552 void CTAlphaChannel::TestFading()
       
   553 	{
       
   554 	iIsFading = ETrue;
       
   555 	iBlackFading = 0;
       
   556 	iWhiteFading = 128;
       
   557 	iText.Format(_L("Fading. %dX%d"), iBlackFading, iWhiteFading);
       
   558 	INFO_PRINTF1(iText);
       
   559 	DrawTestWindowsNow();
       
   560 
       
   561 	User::After(TTimeIntervalMicroSeconds32(1000000 * 1));
       
   562 	iIsFading = EFalse;
       
   563 	DrawTestWindowsNow();
       
   564 	iIsFading = ETrue;
       
   565 	iBlackFading = 128;
       
   566 	iWhiteFading = 255;
       
   567 	iText.Format(_L("Fading. %dX%d"), iBlackFading, iWhiteFading);
       
   568 	INFO_PRINTF1(iText);
       
   569 	DrawTestWindowsNow();
       
   570 
       
   571 	iIsFading = EFalse;
       
   572 	}
       
   573 	
       
   574 /** 
       
   575 	@SYMTestCaseID	GRAPHICS-WSERV-0329
       
   576   	
       
   577   	@SYMTestCaseDesc			Tests moving of foreground windows.
       
   578   	
       
   579   	@SYMTestPriority			High
       
   580   	
       
   581   	@SYMTestStatus      		Implemented
       
   582   	
       
   583   	@SYMTestActions		
       
   584 		 Set fading parameters. Set position of foreground windows as tile				.
       
   585  
       
   586   	@SYMTestExpectedResults
       
   587  			Foreground window has to be redrawn properly.
       
   588  */
       
   589 
       
   590 void CTAlphaChannel::TestMoving()
       
   591 	{
       
   592 	SetPositionConfiguration(ETiled);
       
   593 	DoMoving();
       
   594 	SetPositionConfiguration(ETiled);
       
   595 	}
       
   596 
       
   597 /** 
       
   598 	@SYMTestCaseID	GRAPHICS-WSERV-0330
       
   599   	
       
   600   	@SYMTestCaseDesc			Tests moving of foreground windows.
       
   601   	
       
   602   	@SYMTestPriority			High
       
   603   	
       
   604   	@SYMTestStatus      		Implemented
       
   605   	
       
   606   	@SYMTestActions		
       
   607 		 Set fading parameters. Moves foreground windows over the screen			.
       
   608  
       
   609   	@SYMTestExpectedResults
       
   610  			Foreground window has to be redrawn properly.
       
   611  */
       
   612 
       
   613 
       
   614 void CTAlphaChannel::TestMovingOverlapping()
       
   615 	{
       
   616 	TPoint pos;
       
   617 
       
   618 	for (TInt i = 0; i < 20; i++)
       
   619 		{
       
   620 		if (iForegroundWindowOpaque)
       
   621 			{
       
   622 			pos = iForegroundWindowOpaque->Position();
       
   623 			pos += TPoint(3,0);
       
   624 			iForegroundWindowOpaque->SetPos(pos);
       
   625 			}
       
   626 		if (iForegroundWindowTrans)
       
   627 			{
       
   628 			pos = iForegroundWindowTrans->Position();
       
   629 			pos -= TPoint(3,0);
       
   630 			iForegroundWindowTrans->SetPos(pos);
       
   631 			}
       
   632 		TheClient->iWs.Flush();	
       
   633 		User::After(TTimeIntervalMicroSeconds32(50000));
       
   634 		}
       
   635 	}
       
   636 
       
   637 /** 
       
   638 	@SYMTestCaseID	GRAPHICS-WSERV-0331
       
   639   	
       
   640   	@SYMTestCaseDesc			Testing transparency factor for windows with alpha channel.
       
   641   	
       
   642   	@SYMTestPriority			High
       
   643   	
       
   644   	@SYMTestStatus      		Implemented
       
   645   	
       
   646   	@SYMTestActions		
       
   647 		 Sets background colour with various level of transparency			.
       
   648  
       
   649   	@SYMTestExpectedResults
       
   650  			Foreground window must be redrawn properly.
       
   651  */
       
   652 void CTAlphaChannel::TestChangingTransparencyFactor()
       
   653 	{
       
   654 	TInt i = 0;
       
   655 	while (i <= 255)
       
   656 		{
       
   657 		iForegroundWindowOpaque->SetBackgroundColor(TRgb(0,255,0,255-i));
       
   658 		iForegroundWindowTrans->SetBackgroundColor(TRgb(0,255,0,i));
       
   659 		iForegroundWindowOpaque->DrawNow();
       
   660 		iForegroundWindowTrans->DrawNow();
       
   661 		i+=15;
       
   662 		}
       
   663 	i=0;
       
   664 	while (i <= 255)
       
   665 		{
       
   666 		iForegroundWindowOpaque->SetBackgroundColor(TRgb(0,255,0,i));
       
   667 		iForegroundWindowTrans->SetBackgroundColor(TRgb(0,255,0,255-i));
       
   668 		iForegroundWindowOpaque->DrawNow();
       
   669 		iForegroundWindowTrans->DrawNow();
       
   670 		User::After(TTimeIntervalMicroSeconds32(50000));// 20 frames per second
       
   671 		i+=15;
       
   672 		}
       
   673 	}
       
   674 
       
   675 /** 
       
   676 	@SYMTestCaseID	GRAPHICS-WSERV-0332
       
   677   	
       
   678   	@SYMTestCaseDesc			Testing redrawing of foreground windows while their positions and 
       
   679   				invisibility have been changed.
       
   680   	
       
   681   	@SYMTestPriority			High
       
   682   	
       
   683   	@SYMTestStatus      		Implemented
       
   684   	
       
   685   	@SYMTestActions		
       
   686 		 Sets position of the foreground windows as overlapping, tiled.
       
   687 		Change visability of semi transparent foreground window.		.
       
   688  
       
   689   	@SYMTestExpectedResults
       
   690  		Foreground window must be redrawn properly.
       
   691  */
       
   692 
       
   693 void CTAlphaChannel::TestInvisibility()
       
   694 	{
       
   695 	RWindow* win = (RWindow*)(iForegroundWindowSemiTrans->DrawableWin());
       
   696 	SetPositionConfiguration(EOverlapping);
       
   697 	TheClient->iWs.Flush();	
       
   698 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   699 
       
   700 	win->SetVisible(EFalse);
       
   701 	TheClient->iWs.Flush();	
       
   702 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   703 
       
   704 	win->SetVisible(ETrue);
       
   705 	TheClient->iWs.Flush();	
       
   706 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   707 
       
   708 	SetPositionConfiguration(ETiled);
       
   709 
       
   710 	}
       
   711 
       
   712 /** 
       
   713 	@SYMTestCaseID	GRAPHICS-WSERV-0333
       
   714   	
       
   715   	@SYMTestCaseDesc			Testing redrawing of foreground windows after a 
       
   716   				background window has been moved.
       
   717   	
       
   718   	@SYMTestPriority			High
       
   719   	
       
   720   	@SYMTestStatus      		Implemented
       
   721   	
       
   722   	@SYMTestActions		
       
   723 		 Sets position of the foreground windows as tiled.
       
   724 		Moves background window.
       
   725  
       
   726   	@SYMTestExpectedResults
       
   727  		Foreground windows must be redrawn properly.
       
   728  */
       
   729 void CTAlphaChannel::TestMoveUnderneath()
       
   730 	{
       
   731 	SetPositionConfiguration(ETiled);
       
   732 	DoMoveBehind();
       
   733 	}
       
   734 /** 
       
   735 	@SYMTestCaseID	GRAPHICS-WSERV-0334
       
   736   	
       
   737   	@SYMTestCaseDesc			Testing redrawing of foreground windows after a 
       
   738   				background window has been moved.
       
   739   	
       
   740   	@SYMTestPriority			High
       
   741   	
       
   742   	@SYMTestStatus      		Implemented
       
   743   	
       
   744   	@SYMTestActions		
       
   745 		 Sets different position of the foreground windows: tiled, overlapping.
       
   746 		Moves background window.
       
   747  
       
   748   	@SYMTestExpectedResults
       
   749  		Foreground windows has to be redrawn properly.
       
   750  */
       
   751 
       
   752 void CTAlphaChannel::TestMoveBehindInvisible()
       
   753 	{
       
   754 	SetPositionConfiguration(ETiled);
       
   755 	RWindow* win;
       
   756 	win = (RWindow*)(iForegroundWindowOpaque->DrawableWin());
       
   757 	win->SetVisible(EFalse);
       
   758 	win = (RWindow*)(iForegroundWindowSemiTrans->DrawableWin());
       
   759 	win->SetVisible(EFalse);
       
   760 	win = (RWindow*)(iForegroundWindowTrans->DrawableWin());
       
   761 	win->SetVisible(EFalse);
       
   762 	TheClient->iWs.Flush();
       
   763 
       
   764 	DoMoveBehind();
       
   765 
       
   766 	SetPositionConfiguration(EOverlapping);
       
   767 	DoMoveBehind();
       
   768 
       
   769 	win = (RWindow*)(iForegroundWindowOpaque->DrawableWin());
       
   770 	win->SetVisible(ETrue);
       
   771 	win = (RWindow*)(iForegroundWindowSemiTrans->DrawableWin());
       
   772 	win->SetVisible(ETrue);
       
   773 	win = (RWindow*)(iForegroundWindowTrans->DrawableWin());
       
   774 	win->SetVisible(ETrue);
       
   775 	TheClient->iWs.Flush();
       
   776 	}
       
   777 /** 
       
   778 	@SYMTestCaseID	GRAPHICS-WSERV-0335
       
   779   	
       
   780   	@SYMTestCaseDesc			Testing redrawing of foreground windows.
       
   781   	
       
   782   	@SYMTestPriority			High
       
   783   	
       
   784   	@SYMTestStatus      		Implemented
       
   785   	
       
   786   	@SYMTestActions		
       
   787 		 Redraws background window
       
   788  
       
   789   	@SYMTestExpectedResults
       
   790  		Foreground windows should be redrawn properly, if background window 
       
   791   		 has been redrawn.
       
   792  */
       
   793 void CTAlphaChannel::TestRedrawBehind()
       
   794 	{
       
   795 	TheClient->iWs.Flush();	
       
   796 	iBackgroundWindow->iState += 1;
       
   797 	iBackgroundWindow->DrawNow();
       
   798 	TheClient->iWs.Flush();	
       
   799 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   800 	}
       
   801 /** 
       
   802 	@SYMTestCaseID	GRAPHICS-WSERV-0336
       
   803   	
       
   804   	@SYMTestCaseDesc			Testing transparency with RWsSprite class.
       
   805   	
       
   806   	@SYMTestPriority			High
       
   807   	
       
   808   	@SYMTestStatus      		Implemented
       
   809   	
       
   810   	@SYMTestActions		
       
   811 		 Creates RBackedUpWindow window and moves it over transparent window
       
   812 		appears and dissapears set up window as transparent
       
   813  
       
   814   	@SYMTestExpectedResults
       
   815  			Must work with transparent windows. 
       
   816  */
       
   817 
       
   818 void CTAlphaChannel::TestAnimationL()
       
   819 	{
       
   820 	for(TInt ii = 0; ii < iArrWindow.Count(); ii++)
       
   821 		{
       
   822 		iArrWindow[ii]->StartAnimationL();
       
   823 		}
       
   824 	}
       
   825 /** 
       
   826 	@SYMTestCaseID	GRAPHICS-WSERV-0337
       
   827   	
       
   828   	@SYMTestCaseDesc			Testing transparency with RBackedUpWindow window class.
       
   829   	
       
   830   	@SYMTestPriority			High
       
   831   	
       
   832   	@SYMTestStatus      		Implemented
       
   833   	
       
   834   	@SYMTestActions		
       
   835 		 Creates RBackedUpWindow window and moves it over transparent window
       
   836 		appears and dissapears set up transparent window as transparent
       
   837  
       
   838   	@SYMTestExpectedResults
       
   839  				Do not expect correct work of alpha channel with 
       
   840  				RBackedUpWindow window class. 
       
   841 */
       
   842 void CTAlphaChannel::TestBackedWindowL()
       
   843 	{
       
   844 	for(TInt ii = 0; ii < iArrWindow.Count(); ii++)
       
   845 		{
       
   846 		iArrWindow[ii]->CreateBackedWindowL();
       
   847 		}
       
   848 	}
       
   849 
       
   850 /** 
       
   851 	@SYMTestCaseID	GRAPHICS-WSERV-0338
       
   852   	
       
   853   	@SYMTestCaseDesc			Implication of setting SetDrawOpaque on drawing with alpha channel.
       
   854   	
       
   855   	@SYMTestPriority			High
       
   856   	
       
   857   	@SYMTestStatus      		Implemented
       
   858   	
       
   859   	@SYMTestActions		
       
   860 		 Change graphic context to opaque and none opaque and rewdraw all test windows
       
   861  
       
   862   	@SYMTestExpectedResults
       
   863  				must not impact on output with alpha channel 
       
   864  */
       
   865 
       
   866 void CTAlphaChannel::TestEffectSetOpaque()
       
   867 	{
       
   868 	for(TInt ii = 0; ii < 3; ii++)
       
   869 		{
       
   870 		
       
   871 		for(TInt ii = 0; ii < iArrWindow.Count(); ii++)
       
   872 			{
       
   873 			iArrWindow[ii]->SetDrawOpaque(EFalse);
       
   874 			}
       
   875 	
       
   876 		DrawTestWindowsNow();
       
   877 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   878 
       
   879 		for(TInt jj = 0; jj < iArrWindow.Count(); jj++)
       
   880 			{
       
   881 			iArrWindow[jj]->SetDrawOpaque(ETrue);
       
   882 			}
       
   883 
       
   884 		DrawTestWindowsNow();
       
   885 		User::After(TTimeIntervalMicroSeconds32(1000000));
       
   886 		}
       
   887 	}
       
   888 
       
   889 /** 
       
   890 	@SYMTestCaseID	GRAPHICS-WSERV-0339
       
   891   	
       
   892   	@SYMTestCaseDesc			Redrawing of child windows with transparency.
       
   893   	
       
   894   	@SYMTestPriority			High
       
   895   	
       
   896   	@SYMTestStatus      		Implemented
       
   897   	
       
   898   	@SYMTestActions		
       
   899 		 	Creates a few child windows with various levels of transparency.
       
   900 		Moves parent window over the screen.
       
   901   	@SYMTestExpectedResults
       
   902  				Child and parent windows must be redrawn properly 
       
   903  */
       
   904 
       
   905 void CTAlphaChannel::TestChildWindowL()
       
   906 	{
       
   907 	SetPositionConfiguration(ETiled);
       
   908 	SetColourConfiguration(EVaryingColour);
       
   909 	DrawTestWindowsNow(ETrue);
       
   910 	TDisplayMode mode = EColor64K;
       
   911 	CTWinAlphaForeground* childWin[] = {NULL, NULL, NULL, NULL, NULL};
       
   912 	if (iForegroundWindowBottom)
       
   913 		{
       
   914 		childWin[0] = CTWinAlphaForeground::NewL(*this, TPoint(0,0),TSize(50,50),iForegroundWindowBottom,*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ENonTransparentAlpha);
       
   915 		childWin[0]->DrawNow();
       
   916 		}
       
   917 	if (iForegroundWindowOpaque)
       
   918 		{
       
   919 		childWin[1] = CTWinAlphaForeground::NewL(*this, TPoint(0,0),TSize(50,50),iForegroundWindowOpaque,*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ETransparencyFactor);
       
   920 		childWin[1]->DrawNow();
       
   921 		}
       
   922 	if (iForegroundWindowSemiTrans)
       
   923 		{
       
   924 		childWin[2] = CTWinAlphaForeground::NewL(*this, TPoint(0,0),TSize(50,50),iForegroundWindowSemiTrans,*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ETransparencyAlpha);
       
   925 		childWin[2]->DrawNow();
       
   926 		}
       
   927 	if (iForegroundWindowTrans)
       
   928 		{
       
   929 		childWin[3] = CTWinAlphaForeground::NewL(*this, TPoint(0,0),TSize(50,50),iForegroundWindowTrans,*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ENonTransparentAlpha);
       
   930 		childWin[3]->DrawNow();
       
   931 		}
       
   932 	if (iForegroundWindowTop)
       
   933 		{
       
   934 		childWin[4] = CTWinAlphaForeground::NewL(*this, TPoint(0,0),TSize(50,50),iForegroundWindowTop,*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ENonTransparentAlpha);
       
   935 		childWin[4]->DrawNow();
       
   936 		}
       
   937 	TheClient->iWs.Flush();	
       
   938 
       
   939 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   940 	DoMoving();
       
   941 
       
   942 	delete childWin[0];
       
   943 	delete childWin[1];
       
   944 	delete childWin[2];
       
   945 	delete childWin[3];
       
   946 	delete childWin[4];
       
   947 	}
       
   948 /** 
       
   949 	@SYMTestCaseID	GRAPHICS-WSERV-0340
       
   950   	
       
   951   	@SYMTestCaseDesc			Redrawing of multiple child windows with transparency.
       
   952   	
       
   953   	@SYMTestPriority			High
       
   954   	
       
   955   	@SYMTestStatus      		Implemented
       
   956   	
       
   957   	@SYMTestActions		
       
   958 		 	Creates multiple child windows with various levels of transparency.
       
   959 		Moves parent windows over the screen.
       
   960   	@SYMTestExpectedResults
       
   961  				Child and parent windows must be redrawn properly 
       
   962  */
       
   963 
       
   964 void CTAlphaChannel::TestMultipleChildrenL()
       
   965 	{
       
   966 	SetPositionConfiguration(ETiled);
       
   967 	SetColourConfiguration(EVaryingColour);
       
   968 	TDisplayMode mode = EColor64K;
       
   969 	CTWinAlphaForeground* childWin[] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
       
   970 	if (iForegroundWindowBottom)
       
   971 		{
       
   972 		childWin[0] = CTWinAlphaForeground::NewL(*this, TPoint(0,0),TSize(50,50),iForegroundWindowBottom,*TheClient->iGc, &mode, TRgb(255, 255, 255,128), ETransparencyFactor);
       
   973 		childWin[1] = CTWinAlphaForeground::NewL(*this, TPoint(20,20),TSize(50,50),childWin[0],*TheClient->iGc, &mode, TRgb(255, 255, 255,128), ENonTransparentAlpha);
       
   974 		childWin[0]->DrawNow();
       
   975 		childWin[1]->DrawNow();
       
   976 		}
       
   977 	if (iForegroundWindowOpaque)
       
   978 		{
       
   979 		childWin[4] = CTWinAlphaForeground::NewL(*this, TPoint(0,0),TSize(100,100),iForegroundWindowOpaque,*TheClient->iGc, &mode, TRgb(255, 255, 255,128), ETransparencyAlpha);
       
   980 		childWin[5] = CTWinAlphaForeground::NewL(*this, TPoint(20,80),TSize(50,50),iForegroundWindowOpaque,*TheClient->iGc, &mode, TRgb(255, 255, 255,128), ENonTransparentAlpha);
       
   981 		childWin[6] = CTWinAlphaForeground::NewL(*this, TPoint(20,20),TSize(60,60),childWin[4],*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ENonTransparentAlpha);
       
   982 		childWin[7] = CTWinAlphaForeground::NewL(*this, TPoint(20,20),TSize(50,50),childWin[6],*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ENonTransparentAlpha);
       
   983 		childWin[4]->DrawNow();
       
   984 		childWin[5]->DrawNow();
       
   985 		childWin[6]->DrawNow();
       
   986 		childWin[7]->DrawNow();
       
   987 		}
       
   988 	DrawTestWindowsNow(ETrue);
       
   989 
       
   990 	TestMoving();
       
   991 
       
   992 	delete childWin[0];
       
   993 	delete childWin[1];
       
   994 	delete childWin[2];
       
   995 	delete childWin[3];
       
   996 	delete childWin[4];
       
   997 	delete childWin[5];
       
   998 	delete childWin[6];
       
   999 	delete childWin[7];
       
  1000 	}
       
  1001 
       
  1002 /** 
       
  1003 	@SYMTestCaseID	GRAPHICS-WSERV-0341
       
  1004   	
       
  1005   	@SYMTestCaseDesc			Test transparent window which positioned under opaque.
       
  1006   	
       
  1007   	@SYMTestPriority			High
       
  1008   	
       
  1009   	@SYMTestStatus      		Implemented
       
  1010   	
       
  1011   	@SYMTestActions		
       
  1012 		 	Creates an opaque window on the topt of transparent windows.
       
  1013 		Moves transparent windows over the screen.
       
  1014   	@SYMTestExpectedResults
       
  1015  				Transparent windows must be redrawn properly 
       
  1016  */
       
  1017 
       
  1018 void CTAlphaChannel::TestTransparentMovingUnderOpaqueL()
       
  1019 	{
       
  1020 	SetColourConfiguration(EVaryingColour);
       
  1021 	TDisplayMode mode = EColor64K;
       
  1022 	CTWinAlphaForeground* win = CTWinAlphaForeground::NewL(*this, TPoint(0,100),TSize(600,40),TheClient->iGroup,*TheClient->iGc, &mode, TRgb(0, 255, 0,128), ENonTransparentAlpha);
       
  1023 	win->DrawNow();
       
  1024 
       
  1025 	TestMoving();
       
  1026 
       
  1027 	delete win;
       
  1028 	}
       
  1029 /** 
       
  1030 	@SYMTestCaseID	GRAPHICS-WSERV-0342
       
  1031   	
       
  1032   	@SYMTestCaseDesc			Changing orinary position of the foreground windows.
       
  1033   	
       
  1034   	@SYMTestPriority			High
       
  1035   	
       
  1036   	@SYMTestStatus      		Implemented
       
  1037   	
       
  1038   	@SYMTestActions		
       
  1039 		 	Set ordinal position of foreground windows.
       
  1040   	@SYMTestExpectedResults
       
  1041  				Foreground windows must be redrawn properly 
       
  1042  */
       
  1043 
       
  1044 void CTAlphaChannel::TestSetOrdinalPosition()
       
  1045 	{
       
  1046 	SetColourConfiguration(EVaryingColour);
       
  1047 	SetPositionConfiguration(EOverlapping);
       
  1048 	DrawTestWindowsNow(ETrue);
       
  1049 	TheClient->iWs.Flush();	
       
  1050 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
  1051 	RWindow* win;
       
  1052 	for (TInt i=0; i<3; i++)
       
  1053 		{
       
  1054 		if (iForegroundWindowOpaque)
       
  1055 			{
       
  1056 			win = (RWindow*)(iForegroundWindowOpaque->DrawableWin());
       
  1057 			win->SetOrdinalPosition(0);
       
  1058 			TheClient->iWs.Flush();	
       
  1059 			User::After(TTimeIntervalMicroSeconds32(1000000));
       
  1060 			}
       
  1061 		if (iForegroundWindowSemiTrans)
       
  1062 			{
       
  1063 			win = (RWindow*)(iForegroundWindowSemiTrans->DrawableWin());
       
  1064 			win->SetOrdinalPosition(0);
       
  1065 			TheClient->iWs.Flush();	
       
  1066 			User::After(TTimeIntervalMicroSeconds32(1000000));
       
  1067 			}
       
  1068 		if (iForegroundWindowTrans)
       
  1069 			{
       
  1070 			win = (RWindow*)(iForegroundWindowTrans->DrawableWin());
       
  1071 			win->SetOrdinalPosition(0);
       
  1072 			TheClient->iWs.Flush();	
       
  1073 			User::After(TTimeIntervalMicroSeconds32(1000000));
       
  1074 			}
       
  1075 		}
       
  1076 	}
       
  1077 
       
  1078 void CTAlphaChannel::RunTestCaseL(TInt aCurTestCase)
       
  1079 	{
       
  1080 	User::After(TTimeIntervalMicroSeconds32(1000000 * 2));
       
  1081 	
       
  1082 	((CTAlphaChannelStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
       
  1083 	switch (aCurTestCase)
       
  1084 		{
       
  1085 		case 1:
       
  1086 			((CTAlphaChannelStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
  1087 			CreateForegroundWindowsL(iSizeForegroundWindow, EColor16MU);
       
  1088 			break;
       
  1089 		case 2:
       
  1090 			{
       
  1091 			CreateForegroundWindowsL(iSizeForegroundWindow, EColor64K);
       
  1092 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0339"));
       
  1093 			TestChildWindowL();
       
  1094 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1095 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0340"));
       
  1096 			TestMultipleChildrenL();
       
  1097 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1098 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0342"));
       
  1099 			TestSetOrdinalPosition();
       
  1100 			}
       
  1101 			break;
       
  1102 		case 3: 
       
  1103 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0336"));
       
  1104 			TestAnimationL();
       
  1105 		case 4: 
       
  1106 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0337"));
       
  1107 			TestBackedWindowL();
       
  1108 			break;
       
  1109 		case 5: 
       
  1110 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0338"));
       
  1111 			TestEffectSetOpaque();
       
  1112 			break;
       
  1113 		case 6:
       
  1114 			((CTAlphaChannelStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
  1115 			iIsFading = EFalse;
       
  1116 			DrawTestWindowsNow();
       
  1117 			INFO_PRINTF1(_L("Anti-aliasing"));
       
  1118 			iIsFading = EFalse;
       
  1119 			iDrawText = ETrue;
       
  1120 			DrawTestWindowsNow();
       
  1121 			break;
       
  1122 		case 7:	
       
  1123 			SetColourConfiguration(EVaryingColour);
       
  1124 			SetPositionConfiguration(EOverlapping);
       
  1125 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0335"));
       
  1126 			TestRedrawBehind();		
       
  1127 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1128 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0329"));
       
  1129 			TestMoving();
       
  1130 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1131 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0330"));
       
  1132 			TestMovingOverlapping();		
       
  1133 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1134 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0341"));
       
  1135 			TestMoveBehindInvisible();
       
  1136 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1137 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0334"));
       
  1138 			TestTransparentMovingUnderOpaqueL();
       
  1139 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1140 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0331"));
       
  1141 			TestInvisibility();
       
  1142 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1143 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0332"));
       
  1144 			TestChangingTransparencyFactor();
       
  1145 			break;
       
  1146 		case 8:
       
  1147 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0328"));
       
  1148 			TestFading();
       
  1149 			break;
       
  1150 		case 9:
       
  1151 			{
       
  1152 			((CTAlphaChannelStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
  1153 			iDrawText = EFalse;
       
  1154 			SetDisplayModeConfiguration(EAll16MA);
       
  1155 			}
       
  1156 			break;
       
  1157 		case 10:
       
  1158 			((CTAlphaChannelStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
  1159 			iIsFading = EFalse;
       
  1160 			DrawTestWindowsNow();
       
  1161 			INFO_PRINTF1(_L("Anti-aliasing"));
       
  1162 			iIsFading = EFalse;
       
  1163 			iDrawText = ETrue;
       
  1164 			DrawTestWindowsNow();
       
  1165 			break;
       
  1166 		case 11:
       
  1167 			SetColourConfiguration(EVaryingColour);
       
  1168 			SetPositionConfiguration(EOverlapping);
       
  1169 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0333"));
       
  1170 			TestMoveUnderneath();
       
  1171 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1172 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0335"));
       
  1173 			TestRedrawBehind();
       
  1174 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1175 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0329"));
       
  1176 			TestMoving();
       
  1177 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1178 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0332"));
       
  1179 			TestInvisibility();
       
  1180 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1181 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0331"));
       
  1182 			TestChangingTransparencyFactor();
       
  1183 			break;
       
  1184 		case 12:
       
  1185 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0328"));
       
  1186 			TestFading();
       
  1187 			break;
       
  1188 		case 13:
       
  1189 			SetDisplayModeConfiguration(EAllDifferent);
       
  1190 			SetColourConfiguration(EVaryingColour);
       
  1191 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0333"));
       
  1192 			TestMoveUnderneath();
       
  1193 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1194 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0335"));
       
  1195 			TestRedrawBehind();
       
  1196 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1197 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0332"));
       
  1198 			TestInvisibility();
       
  1199 			((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1200 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0329"));
       
  1201 			TestMoving();
       
  1202 			break;
       
  1203 		case 14:
       
  1204 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0336"));
       
  1205 			TestAnimationL();
       
  1206 			break;
       
  1207 		case 15:
       
  1208 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0337"));
       
  1209 			TestBackedWindowL();
       
  1210 			break;
       
  1211 		case 16:
       
  1212 			((CTAlphaChannelStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0338"));
       
  1213 			TestEffectSetOpaque();
       
  1214 			break;
       
  1215 		case 17:
       
  1216 			((CTAlphaChannelStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
  1217 			((CTAlphaChannelStep*)iStep)->CloseTMSGraphicsStep();
       
  1218 			TestComplete();
       
  1219 			break;
       
  1220 		}
       
  1221 	((CTAlphaChannelStep*)iStep)->RecordTestResultL();
       
  1222 	}
       
  1223 	
       
  1224 /** Calculate foreground windows margin and create them*/
       
  1225 void CTAlphaChannel::CreateForegroundWindowsL(const TSize& aSize, TDisplayMode aMode)
       
  1226 	{
       
  1227 	TPoint pt = TPoint(5, 5);
       
  1228 	
       
  1229 	//creating foreground windows
       
  1230 	//bottom window
       
  1231 	TDisplayMode dispMode = aMode;
       
  1232 	iForegroundWindowBottom = CTWinAlphaForeground::NewL(*this, pt,aSize,TheClient->iGroup,*TheClient->iGc, &dispMode, TRgb(0, 255, 0,128), ETransparencyFactor);
       
  1233 	iArrWindow.AppendL( iForegroundWindowBottom);
       
  1234 
       
  1235 	//dispMode = EColor16MA;
       
  1236 	pt.iX += aSize.iWidth + KWindowIndention;
       
  1237 	//opaque window
       
  1238 	iForegroundWindowOpaque = CTWinAlphaForeground::NewL(*this, pt,aSize,TheClient->iGroup,*TheClient->iGc, &dispMode, TRgb(0, 255, 0, 255), ETransparencyAlpha);
       
  1239 	iArrWindow.AppendL( iForegroundWindowOpaque);
       
  1240 
       
  1241 	pt.iX += aSize.iWidth + KWindowIndention;
       
  1242 	//semi-transparent window
       
  1243 	iForegroundWindowSemiTrans = CTWinAlphaForeground::NewL(*this, pt,aSize,TheClient->iGroup,*TheClient->iGc, &dispMode, TRgb(0, 255, 0, 128), ETransparencyAlpha);
       
  1244 	iArrWindow.AppendL( iForegroundWindowSemiTrans);
       
  1245 
       
  1246 	//transparent window
       
  1247 	pt.iX += aSize.iWidth + KWindowIndention;
       
  1248 	iForegroundWindowTrans = CTWinAlphaForeground::NewL(*this, pt,aSize,TheClient->iGroup,*TheClient->iGc, &dispMode, TRgb(0, 255, 0, 0), ETransparencyAlpha);
       
  1249 	iArrWindow.AppendL( iForegroundWindowTrans);
       
  1250 
       
  1251 	// top window
       
  1252 	pt.iX += aSize.iWidth + KWindowIndention;
       
  1253 	iForegroundWindowTop = CTWinAlphaForeground::NewL(*this, pt,aSize,TheClient->iGroup,*TheClient->iGc, &dispMode, TRgb(0, 255, 0,128), ENonTransparentAlpha);
       
  1254 	iArrWindow.AppendL( iForegroundWindowTop);
       
  1255 	}
       
  1256 
       
  1257 void CTAlphaChannel::DestroyForegroundWindows()
       
  1258 	{
       
  1259 	iArrWindow.ResetAndDestroy();
       
  1260 	iForegroundWindowBottom = NULL;
       
  1261 	iForegroundWindowOpaque = NULL;
       
  1262 	iForegroundWindowSemiTrans = NULL;
       
  1263 	iForegroundWindowTrans = NULL;
       
  1264 	iForegroundWindowTop = NULL;
       
  1265 	}
       
  1266 
       
  1267 /** Draw all foreground windows */
       
  1268 void CTAlphaChannel::DrawTestWindowsNow(TBool aDrawBackgroundWin)
       
  1269 	{
       
  1270 	if(iBackgroundWindow && aDrawBackgroundWin)
       
  1271 		{
       
  1272 		iBackgroundWindow->DrawNow();
       
  1273 		}
       
  1274 
       
  1275 	for(TInt ii = 0; ii < iArrWindow.Count(); ii++)
       
  1276 		{
       
  1277 		iArrWindow[ii]->DrawNow();
       
  1278 		}
       
  1279 	}
       
  1280 	
       
  1281 //-------------
       
  1282 
       
  1283 CTWinAlphaForeground* CTWinAlphaForeground::NewL(CTAlphaChannel& aTest, TPoint aPos, TSize aSize, CTWinBase *aParent, CWindowGc &aGc, TDisplayMode *aMode, TRgb aCol, TInt aTransparencyType)
       
  1284 	{
       
  1285 	CTWinAlphaForeground* theWin = new(ELeave) CTWinAlphaForeground(aTest);
       
  1286 	
       
  1287 	theWin->ConstructL(*aParent);
       
  1288 	if (aMode)
       
  1289 		theWin->SetDisplayMode(*aMode);
       
  1290 	theWin->SetExtL(aPos, aSize);
       
  1291 	theWin->AssignGC(aGc);
       
  1292 	theWin->PrepareForDrawingL();	
       
  1293 
       
  1294 	// for hardware testing	only we create an additional bitmap
       
  1295 #ifndef __WINS__
       
  1296 	theWin->CreateBackgroundBitmapL(*aMode);
       
  1297 #endif
       
  1298 		
       
  1299 	RWindow* win = (RWindow*) (theWin->DrawableWin());
       
  1300 	win->SetShadowHeight(0);
       
  1301 	win->SetShadowDisabled(ETrue);
       
  1302 	switch (aTransparencyType)
       
  1303 		{
       
  1304 	case ETransparencyFactor:
       
  1305 		{
       
  1306 		win->SetTransparencyFactor(aCol);
       
  1307 		theWin->SetBackgroundColor(aCol);
       
  1308 		}
       
  1309 		break;
       
  1310 	case ETransparencyAlpha:
       
  1311 		win->SetTransparencyAlphaChannel();
       
  1312 		// fall through into next case
       
  1313 	case ENonTransparentAlpha:
       
  1314 	default:
       
  1315 		theWin->SetBackgroundColor(aCol);
       
  1316 		break;
       
  1317 		}
       
  1318 	
       
  1319 	theWin->Activate();
       
  1320 
       
  1321 	return theWin;
       
  1322 	}
       
  1323 
       
  1324 CTWinAlphaForeground::~CTWinAlphaForeground()
       
  1325 	{
       
  1326 	if(iPolygon)
       
  1327 		{
       
  1328 		iPolygon->Reset();
       
  1329 		delete iPolygon;
       
  1330 		}
       
  1331 	delete iBitmapBackground;
       
  1332 	delete iBitmapDeviceBackground;
       
  1333 	delete iBitmapContextBackground;
       
  1334 	}
       
  1335 	
       
  1336 CTWinAlphaForeground::CTWinAlphaForeground(CTAlphaChannel& aTest)
       
  1337 	: iTest(aTest)
       
  1338 	{	
       
  1339 	}
       
  1340 
       
  1341 
       
  1342 void CTWinAlphaForeground::SetDisplayMode(TDisplayMode aDisplayMode)
       
  1343 	{
       
  1344 	BaseWin()->SetRequiredDisplayMode(aDisplayMode);
       
  1345 	switch (aDisplayMode)
       
  1346 		{
       
  1347 	case EColor256:
       
  1348 		iTitle1 = _L("256");
       
  1349 		break;
       
  1350 	case EColor64K:
       
  1351 		iTitle1 = _L("64K");
       
  1352 		break;
       
  1353 	case EColor16MU:
       
  1354 		iTitle1 = _L("16MU");
       
  1355 		break;
       
  1356 	case EColor16MA:
       
  1357 		iTitle1 = _L("16MA");
       
  1358 		break;
       
  1359 	case EColor16MAP:
       
  1360 		iTitle1 = _L("16MAP");
       
  1361 		break;
       
  1362 	default:
       
  1363 		iTitle1 = _L("");
       
  1364 		break;
       
  1365 		}
       
  1366 	}
       
  1367 
       
  1368 void CTWinAlphaForeground::SetBackgroundColor(TRgb aRgb)
       
  1369 	{
       
  1370 	switch (aRgb.Alpha())
       
  1371 		{
       
  1372 		case 0:
       
  1373 		iTitle2 = _L(" trans ");		
       
  1374 		break;
       
  1375 		case 255:
       
  1376 		iTitle2 = _L(" opaque ");		
       
  1377 		break;
       
  1378 		case 128:
       
  1379 		default:
       
  1380 		iTitle2 = _L(" s-trans ");		
       
  1381 		break;
       
  1382 		}
       
  1383 	if (aRgb.Red())
       
  1384 		iTitle2 += _L("R");
       
  1385 	if (aRgb.Green())
       
  1386 		iTitle2 += _L("G");
       
  1387 	if (aRgb.Blue())
       
  1388 		iTitle2 += _L("B");
       
  1389 
       
  1390 	iBackgroundColor = aRgb;
       
  1391 	((RWindow*) DrawableWin())->SetBackgroundColor(aRgb);
       
  1392 	}
       
  1393 
       
  1394 void CTWinAlphaForeground::Draw()
       
  1395 	{
       
  1396 	CBitmapContext* theGc = TheClient->iGc;
       
  1397 	((CWindowGc*)theGc)->SetOpaque(iDrawOpaque);
       
  1398 	
       
  1399 	if(iBitmapContextBackground)
       
  1400 		{
       
  1401 		//CGraphicsContext
       
  1402 		theGc = iBitmapContextBackground;
       
  1403 		CleanBackgroundBitmap();
       
  1404 		}
       
  1405 	if(iTest.iFont1)
       
  1406 		theGc->UseFont(iTest.iFont1);
       
  1407 	
       
  1408 	
       
  1409 	theGc->SetFaded(EFalse);
       
  1410 	DrawTable(*theGc);
       
  1411 
       
  1412 	TInt numRows = sizeof(iRows) / sizeof(iRows[0]) ;
       
  1413 
       
  1414 	theGc->SetBrushStyle(iTest.iBrushStyle);
       
  1415 	if(iTest.iFont && iTest.iDrawText)
       
  1416 		{
       
  1417 		theGc->DiscardFont();
       
  1418 		theGc->UseFont(iTest.iFont);
       
  1419 		}
       
  1420 	
       
  1421 	theGc->SetFaded(iTest.iIsFading);
       
  1422 	
       
  1423 	// the factor and offset are calculated as follows: 
       
  1424 	// iFadeMapFactor = iWhiteFading - iBlackFading;
       
  1425 	// iFadeMapOffset = iBlackFading;
       
  1426 
       
  1427 	theGc->SetFadingParameters(iTest.iBlackFading, iTest.iWhiteFading); //black and white
       
  1428 		
       
  1429 	for(TInt ii = 0; ii < numRows - 1; ii++)
       
  1430 		{
       
  1431 		theGc -> SetBrushStyle(iTest.iBrushStyle);
       
  1432 
       
  1433 		TRect theRect = TRect(iCol, iRows[ii], Size().iWidth, iRows[ii + 1]);
       
  1434 				
       
  1435    		TRgb theBrush = iTest.GetBrush(ii);
       
  1436    		TRgb thePen = iTest.GetPen(ii);
       
  1437 
       
  1438    		CGraphicsContext::TDrawMode theDrawMode = iTest.GetDrawMode(ii);
       
  1439     		
       
  1440    		theGc->SetBrushColor(theBrush);
       
  1441 		theGc->SetPenColor(thePen);
       
  1442    		theGc->SetDrawMode(theDrawMode);
       
  1443 		
       
  1444 		CGraphicsContext* theBitmapContext64K;
       
  1445 		CGraphicsContext* theBitmapContext16MA;
       
  1446 		CFbsBitmap* theBitmap64K;
       
  1447 		CFbsBitmap* theBitmap16MA;
       
  1448 
       
  1449 		switch(ii)
       
  1450 			{
       
  1451 			case 0:
       
  1452 				{
       
  1453 				theBitmapContext64K = iTest.iBitmapContext64K_1;
       
  1454 				theBitmapContext16MA = iTest.iBitmapContext16MA_1;
       
  1455 				theBitmap64K = iTest.iBitmap64K_1;
       
  1456 				theBitmap16MA = iTest.iBitmap16MA_1;
       
  1457 				break;
       
  1458 				}
       
  1459 			case 1:
       
  1460 				{
       
  1461 				theBitmapContext64K = iTest.iBitmapContext64K_2;
       
  1462 				theBitmapContext16MA = iTest.iBitmapContext16MA_2;
       
  1463 				theBitmap64K = iTest.iBitmap64K_2;
       
  1464 				theBitmap16MA = iTest.iBitmap16MA_2;
       
  1465 				break;
       
  1466 				}
       
  1467 			default:
       
  1468 				{
       
  1469 				theBitmapContext64K = iTest.iBitmapContext64K_3;
       
  1470 				theBitmapContext16MA = iTest.iBitmapContext16MA_3;
       
  1471 				theBitmap64K = iTest.iBitmap64K_3;
       
  1472 				theBitmap16MA = iTest.iBitmap16MA_3;
       
  1473 				break;
       
  1474 				}
       
  1475 			}
       
  1476 			if(iTest.iDrawText)
       
  1477 				{
       
  1478 				DrawTextInCell(*theGc, theRect);
       
  1479 				}
       
  1480 			else
       
  1481 				{
       
  1482 				TRAP_IGNORE(iTest.DrawOffscreenBitmapsL(thePen, theBrush, theBitmapContext64K, 
       
  1483 					theBitmapContext16MA, theBitmap64K, theBitmap16MA));
       
  1484 				DrawPrimitivesInCell(*theGc, theRect, theBitmap64K, theBitmap16MA);
       
  1485 				}
       
  1486 		TheClient->iWs.Flush();	
       
  1487 		}
       
  1488 
       
  1489 	theGc->DiscardFont();
       
  1490 
       
  1491 	if(iBitmapContextBackground)
       
  1492 		{
       
  1493 		theGc = TheClient->iGc;
       
  1494 		theGc->BitBlt(TPoint(0, 0), iBitmapBackground);
       
  1495 		}
       
  1496 	}
       
  1497 
       
  1498 void CTWinAlphaForeground::SetPoligonLocation(const TPoint &ptOffset)
       
  1499 	{
       
  1500 	TRect rect = TRect(iTest.iTriangleSize);
       
  1501 	(*iPolygon)[0] = rect.iTl + ptOffset;
       
  1502 	(*iPolygon)[1] = TPoint(rect.iTl.iX, rect.iBr.iY) + ptOffset;
       
  1503 	(*iPolygon)[2] = rect.iBr + ptOffset;
       
  1504 	}
       
  1505 	
       
  1506 /** Define boundary of the table*/
       
  1507 void CTWinAlphaForeground::CalculateTableMargin()
       
  1508 	{
       
  1509 	TInt numRows = sizeof(iRows) / sizeof(iRows[0]) ;
       
  1510 	iRows[0] = iTest.iFirstCellHeight;
       
  1511 	TInt theRowHeight = (Size().iHeight - iTest.iFirstCellHeight) / 3;
       
  1512 	for(TInt ii = 1; ii < numRows; ii++)
       
  1513 		{
       
  1514 		iRows[ii] = iRows[ii-1] + theRowHeight;
       
  1515 		}
       
  1516 	}
       
  1517 	
       
  1518 /** Draw a table which comprises 3 rows: for transparent, semi-transparent 
       
  1519 	and opaque output
       
  1520 
       
  1521 */	
       
  1522 void CTWinAlphaForeground::DrawTable(CBitmapContext& aGc) const
       
  1523 	{
       
  1524 	TInt numRows = sizeof(iRows) / sizeof(iRows[0]) ;
       
  1525 	
       
  1526 	aGc.SetPenColor(iTest.iPenTable);
       
  1527 	
       
  1528 	for (TInt ii = 0; ii < numRows - 1; ii++)
       
  1529 		{
       
  1530 		TBuf<4> iBuf;
       
  1531 		TPoint pt1 = TPoint(0, iRows[ii]);
       
  1532 		TPoint pt2 = TPoint(Size().iWidth, iRows[ii]);
       
  1533 
       
  1534 		aGc.DrawLine(pt1, pt2);
       
  1535 		
       
  1536 		if(iCol)
       
  1537 			{
       
  1538 			TPoint pt3 = TPoint(0, iRows[ii]) + TPoint(2,(iRows[1] - iRows[0]) / 2); 
       
  1539 			switch(ii)
       
  1540 				{
       
  1541 					case 0: iBuf = _L("o"); break;
       
  1542 					case 1: iBuf = _L("s"); break;
       
  1543 					case 2: iBuf = _L("t"); break;
       
  1544 					default : iBuf = _L(""); break;
       
  1545 				}
       
  1546 			aGc.DrawText(iBuf, pt3); 
       
  1547 			}
       
  1548 		}
       
  1549 	if(iCol)
       
  1550 		{
       
  1551 		TPoint pt3 = TPoint(iCol, iRows[0]) + TPoint(1,-2); 
       
  1552 		TBuf<32> text = iTitle1;
       
  1553 		text += iTitle2;
       
  1554 		aGc.DrawText(text, pt3); 
       
  1555 	
       
  1556 		TPoint pt1 = TPoint(iCol, 0);
       
  1557 		TPoint pt2 = TPoint(iCol, Size().iHeight);
       
  1558 		aGc.DrawLine(pt1, pt2);
       
  1559 		}
       
  1560 		
       
  1561 	}
       
  1562 
       
  1563 /** Draw truetype font to check anti-aliasing*/
       
  1564 void CTWinAlphaForeground::DrawTextInCell(CBitmapContext& aGc, const TRect& aRect)
       
  1565 	{
       
  1566     TPoint pt(aRect.iTl.iX, aRect.iBr.iY);
       
  1567     pt += TPoint(2, -10);
       
  1568     
       
  1569     aGc.DrawText(_L("ABCD"), pt);
       
  1570 	}
       
  1571 
       
  1572 /** Draw graphics primitive in a cell:
       
  1573 	rectangle, ellipse, triangle, a few lines, bitmaps
       
  1574 
       
  1575  */	
       
  1576 void CTWinAlphaForeground::DrawPrimitivesInCell(CBitmapContext& aGc, const TRect& aRect, 
       
  1577 								CFbsBitmap* aBitmap64K, CFbsBitmap* aBitmap16MA)
       
  1578 	{
       
  1579 	TRect theCellRect = aRect;
       
  1580 	theCellRect.Shrink(1, 1);
       
  1581 	
       
  1582 	//rectangle
       
  1583 	TRect rect = TRect(iTest.iRectangleSize);
       
  1584 	rect.Move(theCellRect.iTl);
       
  1585     aGc.DrawRect(rect);
       
  1586     
       
  1587     //ellipse
       
  1588     rect = TRect(iTest.iEllipseSize);
       
  1589 	rect.Move(theCellRect.iTl + TPoint(iTest.iRectangleSize.iWidth + 5, 0));
       
  1590     aGc.DrawEllipse(rect);
       
  1591 
       
  1592 	//triangle
       
  1593 	TPoint pt = TPoint(rect.iBr.iX, rect.iTl.iY) + TPoint(5, 0);
       
  1594 	SetPoligonLocation(pt);
       
  1595    	aGc.DrawPolygon(iPolygon);
       
  1596     
       
  1597     //DrawLine
       
  1598     pt = pt + TPoint (((*iPolygon)[2]).iX - ((*iPolygon)[0]).iX, 0) + TPoint(5, 2);
       
  1599     rect = TRect(iTest.iTriangleSize);
       
  1600     rect.Move(pt);
       
  1601     aGc.DrawLine(rect.iTl, TPoint(rect.iTl.iX, rect.iBr.iY));
       
  1602     aGc.DrawLine(TPoint(rect.iTl.iX, rect.iBr.iY), rect.iBr);
       
  1603     aGc.DrawLine(rect.iBr, TPoint(rect.iBr.iX, rect.iTl.iY));
       
  1604     aGc.DrawLine(TPoint(rect.iBr.iX, rect.iTl.iY), rect.iTl);
       
  1605     aGc.DrawLine(rect.iTl, rect.iBr);
       
  1606     aGc.DrawLine(TPoint(rect.iBr.iX, rect.iTl.iY), TPoint(rect.iTl.iX, rect.iBr.iY));
       
  1607 
       
  1608     //64K bitmap
       
  1609     aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
  1610     pt = TPoint(theCellRect.iTl.iX, rect.iBr.iY) + TPoint(0, 5);
       
  1611     if(aBitmap64K)
       
  1612     	{
       
  1613     	aGc.BitBlt(pt, aBitmap64K);
       
  1614     	pt = pt + TPoint( aBitmap64K->SizeInPixels().iWidth, 0) + TPoint(2, 0);
       
  1615 
       
  1616     	aGc.BitBltMasked(pt, 
       
  1617     		aBitmap64K, TRect(aBitmap64K->SizeInPixels()),
       
  1618 	    	iTest.iBitmapGray256Mask, EFalse);
       
  1619     	pt = pt + TPoint( aBitmap64K->SizeInPixels().iWidth, 0) + TPoint(2, 0);
       
  1620 
       
  1621     	aGc.BitBltMasked(pt, 
       
  1622 	    	aBitmap64K, TRect(aBitmap64K->SizeInPixels()),
       
  1623     		iTest.iBitmapMask, EFalse);
       
  1624 
       
  1625     	pt = pt + TPoint( aBitmap64K->SizeInPixels().iWidth, 0) + TPoint(2, 0);
       
  1626 	   	}
       
  1627     
       
  1628     if(aBitmap16MA)
       
  1629     	{
       
  1630     	aGc.BitBlt(pt, aBitmap16MA);
       
  1631 
       
  1632     	pt = pt + TPoint( aBitmap16MA->SizeInPixels().iWidth, 0) + TPoint(2, 0);
       
  1633 
       
  1634     	aGc.BitBltMasked(pt, 
       
  1635 	    	aBitmap16MA, TRect(aBitmap16MA->SizeInPixels()),
       
  1636     		iTest.iBitmapGray256Mask, EFalse);
       
  1637 
       
  1638     	pt = pt + TPoint( aBitmap16MA->SizeInPixels().iWidth, 0) + TPoint(2,0);
       
  1639 
       
  1640     	pt = pt + TPoint( 0, aBitmap16MA->SizeInPixels().iHeight);
       
  1641     	}
       
  1642     
       
  1643 	pt.iX = aRect.iTl.iX + 2;
       
  1644 	pt.iY = pt.iY + 18;
       
  1645 	
       
  1646     if(aBitmap64K)
       
  1647     	{
       
  1648 		TSize size = aBitmap64K->SizeInPixels();
       
  1649 		TRect srcRect(TPoint(0,0),size);
       
  1650 		size += TSize(5,5);
       
  1651 		TRect destRect(pt - TPoint(0, 8), size);
       
  1652     	aGc.DrawBitmap(destRect, aBitmap64K, srcRect);
       
  1653     	pt = pt + TPoint( size.iWidth, 0) + TPoint(2, 0);
       
  1654 
       
  1655 #ifdef __WINS__
       
  1656     	destRect.Move(TPoint(aBitmap64K->SizeInPixels().iWidth + 8, 0));
       
  1657     	((CWindowGc&) aGc).DrawBitmapMasked(destRect, 
       
  1658     		aBitmap64K, srcRect,
       
  1659 	    	iTest.iBitmapGray256Mask, EFalse);
       
  1660     	pt = pt + TPoint( aBitmap64K->SizeInPixels().iWidth, 0) + TPoint(2, 0);
       
  1661 #endif
       
  1662 	   	}
       
  1663     
       
  1664     aGc.DrawText(iTest.iText, pt);
       
  1665     
       
  1666 #ifdef __WINS__
       
  1667     ((CWindowGc&) aGc).DrawTextVertical(iTest.iText, pt, ETrue);
       
  1668 #endif
       
  1669 	}
       
  1670 	
       
  1671 /** calculate table's size and size of graphics primitieves */
       
  1672 void CTWinAlphaForeground::PrepareForDrawingL()
       
  1673 	{
       
  1674 	iCol = iTest.iFirstCellWidth;
       
  1675 
       
  1676 	CalculateTableMargin();
       
  1677 
       
  1678 	//create triangle
       
  1679 	iPolygon = new (ELeave) CArrayFixFlat<TPoint> (3);
       
  1680 	TRect rect = TRect(iTest.iTriangleSize);
       
  1681 	iPolygon->AppendL(rect.iTl);
       
  1682 	iPolygon->AppendL(TPoint(rect.iTl.iX, rect.iBr.iY));
       
  1683 	iPolygon->AppendL(rect.iBr);
       
  1684 	}
       
  1685 
       
  1686 /** Bitmap is intended to use on target only*/	
       
  1687 void CTWinAlphaForeground::CreateBackgroundBitmapL(const TDisplayMode& aDispMode)
       
  1688 	{
       
  1689 	ASSERT(!iBitmapBackground);
       
  1690 	
       
  1691 	TSize size = Size(); 
       
  1692 		
       
  1693 	iBitmapBackground = new (ELeave) CFbsBitmap ;
       
  1694 	iBitmapBackground->Create(size,aDispMode);
       
  1695 	
       
  1696 	iBitmapDeviceBackground = CFbsBitmapDevice::NewL(iBitmapBackground);
       
  1697 	CGraphicsContext *&theGc = (CGraphicsContext*&)iBitmapContextBackground;
       
  1698 	iBitmapDeviceBackground->CreateContext(theGc);
       
  1699 	}
       
  1700 	
       
  1701 void CTWinAlphaForeground::CleanBackgroundBitmap()
       
  1702 	{
       
  1703 	ASSERT(iBitmapBackground);
       
  1704 	
       
  1705 	TRect rect = TRect(iBitmapBackground->SizeInPixels());
       
  1706 	iBitmapContextBackground->SetBrushColor(iBackgroundColor);
       
  1707    	iBitmapContextBackground->SetPenColor(iBackgroundColor);
       
  1708    	iBitmapContextBackground->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1709 	iBitmapContextBackground->DrawRect(rect);
       
  1710 	}
       
  1711 
       
  1712 void CTWinAlphaForeground::StartAnimationL()
       
  1713 	{
       
  1714 	__UHEAP_MARK;
       
  1715 	RWsSprite theSprite;
       
  1716 	
       
  1717 	RDrawableWindow *theWin = DrawableWin();
       
  1718 
       
  1719 	theSprite=RWsSprite(TheClient->iWs);
       
  1720 	TPoint theSpritePos = TPoint(10, 10); 
       
  1721 	TInt theFlags = 0;
       
  1722 	theSprite.Construct(*theWin, theSpritePos, theFlags);
       
  1723 	TDisplayMode dispMode = EColor256;
       
  1724 	//create a ball bitmap for animation
       
  1725 	CFbsBitmap* theBitmapBall= new (ELeave) CFbsBitmap;
       
  1726 	theBitmapBall->Create(TSize(32, 32), dispMode);
       
  1727 	CFbsBitmapDevice* theBitmapDeviceBall = CFbsBitmapDevice::NewL(theBitmapBall);
       
  1728 	CGraphicsContext* theBitmapContextBall = NULL;
       
  1729 	theBitmapDeviceBall->CreateContext(theBitmapContextBall);
       
  1730 	//draw a background
       
  1731 	theBitmapContextBall->SetBrushColor(TRgb(128, 0, 255));
       
  1732    	theBitmapContextBall->SetPenColor(TRgb(128, 0, 255));
       
  1733    	theBitmapContextBall->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1734 	theBitmapContextBall->DrawRect(theBitmapBall->SizeInPixels());
       
  1735 	
       
  1736 	//create a ball's mask
       
  1737 	CFbsBitmap* theBitmapMask= new (ELeave) CFbsBitmap;
       
  1738 	theBitmapMask->Create(TSize(32, 32), dispMode);
       
  1739 	CFbsBitmapDevice* theBitmapDeviceMask = CFbsBitmapDevice::NewL(theBitmapMask);
       
  1740 	CGraphicsContext* theBitmapContextMask = NULL;
       
  1741 	theBitmapDeviceMask->CreateContext(theBitmapContextMask);
       
  1742 	//draw a mask
       
  1743 	theBitmapContextMask->SetBrushColor(TRgb(0, 0, 0));
       
  1744    	theBitmapContextMask->SetPenColor(TRgb(0, 0, 0));
       
  1745    	theBitmapContextMask->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1746 	theBitmapContextMask->DrawRect(theBitmapMask->SizeInPixels());
       
  1747 
       
  1748 	theBitmapContextMask->SetBrushColor(TRgb(255, 255, 255));
       
  1749    	theBitmapContextMask->SetPenColor(TRgb(255, 255, 255));
       
  1750    	TRect rect = TRect(theBitmapMask->SizeInPixels());
       
  1751 	theBitmapContextMask->SetPenSize(TSize(6,6));
       
  1752 	theBitmapContextMask->DrawLine(rect.iTl, rect.iBr);
       
  1753 	theBitmapContextMask->DrawLine(TPoint(0, rect.iBr.iY), TPoint(rect.iBr.iX, 0));
       
  1754 
       
  1755 	//create a second ball's mask
       
  1756 	CFbsBitmap* theBitmapMask1= new (ELeave) CFbsBitmap;
       
  1757 	theBitmapMask1->Create(TSize(32, 32), dispMode);
       
  1758 	CFbsBitmapDevice* theBitmapDeviceMask1 = CFbsBitmapDevice::NewL(theBitmapMask1);
       
  1759 	CGraphicsContext* theBitmapContextMask1 = NULL;
       
  1760 	theBitmapDeviceMask1->CreateContext(theBitmapContextMask1);
       
  1761 	//draw a mask
       
  1762 	theBitmapContextMask1->SetBrushColor(TRgb(0, 0, 0));
       
  1763    	theBitmapContextMask1->SetPenColor(TRgb(0, 0, 0));
       
  1764    	theBitmapContextMask1->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1765 	theBitmapContextMask1->DrawRect(theBitmapMask1->SizeInPixels());
       
  1766 
       
  1767 	theBitmapContextMask1->SetBrushColor(TRgb(255, 255, 255));
       
  1768    	theBitmapContextMask1->SetPenColor(TRgb(255, 255, 255));
       
  1769    	rect = TRect(theBitmapMask1->SizeInPixels());
       
  1770 	theBitmapContextMask1->SetPenSize(TSize(6,6));
       
  1771 	theBitmapContextMask1->DrawLine(TPoint(rect.iBr.iX/2, 0), TPoint(rect.iBr.iX/2, rect.iBr.iY));
       
  1772 	theBitmapContextMask1->DrawLine(TPoint(0, rect.iBr.iY/2), TPoint(rect.iBr.iX, rect.iBr.iY/2));
       
  1773 
       
  1774 
       
  1775 	TSpriteMember theSpriteList;
       
  1776 	theSpriteList.iBitmap = theBitmapBall;
       
  1777 	theSpriteList.iMaskBitmap = theBitmapMask;
       
  1778 	theSpriteList.iInvertMask = EFalse;
       
  1779 	theSpriteList.iDrawMode = CGraphicsContext::EDrawModePEN;
       
  1780 	theSpriteList.iOffset = TPoint(0, 0);
       
  1781 	theSpriteList.iInterval = TTimeIntervalMicroSeconds32(100000);
       
  1782 	theSprite.AppendMember(theSpriteList);
       
  1783 
       
  1784 	TSpriteMember theSpriteList1;
       
  1785 	theSpriteList1.iBitmap = theBitmapBall;
       
  1786 	theSpriteList1.iMaskBitmap = theBitmapMask1;
       
  1787 	theSpriteList1.iInvertMask = EFalse;
       
  1788 	theSpriteList1.iDrawMode = CGraphicsContext::EDrawModePEN;
       
  1789 	theSpriteList1.iOffset = TPoint(0, 0);
       
  1790 	theSpriteList1.iInterval = TTimeIntervalMicroSeconds32(100000);
       
  1791 	
       
  1792 	theSprite.AppendMember(theSpriteList1);
       
  1793 	
       
  1794 	theSprite.Activate();
       
  1795 	
       
  1796 	for(TInt ii = 0; ii < 20; ii++)
       
  1797 		{
       
  1798 		theSpritePos += TPoint(3, 8);
       
  1799 		theSprite.SetPosition(theSpritePos);
       
  1800 		TheClient->iWs.Flush();	
       
  1801 		User::After(TTimeIntervalMicroSeconds32(50000));		
       
  1802 		}
       
  1803 
       
  1804 	for(TInt jj = 0; jj < 20; jj++)
       
  1805 		{
       
  1806 		theSpritePos -= TPoint(0, 8);
       
  1807 		theSprite.SetPosition(theSpritePos);
       
  1808 		TheClient->iWs.Flush();	
       
  1809 		User::After(TTimeIntervalMicroSeconds32(50000));
       
  1810 		}
       
  1811 	
       
  1812 	theSprite.Close();
       
  1813 	
       
  1814 	delete theBitmapContextBall;
       
  1815 	delete theBitmapDeviceBall;
       
  1816 	
       
  1817 	delete theBitmapBall;
       
  1818 	
       
  1819 	delete theBitmapMask;
       
  1820 	delete theBitmapContextMask;
       
  1821 	delete theBitmapDeviceMask;
       
  1822 	
       
  1823 	delete theBitmapMask1;
       
  1824 	delete theBitmapContextMask1;
       
  1825 	delete theBitmapDeviceMask1;
       
  1826 
       
  1827 	__UHEAP_MARKEND;
       
  1828 	}
       
  1829 
       
  1830 void CTWinAlphaForeground::CreateBackedWindowL()
       
  1831 	{
       
  1832 	RBackedUpWindow theBackedWindow(TheClient->iWs); 
       
  1833 	CleanupClosePushL(theBackedWindow);
       
  1834 	
       
  1835 	TDisplayMode theDisplayMode = EColor16MA;
       
  1836 	
       
  1837 	RWindow* theWin = (RWindow*) DrawableWin();
       
  1838 
       
  1839 	theBackedWindow.Construct(*theWin,theDisplayMode, ENullWsHandle);
       
  1840 	
       
  1841 	TPoint pos =TPoint(10, 10);
       
  1842 	TSize size = theWin->Size();
       
  1843 	size.SetSize(size.iWidth / 5, size.iHeight/10);
       
  1844 	
       
  1845 	theBackedWindow.SetExtentErr(pos, size);
       
  1846 	theBackedWindow.SetOrdinalPosition(0);
       
  1847 
       
  1848 	
       
  1849 	//draw to backed window	
       
  1850 	TRgb color = TRgb(255, 0, 128);
       
  1851 	TInt bitmapHandle = theBackedWindow.BitmapHandle();
       
  1852 	CFbsBitmap bitmapWin;
       
  1853 	bitmapWin.Duplicate(bitmapHandle);
       
  1854 	//Leave poss here - theBackedWindow could leak
       
  1855 	CFbsBitmapDevice* theBitmapDevice = CFbsBitmapDevice::NewL(&bitmapWin);
       
  1856 	CGraphicsContext* theBitmapContext = NULL;
       
  1857 	theBitmapDevice->CreateContext(theBitmapContext);
       
  1858 	theBitmapContext->SetBrushColor(color);
       
  1859    	theBitmapContext->SetPenColor(color);
       
  1860    	theBitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1861 	theBitmapContext->DrawRect(TRect(bitmapWin.SizeInPixels()));
       
  1862 
       
  1863 	color = TRgb(0, 0, 0);
       
  1864    	theBitmapContext->SetPenColor(color);
       
  1865 	for(TInt kk = 0; kk < bitmapWin.SizeInPixels().iWidth; kk += 8)
       
  1866 		{
       
  1867 		theBitmapContext->DrawLine(TPoint(kk, 0), TPoint(kk, bitmapWin.SizeInPixels().iHeight));
       
  1868 		}
       
  1869 	
       
  1870 	
       
  1871 	theBackedWindow.Activate();
       
  1872 	TheClient->iWs.Flush();
       
  1873 	User::After(TTimeIntervalMicroSeconds32(500000));
       
  1874 	
       
  1875 	//hide the window
       
  1876 	theBackedWindow.SetVisible(EFalse);
       
  1877 	TheClient->iWs.Flush();
       
  1878 	User::After(TTimeIntervalMicroSeconds32(500000));
       
  1879 	theBackedWindow.SetVisible(ETrue);
       
  1880 	TheClient->iWs.Flush();
       
  1881 	
       
  1882 	for(TInt ii = 0; ii < 7; ii++)
       
  1883 		{
       
  1884 		User::After(TTimeIntervalMicroSeconds32(100000));
       
  1885 		pos.iX += 5;
       
  1886 		pos.iY += 15;
       
  1887 		 
       
  1888 		theBackedWindow.SetExtentErr(pos, size);
       
  1889 		TheClient->iWs.Flush();
       
  1890 		}
       
  1891 
       
  1892 	User::After(TTimeIntervalMicroSeconds32(500000));
       
  1893 	
       
  1894 	//transparent color. don't expect it to work
       
  1895 	pos.iX -= 5;
       
  1896 	pos.iY -= 15;
       
  1897 
       
  1898 	theBackedWindow.SetExtentErr(pos, size);
       
  1899 	color = TRgb(255, 255, 128, 128);
       
  1900 	theBitmapContext->SetBrushColor(color);
       
  1901    	theBitmapContext->SetPenColor(color);
       
  1902 	theBitmapContext->DrawRect(TRect(bitmapWin.SizeInPixels()));
       
  1903 	TheClient->iWs.Flush();
       
  1904 	User::After(TTimeIntervalMicroSeconds32(500000));
       
  1905 
       
  1906 	//semi-transparent color
       
  1907 	pos.iX -= 5;
       
  1908 	pos.iY -= 15;
       
  1909 	theBackedWindow.SetExtentErr(pos, size);
       
  1910 	color = TRgb(255, 255, 128, 255);
       
  1911 	theBitmapContext->SetBrushColor(color);
       
  1912    	theBitmapContext->SetPenColor(color);
       
  1913 	TheClient->iWs.Flush();
       
  1914 	User::After(TTimeIntervalMicroSeconds32(500000));
       
  1915 
       
  1916 	
       
  1917 	CleanupStack::PopAndDestroy();	 //bitmapWin
       
  1918 	delete theBitmapContext;
       
  1919 	delete theBitmapDevice;
       
  1920 	
       
  1921 	}
       
  1922 
       
  1923 	
       
  1924 //-------------------
       
  1925 void CTWinAlpha::Draw()
       
  1926 	{
       
  1927 	CBitmapContext* theGc = TheClient->iGc;
       
  1928 	TSize size = Size();
       
  1929 	
       
  1930 	for(TInt ii = 0; ii < size.iHeight; ii += (20+iState))
       
  1931 		{
       
  1932 		theGc->DrawLine(TPoint(0, ii), TPoint(size.iWidth, ii));
       
  1933 		}
       
  1934 	}
       
  1935 	
       
  1936 __WS_CONSTRUCT_STEP__(AlphaChannel)