Symbian3/SDK/Source/GUID-A5693758-495B-598E-A514-24C48D459BB6.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
--- a/Symbian3/SDK/Source/GUID-A5693758-495B-598E-A514-24C48D459BB6.dita	Wed Mar 31 11:11:55 2010 +0100
+++ b/Symbian3/SDK/Source/GUID-A5693758-495B-598E-A514-24C48D459BB6.dita	Fri Jun 11 12:39:03 2010 +0100
@@ -1,55 +1,55 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
-<!-- This component and the accompanying materials are made available under the terms of the License 
-"Eclipse Public License v1.0" which accompanies this distribution, 
-and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
-<!-- Initial Contributors:
-    Nokia Corporation - initial contribution.
-Contributors: 
--->
-<!DOCTYPE concept
-  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
-<concept xml:lang="en" id="GUID-A5693758-495B-598E-A514-24C48D459BB6"><title>Drawing Arcs and Ellipses</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic provides examples that demonstrate how to draw ellipses and arcs. The first draws the whole ellipse; the second, one section of the ellipse; and in the third, the other section of the ellipse is drawn (also illustrating construction lines and points). It also shows how to draw two pie slices making an ellipse. </p> <p>The code assumes that the ellipse and arc examples all use a common pre-defined rectangle: </p> <codeblock id="GUID-E2CBAA84-72BA-5E97-97F9-52AEB00C6E5C" xml:space="preserve">...
-TRect ellipseRect=Rect(); // for arcs and ellipse
-ellipseRect.Shrink(10,10); // set size so inside the border rectangle
-...</codeblock> <p>The arc and pie slice examples use two construction points as arguments: </p> <codeblock id="GUID-A701FA54-8AB4-5622-9DCC-4BF6B55C8C8F" xml:space="preserve">...
-TPoint screenCenterPoint=rect.Center(); // the center of the screen
-    
-// set up a pair of construction points for arc and pie slice drawing
-TPoint constructionPoint1(15,15); // outside the construction ellipse
-TPoint constructionPoint2(200,150); // inside the construction ellipse
-...</codeblock> <p>The center point is drawn in the second arc example to clarify arc construction. </p> <section><title>How to draw an ellipse</title> <p>You can use <codeph>DrawEllipse()</codeph> to draw an ellipse. </p> <codeblock id="GUID-076DE9D4-9F7F-56E7-8A13-AA546C8672E2" xml:space="preserve">...
-// draw an ellipse centered in the rectangle
-gc.DrawEllipse(ellipseRect);
-...</codeblock> </section> <section><title>How to draw an arc</title> <p>An arc is drawn as a portion of an ellipse. As well as the ellipse rectangle, the call must specify the two points: the first defines one end of a line from the geometric center of the ellipse; the point of intersection between this line and the ellipse defines the start point of the arc. The second specified point acts in the same way for the end of the arc. </p> <fig id="GUID-ED34ADD7-004F-5BE6-822F-B5592E4F1A9A"><title>
-             Arc construction 
-          </title> <image href="GUID-6A5D0445-5D53-5293-A501-136203C80BEE_d0e207300_href.png" placement="inline"/></fig> <p>The example code here shows how an arc is drawn in an anti-clockwise direction using <codeph>constructionPoint1</codeph> and <codeph>constructionPoint2</codeph> as the start to the end points. </p> <codeblock id="GUID-956A154F-EE60-5286-97BA-B05ABBA2C949" xml:space="preserve">...
-// draw an arc centered in the rectangle
-gc.DrawArc(ellipseRect,constructionPoint1,constructionPoint2);
-...</codeblock> <p>You can reverse the pair of construction point arguments to draw the other half of the ellipse. The construction points and screen center are also drawn, with dotted construction lines: </p> <codeblock id="GUID-CAB960B4-66DC-5996-9D2E-094B0171BFB5" xml:space="preserve">...
-// draw an arc centered in the rectangle
-// that is the other portion of the ellipse
- gc.DrawArc(ellipseRect,constructionPoint2,constructionPoint1);
-    
-// draw construction lines and points
-gc.SetPenStyle(CGraphicsContext::EDottedPen);
-gc.MoveTo(constructionPoint1);
-gc.DrawLineTo(screenCenterPoint);
-gc.DrawLineTo(constructionPoint2);
-gc.SetPenSize(penSizeBold);
-gc.Plot(constructionPoint1);
-gc.Plot(constructionPoint2);
-gc.Plot(screenCenterPoint);
-...</codeblock> </section> <section><title>Drawing pie slices</title> <p>The example code here shows how two pie slices are drawn. A pie slice is the area bounded by: </p> <p>an arc as used above </p> <p>the straight line from the start point from the geometric center of the ellipse </p> <p>the straight line from the end point from the geometric center of the ellipse </p> <fig id="GUID-71C67896-8B38-5D1E-B34A-0425CF135915"><title>
-             Pie slice construction 
-          </title> <image href="GUID-20B364FB-FC12-5EF1-B0EC-1A845693EFFD_d0e207341_href.png" placement="inline"/></fig> <p>Solid and patterned brush styles are used to fill the portions of the elliptical disc. </p> <ol id="GUID-8A734874-8E67-5ABF-9C65-308B136D25D4"><li id="GUID-31A563CE-3043-5713-9FBA-A42C6902F544"><p>Use <codeph>SetBrushStyle()</codeph> to set the brush style to solid. </p> </li> <li id="GUID-0F8D5C04-DD38-5B8A-9BAA-B2E9F9C53C1E"><p>Use <codeph>SetBrushColour()</codeph> to set the brush color to black. </p> </li> <li id="GUID-6EDBBFE4-640C-5E40-8AFE-8B0E99F843A3"><p>Use <codeph>DrawPie()</codeph> to draw a pie slice. </p> </li> <li id="GUID-5ADA6FF4-D9B8-5624-AE74-8C58FF06B624"><p>Use <codeph>SetBrushStyle()</codeph> to set the patterned brush style. </p> </li> <li id="GUID-FA09E650-1E1E-5565-8329-41490F77A974"><p>Use <codeph>DrawPie()</codeph> and reverse the pair of construction point arguments so that the two pie slices together form a whole ellipse. </p> </li> </ol> <codeblock id="GUID-79463D92-F260-52BD-BF5B-5917365E9C19" xml:space="preserve">...
-// draw a pie slice centered in the rectangle
-gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
-gc.SetBrushColor(black);
-gc.DrawPie(ellipseRect,constructionPoint1,constructionPoint2);
-    
-// draw the other portion of the elliptical disc
-gc.SetBrushStyle(CGraphicsContext::EVerticalHatchBrush);
-gc.DrawPie(ellipseRect,constructionPoint2,constructionPoint1);
-...</codeblock> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept xml:lang="en" id="GUID-A5693758-495B-598E-A514-24C48D459BB6"><title>Drawing Arcs and Ellipses</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic provides examples that demonstrate how to draw ellipses and arcs. The first draws the whole ellipse; the second, one section of the ellipse; and in the third, the other section of the ellipse is drawn (also illustrating construction lines and points). It also shows how to draw two pie slices making an ellipse. </p> <p>The code assumes that the ellipse and arc examples all use a common pre-defined rectangle: </p> <codeblock id="GUID-E2CBAA84-72BA-5E97-97F9-52AEB00C6E5C" xml:space="preserve">...
+TRect ellipseRect=Rect(); // for arcs and ellipse
+ellipseRect.Shrink(10,10); // set size so inside the border rectangle
+...</codeblock> <p>The arc and pie slice examples use two construction points as arguments: </p> <codeblock id="GUID-A701FA54-8AB4-5622-9DCC-4BF6B55C8C8F" xml:space="preserve">...
+TPoint screenCenterPoint=rect.Center(); // the center of the screen
+    
+// set up a pair of construction points for arc and pie slice drawing
+TPoint constructionPoint1(15,15); // outside the construction ellipse
+TPoint constructionPoint2(200,150); // inside the construction ellipse
+...</codeblock> <p>The center point is drawn in the second arc example to clarify arc construction. </p> <section><title>How to draw an ellipse</title> <p>You can use <codeph>DrawEllipse()</codeph> to draw an ellipse. </p> <codeblock id="GUID-076DE9D4-9F7F-56E7-8A13-AA546C8672E2" xml:space="preserve">...
+// draw an ellipse centered in the rectangle
+gc.DrawEllipse(ellipseRect);
+...</codeblock> </section> <section><title>How to draw an arc</title> <p>An arc is drawn as a portion of an ellipse. As well as the ellipse rectangle, the call must specify the two points: the first defines one end of a line from the geometric center of the ellipse; the point of intersection between this line and the ellipse defines the start point of the arc. The second specified point acts in the same way for the end of the arc. </p> <fig id="GUID-ED34ADD7-004F-5BE6-822F-B5592E4F1A9A"><title>
+             Arc construction 
+          </title> <image href="GUID-6A5D0445-5D53-5293-A501-136203C80BEE_d0e202292_href.png" placement="inline"/></fig> <p>The example code here shows how an arc is drawn in an anti-clockwise direction using <codeph>constructionPoint1</codeph> and <codeph>constructionPoint2</codeph> as the start to the end points. </p> <codeblock id="GUID-956A154F-EE60-5286-97BA-B05ABBA2C949" xml:space="preserve">...
+// draw an arc centered in the rectangle
+gc.DrawArc(ellipseRect,constructionPoint1,constructionPoint2);
+...</codeblock> <p>You can reverse the pair of construction point arguments to draw the other half of the ellipse. The construction points and screen center are also drawn, with dotted construction lines: </p> <codeblock id="GUID-CAB960B4-66DC-5996-9D2E-094B0171BFB5" xml:space="preserve">...
+// draw an arc centered in the rectangle
+// that is the other portion of the ellipse
+ gc.DrawArc(ellipseRect,constructionPoint2,constructionPoint1);
+    
+// draw construction lines and points
+gc.SetPenStyle(CGraphicsContext::EDottedPen);
+gc.MoveTo(constructionPoint1);
+gc.DrawLineTo(screenCenterPoint);
+gc.DrawLineTo(constructionPoint2);
+gc.SetPenSize(penSizeBold);
+gc.Plot(constructionPoint1);
+gc.Plot(constructionPoint2);
+gc.Plot(screenCenterPoint);
+...</codeblock> </section> <section><title>Drawing pie slices</title> <p>The example code here shows how two pie slices are drawn. A pie slice is the area bounded by: </p> <p>an arc as used above </p> <p>the straight line from the start point from the geometric center of the ellipse </p> <p>the straight line from the end point from the geometric center of the ellipse </p> <fig id="GUID-71C67896-8B38-5D1E-B34A-0425CF135915"><title>
+             Pie slice construction 
+          </title> <image href="GUID-20B364FB-FC12-5EF1-B0EC-1A845693EFFD_d0e202333_href.png" placement="inline"/></fig> <p>Solid and patterned brush styles are used to fill the portions of the elliptical disc. </p> <ol id="GUID-8A734874-8E67-5ABF-9C65-308B136D25D4"><li id="GUID-31A563CE-3043-5713-9FBA-A42C6902F544"><p>Use <codeph>SetBrushStyle()</codeph> to set the brush style to solid. </p> </li> <li id="GUID-0F8D5C04-DD38-5B8A-9BAA-B2E9F9C53C1E"><p>Use <codeph>SetBrushColour()</codeph> to set the brush color to black. </p> </li> <li id="GUID-6EDBBFE4-640C-5E40-8AFE-8B0E99F843A3"><p>Use <codeph>DrawPie()</codeph> to draw a pie slice. </p> </li> <li id="GUID-5ADA6FF4-D9B8-5624-AE74-8C58FF06B624"><p>Use <codeph>SetBrushStyle()</codeph> to set the patterned brush style. </p> </li> <li id="GUID-FA09E650-1E1E-5565-8329-41490F77A974"><p>Use <codeph>DrawPie()</codeph> and reverse the pair of construction point arguments so that the two pie slices together form a whole ellipse. </p> </li> </ol> <codeblock id="GUID-79463D92-F260-52BD-BF5B-5917365E9C19" xml:space="preserve">...
+// draw a pie slice centered in the rectangle
+gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+gc.SetBrushColor(black);
+gc.DrawPie(ellipseRect,constructionPoint1,constructionPoint2);
+    
+// draw the other portion of the elliptical disc
+gc.SetBrushStyle(CGraphicsContext::EVerticalHatchBrush);
+gc.DrawPie(ellipseRect,constructionPoint2,constructionPoint1);
+...</codeblock> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
                 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>
\ No newline at end of file