Symbian3/PDK/Source/GUID-BD463EF4-2538-51AF-8946-BFEC902A2DD0.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 5 f345bda72bc4
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     6
<!-- Initial Contributors:
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     7
    Nokia Corporation - initial contribution.
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     8
Contributors: 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     9
-->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    10
<!DOCTYPE concept
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    12
<concept xml:lang="en" id="GUID-BD463EF4-2538-51AF-8946-BFEC902A2DD0"><title>Drawing Lines</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic provides examples that demonstrate how to draw lines of different widths and styles. </p> <p>The examples assume common start and end points have been defined as follows: </p> <codeblock id="GUID-28F12668-9CDD-5AD4-9EE7-32B01DBBE583" xml:space="preserve">...
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    13
// set up a pair of points for drawing diagonal lines
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    14
TPoint startPoint(50,50);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    15
TPoint endPoint(590,190);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    16
...</codeblock> <section><title>Drawing a line a single pixel wide</title> <p>You can draw a thin line diagonally across the screen using <codeph>DrawLine()</codeph>. This illustrates how thin a single pixel width line is, and the visible stepping: </p> <codeblock id="GUID-40B3F1CC-567F-59AD-8A8A-B286D3AD95E5" xml:space="preserve">...
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    17
// draw a thin line from top left to bottom right 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    18
gc.DrawLine(startPoint,endPoint);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    19
...</codeblock> <p> <b>Note</b>: The line width is a single pixel by default. </p> </section> <section><title>Drawing a line three pixels wide</title> <ol id="GUID-4E0BACED-4D3E-51B9-92FE-569DC594A4BD"><li id="GUID-B3E6B674-5F50-5E53-9ED9-F9C01430363B"><p>Use <codeph>SetPenSize()</codeph> to increase the pen size to three pixels. </p> </li> <li id="GUID-07130AED-6D1C-54B3-81CC-30DA3402FC82"><p>Use <codeph>DrawLine()</codeph> to draw a wide line diagonally across the screen. </p> </li> </ol> <codeblock id="GUID-65E94B19-C30D-5C5A-99E3-BFFEA68B2A9D" xml:space="preserve">// Set up a "bold" size for the pen tip to (default is 1,1)
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    20
TSize penSizeBold(3,3);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    21
...
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    22
// draw a line from top left to bottom right 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    23
gc.SetPenSize(penSizeBold);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    24
gc.DrawLine(startPoint,endPoint);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    25
...</codeblock> </section> <section><title>Drawing a line thirty pixels wide</title> <ol id="GUID-CD9DD7A1-D62F-5B31-A6EB-3739800317C9"><li id="GUID-7492D2DB-7F32-55F0-8760-AAF1FD85A9BD"><p>Use <codeph>SetPenWidth()</codeph> to set the pen width to thirty pixels wide. </p> </li> <li id="GUID-C24B8085-30DD-584F-A5D6-BD024E5C1215"><p>Use <codeph>DrawLine()</codeph> to draw a thirty pixel wide line, (x dimension), diagonally across the screen. </p> </li> </ol> <codeblock id="GUID-587C939D-359D-5618-946D-1A0C5286D0E0" xml:space="preserve">// Set up a "fat" size for the pen tip
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    26
TSize penSizeFat(30,30);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    27
...
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    28
// draw a rather wide line from top left to bottom right,
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    29
// illustrating rounded ends and their clipping
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    30
gc.SetPenWidth(penSizeFat);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    31
gc.DrawLine(startPoint,endPoint);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    32
...</codeblock> <p><b>Notes </b> </p> <ul><li id="GUID-9C1799DF-A1B3-5047-B23E-0AC340EBB607"><p>The ends of wide lines are rounded. </p> </li> <li id="GUID-5888D165-DD1E-5E41-81B5-ADFDF0ED9FF2"><p>The effective width of the line depends on the size of the pen tip, which is elliptical. </p> </li> <li id="GUID-1396D6C5-4F90-56E2-923F-94C4EDC7B170"><p>The rounded end of a wide line may be clipped to the window, even though the end point is within the window. </p> </li> </ul> </section> <section><title>Drawing a dotted line</title> <ol id="GUID-3524D696-5ABC-5E06-910B-26EACA1E2A5E"><li id="GUID-3B6DB02F-BAD2-5EB2-B7EC-9056D737C727"><p>Use <codeph>SetPenStyle()</codeph> to set the style of the pen to dotted. </p> </li> <li id="GUID-3866320E-CEC6-5444-A629-888ABE6B8E4F"><p>Use <codeph>DrawLine()</codeph> to draw a thin dotted line diagonally across the screen. </p> </li> </ol> <codeblock id="GUID-D2785C65-6614-5A2D-8405-295D7C39F96D" xml:space="preserve">...
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    33
// draw a dotted line from top left to bottom right 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    34
gc.SetPenStyle(CGraphicsContext::EDottedPen);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    35
gc.DrawLine(startPoint,endPoint);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    36
...</codeblock> <p> <b>Note</b>: The pen style remains in effect until changed by another call to <codeph>SetPenStyle()</codeph> or the graphics context is reset to its default settings. </p> </section> <section><title>Drawing a dot-dashed line</title> <ol id="GUID-92BB412D-E3A3-5D18-A806-EAE6BD960043"><li id="GUID-8F2FEDB5-067E-586D-8531-4761CEBFC1B0"><p>Use <codeph>SetPenStyle()</codeph> to set the style of the pen to dot-dashed. </p> </li> <li id="GUID-252ED7E4-9A04-5D7B-8D0B-9F0869BCC959"><p>Use <codeph>DrawLine()</codeph> to draw a thin dot-dashed line diagonally across the screen. </p> </li> </ol> <codeblock id="GUID-3FDE1DE2-64BD-5312-AA84-A36CE362E655" xml:space="preserve">...
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    37
// draw a dot dash line from top left to bottom right 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    38
gc.SetPenStyle(CGraphicsContext::EDotDashPen);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    39
gc.DrawLine(startPoint,endPoint);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    40
...</codeblock> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
1
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    41
                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>