VDrawCurve


 
Name
  VDrawCurve - draws lines between selected points.
 
Synopsis
  VDrawCurve(win, overlay, points, npoints, vertices, nvertices)
  Window win;
  int overlay;
  XPoint **points;                      /*RETURN*/
  XPoint **vertices;                    /*RETURN*/
  int *npoints;                         /*RETURN*/
  int *nvertices;                       /*RETURN*/
 
Description
  VDrawCurve draws lines between selected points to form a closed curve. 
VDrawCurve allows users to select points and draw lines between previous and 
current points by pressing the left button. The middle button is pushed to 
select a point and erase a curve from the point indicated up to the last point
VDrawCurve uses a 5x5 points matrix to check if the selected point is close to
the curve. If the curve cannot be closed, an error message is flashed in the 
dialog window.The right button can be pushed to close the curve. When
a curve is closed, VDrawCurve returns the points on the curve to **points
and the number of such points to *npoints. VDrawCurve also returns the
vertices along the curve to **vertices and the number of such vertices to
*nvertices. VTurnOnOverlay should be called to turn on the overlays and
VSelectEvents should be called to select ButtonPress events in the
image wndow or one of its subwindows.
 
Return Value
  0 - work successfully.
  1 - memory allocation error.
  6 - invalid window ID.
  225 - no overlay created.
  237 - overlay is not on.
  276 - bad curve data, there are points which are repeated.
  277 - no point is selected.
 
Parameters
  win - the image window ID or one of its subwindows' ID.
  event - the current event removed from the event queue.
  overlay - specifies the overlay number of the curve to be drawn.
  points - returns a pointer to an array of XPoint structures containing the
        positions of the curve points; the user should free the memory
	allocated here, after use.
  npoints - returns the number of curve points.
  vertices - returns a pointer to an array of XPoint structures containing
        the positions of the curve vertices; the user should free the memory
	allocated here, after use.
  nvertices - returns the number of curve vertices.
 
Side Effects
  None.
 
Entry Conditions
  VTurnOnOverlay should be called first and ButtonPress events selected in the
window first. If overlay is not valid, or points, npoints, vertices, or 
nvertices is NULL, or VCreateColormap is not called earlier, VDrawCurve prints
an error message to the standard error stream, produces a core dump file and 
exits from the current process.
 
Related Functions
VTurnOnOverlay, VSelectEvents.