os/graphics/windowing/windowserver/test/tauto/DLLDRAW.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/DLLDRAW.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,144 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Lots of different Drawing Commands
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +	gc->SetBrushColor(TRgb::Gray4(2));
    1.22 +	gc->Clear();
    1.23 +	gc->SetBrushColor(TRgb::Gray4(0));
    1.24 +	gc->Clear(TRect(2,2,20,5));
    1.25 +	gc->DrawRect(TRect(size));
    1.26 +	gc->SetBrushOrigin(TPoint(1,2));
    1.27 +	gc->SetBrushStyle(CGraphicsContext::EForwardDiagonalHatchBrush);
    1.28 +	gc->DrawRect(TRect(30,2,60,8));
    1.29 +	gc->SetBrushOrigin(TPoint(0,0));
    1.30 +	gc->UseBrushPattern(aBitmap);
    1.31 +	gc->SetBrushStyle(CGraphicsContext::EPatternedBrush);
    1.32 +	gc->DrawRect(TRect(60,2,90,8));
    1.33 +	gc->SetBrushStyle(CGraphicsContext::ENullBrush);
    1.34 +	gc->DiscardBrushPattern();
    1.35 +//
    1.36 +	gc->SetPenColor(TRgb::Gray4(1));
    1.37 +	gc->DrawLine(TPoint(10,12),TPoint(22,20));
    1.38 +	gc->SetPenSize(TSize(4,2));
    1.39 +	gc->DrawLine(TPoint(22,10),TPoint(40,20));
    1.40 +	gc->SetPenStyle(CGraphicsContext::EDottedPen);
    1.41 +	gc->SetPenSize(TSize(1,1));
    1.42 +	gc->SetPenColor(TRgb::Gray4(0));
    1.43 +	gc->DrawLine(TPoint(40,11),TPoint(60,20));
    1.44 +	gc->SetPenStyle(CGraphicsContext::ESolidPen);
    1.45 +	gc->Plot(TPoint(60,10));
    1.46 +//
    1.47 +	gc->BitBlt(TPoint(size.AsPoint()-TPoint(20,20)),aBitmap);
    1.48 +	gc->BitBlt(TPoint(10,30),aBitmap,TRect(0,1,8,9));
    1.49 +	gc->BitBltMasked(TPoint(10,40),aBitmap,TRect(1,2,8,9),aMaskBitmap,ETrue);
    1.50 +	gc->BitBltMasked(TPoint(20,40),aBitmap,TRect(0,0,9,9),aMaskBitmap,EFalse);
    1.51 + 	gc->SetOrigin(TPoint(5,50));
    1.52 +	gc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
    1.53 +	gc->SetPenColor(TRgb::Gray4(3));
    1.54 + 	gc->SetClippingRect(TRect(0,0,20,15));
    1.55 +	//gc->DrawArc(TRect(0,0,20,15),TPoint(10,0),TPoint(1,8));
    1.56 + 	gc->CancelClippingRect();
    1.57 +	gc->SetDrawMode(CGraphicsContext::EDrawModePEN);
    1.58 +	gc->SetPenColor(TRgb::Gray4(0));
    1.59 +	gc->MoveTo(TPoint(25,0));
    1.60 +	gc->DrawLineTo(TPoint(40,5));
    1.61 +	gc->DrawLineBy(TPoint(-20,10));
    1.62 +//
    1.63 +	CArrayFixFlat<TPoint>* polyLineArray=new(ELeave) CArrayFixFlat<TPoint>(4);
    1.64 +	CleanupStack::PushL(polyLineArray);
    1.65 +	polyLineArray->AppendL(TPoint(8,0));
    1.66 +	polyLineArray->AppendL(TPoint(16,10));
    1.67 +	polyLineArray->AppendL(TPoint(0,3));
    1.68 +	polyLineArray->AppendL(TPoint(16,3));
    1.69 +	polyLineArray->AppendL(TPoint(0,10));
    1.70 +	polyLineArray->AppendL(TPoint(8,0));
    1.71 +	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
    1.72 +	gc->SetOrigin(TPoint(50,50));
    1.73 +	gc->DrawPolyLine(polyLineArray);
    1.74 +	gc->SetOrigin(TPoint(75,50));
    1.75 +	gc->DrawPolyLine(&(polyLineArray->At(0)),polyLineArray->Count());
    1.76 +	polyLineArray->Delete(5);
    1.77 +	gc->SetOrigin(TPoint(0,65));
    1.78 +	gc->DrawPolygon(polyLineArray,CGraphicsContext::EWinding);
    1.79 +	gc->SetOrigin(TPoint(25,65));
    1.80 +	gc->DrawPolygon(&(polyLineArray->At(0)),polyLineArray->Count(),CGraphicsContext::EWinding);
    1.81 +	gc->SetOrigin(TPoint(50,65));
    1.82 +	gc->DrawPolygon(polyLineArray,CGraphicsContext::EAlternate);
    1.83 +	gc->SetOrigin(TPoint(75,65));
    1.84 +	gc->DrawPolygon(&(polyLineArray->At(0)),polyLineArray->Count(),CGraphicsContext::EAlternate);
    1.85 +	CleanupStack::PopAndDestroy();
    1.86 +	gc->SetBrushStyle(CGraphicsContext::ENullBrush);
    1.87 +	gc->SetOrigin(TPoint(0,0));
    1.88 +//
    1.89 +	gc->DrawPie(TRect(5,80,30,100),TPoint(10,65),TPoint(35,80));
    1.90 +	gc->DrawEllipse(TRect(35,80,60,100));
    1.91 +	gc->DrawRoundRect(TRect(65,80,80,100),TSize(5,3));
    1.92 +	gc->DrawBitmap(TRect(10,105,40,120),aBitmap);
    1.93 +	gc->DrawBitmap(TRect(45,105,105,125),aBitmap,TRect(5,5,25,20));
    1.94 +//gc->DrawBitmap(TRect(110,40,205,125),aBitmap,TRect(5,5,25,20));
    1.95 +	if (aExtraDrawBitMap)
    1.96 +		gc->DrawBitmap(TPoint(110,70),aBitmap);
    1.97 +//
    1.98 +	gc->UseFont(aFont);
    1.99 +	TInt height=aFont->HeightInPixels();
   1.100 +	TInt ascent=aFont->AscentInPixels();
   1.101 +	TInt ypos=5;
   1.102 +	TInt xpos=100;
   1.103 +	gc->DrawText(_L("Test1"),TPoint(xpos,ypos+ascent));
   1.104 +	gc->DrawText(_L("Test2"),TRect(xpos,ypos+height,xpos+50,5+height*2),ascent);
   1.105 +	gc->DrawText(_L("Test3"),TRect(xpos,ypos+height*2,xpos+80,5+height*3),ascent,CGraphicsContext::ERight,10);
   1.106 +//
   1.107 +	ypos+=ascent+height*3;
   1.108 +	gc->SetUnderlineStyle(EUnderlineOn);
   1.109 +	gc->DrawText(_L("ULine"),TPoint(xpos,ypos));
   1.110 +	gc->SetUnderlineStyle(EUnderlineOff);
   1.111 +//
   1.112 +	gc->SetStrikethroughStyle(EStrikethroughOn);
   1.113 +	gc->DrawText(_L("Strike"),TPoint(xpos+50,ypos));
   1.114 +	gc->SetStrikethroughStyle(EStrikethroughOff);
   1.115 +	gc->SetCharJustification(15,3);
   1.116 +	gc->DrawText(_L("abc"),TPoint(xpos+100,ypos));
   1.117 +//
   1.118 +	gc->SetWordJustification(10,1);
   1.119 +	gc->DrawText(_L("Two Words"),TPoint(xpos+5,ypos+height));
   1.120 +//
   1.121 +	xpos = 80;
   1.122 +	ypos = 40;
   1.123 +	RRegion clipRegion(2);
   1.124 +//
   1.125 +	clipRegion.AddRect(TRect(xpos, ypos+10, xpos+30, ypos+20));
   1.126 +	clipRegion.AddRect(TRect(xpos, ypos+30, xpos+30, ypos+40));
   1.127 +	gc->SetClippingRegion(clipRegion);
   1.128 +//
   1.129 +	gc->DrawTextVertical(_L("Vertical Text"), TPoint(xpos+10, ypos+10), EFalse);
   1.130 +	gc->DrawTextVertical(_L("Vertical Text Box"), TRect(xpos+40, ypos+10, xpos+60, ypos+100), 15, EFalse);
   1.131 +//
   1.132 +	gc->CancelClippingRegion();
   1.133 +	clipRegion.Close();
   1.134 +//
   1.135 +	gc->AlphaBlendBitmaps(TPoint(xpos+60, ypos+100), aBitmap, TRect(0, 0, 20,20), aMaskBitmap, TPoint(0, 0));
   1.136 +//
   1.137 +	gc->SetPenColor(TRgb::Gray4(3));
   1.138 +	gc->SetBrushColor(TRgb::Gray4(0));
   1.139 +	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.140 +	xpos = 0;
   1.141 +	ypos = 120;
   1.142 +	TRect mapColorRect(xpos, ypos, xpos+20, ypos+20);
   1.143 +	gc->DrawRect(mapColorRect);
   1.144 +	TRgb colours[4] = { TRgb::Gray4(3), TRgb::Gray4(0), TRgb::Gray4(0), TRgb::Gray4(3) };
   1.145 +	gc->MapColors(mapColorRect, colours, 2, ETrue);
   1.146 +//
   1.147 +	gc->DiscardFont();