Function GraSegDestroy() Foundation

Deletes a specific graphic segment.

Syntax
GraSegDestroy( [<oPS>], <nSegmentID> ) --> lSuccess
Parameters
<oPS>
The argument <oPS> specifies the presentation space in which a graphic segment is released. 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(). A "Micro PS" cannot be used for this function.
<nSegmentID>
The parameter <nSegmentID> must have a numeric value which identifies the segment to be released. Each graphic segment receives a numeric code as the return value of the function GraSegOpen(). This value is used for <nSegmentID>.
Return

The return value of GraSegDestroy() is .T. (true) when the segment was deleted, otherwise it is .F. (false). If the return value equals .F., the cause of error can be determined by GraError().

Description

A graphic segment is deleted by GraSegDestroy(). This is always recommended when a segment contains extensive calls of graphic primitives and has been displayed. After display, the segment should be deleted if it is not needed again.

Examples
Destroying a graphic segment after use
// The example demonstrates how a path is defined 
// within a segment. The path needs to be defined only 
// once and can then be recreated by GraSegDraw(). 
// The segment is released after the path operations 
// have been executed. 

#include "Gra.ch" 

PROCEDURE Main 
   LOCAL nSegment, aAttr, nDrawMode 

   SetColor("N/W")                  // fill window with pale gray 
   CLS 
   aAttr := Array( GRA_AA_COUNT )   // set fill attributes 
   aAttr [ GRA_AA_SYMBOL ] := GRA_SYM_DIAG3 
   GraSetAttrArea( NIL, aAttr ) 
                                    // set draw mode 
   nDrawMode:= GraSegDrawMode( NIL, GRA_DM_DRAWANDRETAIN) 

   nSegment := GraSegOpen() 
      GraPathBegin()                // define graphic path 
        GraArc( , {150,200},  50 ) 
        GraArc( , {150,200}, 100 ) 
      GraPathEnd() 
   GraSegClose() 

   GraPathFill()                    // fill path 

   GraSegDraw( NIL, nSegment )      // recreate path 
   GraPathOutLine()                 // outline path 

   GraSegDestroy( NIL, nSegment )   // release segment 

   GraSegDrawMode( NIL, nDrawMode ) // reset draw mode 

   Inkey(0)                         // wait for key press 
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.