Function GraPathFill() Foundation

Fills a defined graphic path with a pattern.

Syntax
GraPathFill( [<oPS>], [<nFillMode>] ) --> lSuccess
Parameters
<oPS>
The argument <oPS> specifies the presentation space in which the graphic path is filled. If the current window is an XbpCrt window, <oPS> is optional. If it is NIL, the return value of SetAppWindow():presSpace() is used. In all other cases <oPS> is not optional. It must be created using XbpPresSpace():new() or a "Micro PS" must be requested from an Xbase Part using the method :lockPS(). After graphic output the Micro PS must be released with :unlockPS().
<nFillMode>
<nFillMode> specifies the mode for filling. This is significant only with complex paths. Complex paths consist of several, mutual overlapping areas. For this parameter, one of the two #define constants GRA_PATH_FILL_ALTERNATE or GRA_PATH_FILL_WINDING are used. The default value is GRA_PATH_FILL_ALTERNATE.
Return

The return value of GraPathFill() is .T. (true) when the path was filled, otherwise it is .F. (false). If the return value equals .F., the cause of error can be determined with GraError().

Description

The function GraPathFill() fills a graphic path defined by GraPathBegin() / GraPathEnd() with a pattern. The fill pattern must have been previously selected using the function GraSetAttrArea(). After the call to GraPathFill() the definition of the path is discarded.

Examples
Filling graphic paths
// 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 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.