Symbian3/PDK/Source/GUID-D38C47AD-ED05-5693-A734-498788B9B85B.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept xml:lang="en" id="GUID-D38C47AD-ED05-5693-A734-498788B9B85B"><title>Using Relative and Sequential Drawing</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic provides examples that demonstrate how to draw a triangle first using relative drawing with a thin solid line, then using relative drawing and a wide line (illustrating curved corners) and finally using sequential drawing between points, with a dot dash line, illustrating line pattern continuation. </p> <p>Note that there is a third way to draw a triangle, using <codeph>DrawPolygon()</codeph>. This must be to used to draw a filled triangle. </p> <section><title>Drawing a triangle using relative drawing (thin lines)</title> <p>You can draw a triangle of thin lines, using relative drawing, <codeph>MoveTo()</codeph> and <codeph>DrawLineBy()</codeph>. </p> <codeblock id="GUID-45B63152-282C-5E8C-8539-0350CC25649A" xml:space="preserve">...
       
    13 // draw a triangle by relative drawing
       
    14 gc.MoveTo(TPoint(300,50)); // drawing position (300,50)
       
    15 gc.DrawLineBy(TPoint(205,100)); // drawing position (505,150)
       
    16 gc.DrawLineBy(TPoint(-410,0)); // drawing position (95,150)
       
    17 gc.DrawLineBy(TPoint(205,-100)); // drawing position (300,50)
       
    18 ...</codeblock> <p> <b>Note</b>: The sum of the three <codeph>TPoint</codeph> vectors used by the <codeph>DrawLineBy()</codeph> calls comes to <codeph>(0,0)</codeph>, thus creating a closed shape. </p> </section> <section><title>Drawing a triangle using relative drawing (thick lines)</title> <p>You can draw a triangle of thick lines, using relative drawing, <codeph>MoveTo()</codeph> and <codeph>DrawLineBy()</codeph>. </p> <codeblock id="GUID-9AF54D2D-16E8-5C2E-9022-A692D37FF4EA" xml:space="preserve">...
       
    19 // draw a triangle, by relative drawing
       
    20 // illustrating rounded ends at corners when using very wide lines
       
    21 gc.SetPenWidth(penSizeFat);
       
    22 gc.MoveTo(TPoint(300,50)); // drawing position (300,50)
       
    23 gc.DrawLineBy(TPoint(205,100)); // drawing position (505,150)
       
    24 gc.DrawLineBy(TPoint(-410,0)); // drawing position (95,150)
       
    25 gc.DrawLineBy(TPoint(205,-100)); // drawing position (300,50)
       
    26 ...</codeblock> </section> <section><title>Drawing a triangle using sequential drawing between points</title> <p>This topic provides an example that demonstrates how to draw a triangle of dot dash lines, using sequential drawing between points, <codeph>DrawLineTo()</codeph>. </p> <codeblock id="GUID-C7DDA7DC-1B49-5AD0-99A9-45807AF76C40" xml:space="preserve">...
       
    27 // draw a triangle by sequential drawing between specified points,
       
    28 // using dot-dash line style, illustrating line pattern continuation 
       
    29 gc.SetPenStyle(CGraphicsContext::EDotDashPen);
       
    30 gc.MoveTo(TPoint(300,50)); // drawing position (300,50)
       
    31 gc.DrawLineTo(TPoint(505,150)); // drawing position (505,150)
       
    32 gc.DrawLineTo(TPoint(95,150)); // drawing position (95,150)
       
    33 gc.DrawLineTo(TPoint(300,50)); // drawing position (300,50)
       
    34 ...</codeblock> <p> <b>Note</b>: The final point drawn to is the same as the point originally moved to, thus creating a closed shape. </p> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
       
    35                 to a Graphics Context Tutorials</linktext> </link> <link href="GUID-E3AC8F3E-9D5C-5E7D-9760-023B77C7C8A8.dita"><linktext>Drawing and Graphics Contexts</linktext> </link> </related-links></concept>