// The example draws a "paper airplane" which appears
// three dimensional using different tinted areas.
// The areas are filled with three different patterns
// and then outlined. The drawing of the outline occurs
// in the procedure DrawPolyLine()
#include "Gra.ch"
**************
PROCEDURE Main
LOCAL aPoints, aAttr, nX, nY
SetColor("N/W") // fill window with pale gray
CLS
nX := -100
nY := -100
aPoints := { {nX+550, nY+305}, ; // coordinate for a
{nX+260, nY+230}, ; // "paper airplane"
{nX+300, nY+205}, ;
{nX+330, nY+185}, ;
{nX+370, nY+160}, ;
{nX+310, nY+155}, ;
{nX+340, nY+180} }
aAttr := Array( GRA_AA_COUNT ) // array for area attributes
GraPathBegin() // define path for
GraPos ( , aPoints[1] ) // "wing"
DrawPolyLine( aPoints, {2,3,1} )
DrawPolyLine( aPoints, {4,5,1} )
GraPathEnd()
aAttr [ GRA_AA_SYMBOL ] := GRA_SYM_DENSE7
GraSetAttrArea( NIL, aAttr ) // select light pattern
GraPathFill() // fill path
GraPos( , aPoints[1] )
DrawPolyLine( aPoints, {2,3,1} ) // draw border
DrawPolyLine( aPoints, {4,5,1} )
GraPos( , aPoints[1] ) // define path for "body"
GraPathBegin()
DrawPolyLine( aPoints, {3,6,4,1} )
GraPathEnd()
aAttr [ GRA_AA_SYMBOL ] := GRA_SYM_DENSE5
GraSetAttrArea( NIL, aAttr ) // select darker pattern
GraPathFill() // fill path
DrawPolyLine( aPoints, {3,6,4,1} )
GraPos( , aPoints[4] ) // define path for the rest
GraPathBegin()
DrawPolyLine( aPoints, {6,7,4} )
GraPathEnd()
aAttr [ GRA_AA_SYMBOL ] := GRA_SYM_DENSE3
GraSetAttrArea( NIL, aAttr ) // select dark pattern
GraPathFill() // fill path
Inkey(0)
RETURN
*********************************************
PROCEDURE DrawPolyLine( aPoints, aSubScript )
IF Valtype( aSubScript ) == "A"
AEval( aSubScript, {|n| GraLine(,, aPoints[n] ) } )
ELSE
AEval( aPoints, {|a| GraLine(,, a ) } )
ENDIF
RETURN