diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-0DD1EBC4-6068-5FE7-B649-CABA57E86195.dita --- a/Symbian3/PDK/Source/GUID-0DD1EBC4-6068-5FE7-B649-CABA57E86195.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-0DD1EBC4-6068-5FE7-B649-CABA57E86195.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,47 +1,47 @@ - - - - - -Drawing Polylines and Polygons

This topic provides examples that demonstrate how to draw a polyline and how to draw and fill a self-crossing polygon.

The example code assumes the array of points used when drawing these shapes is defined as follows:

... -// set up an array of points for drawing a polyline and a polygon etc. -// will be used relative to top left of rectangle -TPoint point1(20,20); -TPoint point2(100,190); -TPoint point3(110,90); -TPoint point4(50,150); -TPoint point5(200,150); -CArrayFix<TPoint>* mypoints = new CArrayFixFlat<TPoint>(5); -CleanupStack::PushL(mypoints); -mypoints->AppendL(point1); -mypoints->AppendL(point2); -mypoints->AppendL(point3); -mypoints->AppendL(point4); -mypoints->AppendL(point5); -... - -// switch statement with example cases -... -CleanupStack::PopAndDestroy(); // mypoints
Drawing a polyline

You can draw a polyline using DrawPolyLine() from an array of points.

... -// draw a polyline -gc.DrawPolyLine(mypoints); -...
Drawing a polygon

The following example code illustrates how to draw a filled polygon from an array of points. The polygon is self-crossing. Self-crossing polygons can be filled according to one of two rules, TFillRule::EAlternate (the default), or TFillRule::EWinding. These rules work with the concept of a winding number, as shown in the following figure:

- Winding numbers -

EWinding fills all areas, while EAlternate only fills areas with odd winding numbers.

Drawing a polygon using the EWinding fill rule

  1. Use SetBrushStyle() to set a cross-hatched brush style.

  2. Use DrawPolygon() to draw the polygon with the EWinding fill rule.

... -// draw self-crossing polygon using the winding fill rule -gc.SetBrushStyle(CGraphicsContext::ESquareCrossHatchBrush); -gc.SetBrushColor(black); -gc.DrawPolygon(mypoints,CGraphicsContext::EWinding); -...

Drawing a polygon using the EAlternate fill rule

  1. Use SetBrushStyle() to set a diamond cross-hatched brush style.

  2. Use DrawPolygon() to draw the polygon with the EAlternate fill rule.

... -// draw self-crossing polygon using the alternate fill rule -gc.SetBrushStyle(CGraphicsContext::EDiamondCrossHatchBrush); -gc.SetBrushColor(black); -gc.DrawPolygon(mypoints,CGraphicsContext::EAlternate); -...
Drawing + + + + + +Drawing Polylines and Polygons

This topic provides examples that demonstrate how to draw a polyline and how to draw and fill a self-crossing polygon.

The example code assumes the array of points used when drawing these shapes is defined as follows:

... +// set up an array of points for drawing a polyline and a polygon etc. +// will be used relative to top left of rectangle +TPoint point1(20,20); +TPoint point2(100,190); +TPoint point3(110,90); +TPoint point4(50,150); +TPoint point5(200,150); +CArrayFix<TPoint>* mypoints = new CArrayFixFlat<TPoint>(5); +CleanupStack::PushL(mypoints); +mypoints->AppendL(point1); +mypoints->AppendL(point2); +mypoints->AppendL(point3); +mypoints->AppendL(point4); +mypoints->AppendL(point5); +... + +// switch statement with example cases +... +CleanupStack::PopAndDestroy(); // mypoints
Drawing a polyline

You can draw a polyline using DrawPolyLine() from an array of points.

... +// draw a polyline +gc.DrawPolyLine(mypoints); +...
Drawing a polygon

The following example code illustrates how to draw a filled polygon from an array of points. The polygon is self-crossing. Self-crossing polygons can be filled according to one of two rules, TFillRule::EAlternate (the default), or TFillRule::EWinding. These rules work with the concept of a winding number, as shown in the following figure:

+ Winding numbers +

EWinding fills all areas, while EAlternate only fills areas with odd winding numbers.

Drawing a polygon using the EWinding fill rule

  1. Use SetBrushStyle() to set a cross-hatched brush style.

  2. Use DrawPolygon() to draw the polygon with the EWinding fill rule.

... +// draw self-crossing polygon using the winding fill rule +gc.SetBrushStyle(CGraphicsContext::ESquareCrossHatchBrush); +gc.SetBrushColor(black); +gc.DrawPolygon(mypoints,CGraphicsContext::EWinding); +...

Drawing a polygon using the EAlternate fill rule

  1. Use SetBrushStyle() to set a diamond cross-hatched brush style.

  2. Use DrawPolygon() to draw the polygon with the EAlternate fill rule.

... +// draw self-crossing polygon using the alternate fill rule +gc.SetBrushStyle(CGraphicsContext::EDiamondCrossHatchBrush); +gc.SetBrushColor(black); +gc.DrawPolygon(mypoints,CGraphicsContext::EAlternate); +...
Drawing to a Graphics Context Tutorials Drawing and Graphics Contexts
\ No newline at end of file