Higher-level procedures

On top of the basic graphical operations, the graphical library provides a number of higher-level procedures for the ease of use. The higher-level procedures are implemented using the basic procedures. For example, the `line procedure is implemented using `newpath, `moveto, `lineto and `stroke procedures:

    ` <- [&:x1, &:y1, &:x2, &:y2] : `line <-
    {
      in.{
        `newpath;
        `moveto x1, y1;
        `lineto x2, y2;
        `stroke;
      };
    };
       

Currently, the graphical library contains the higher-level procedures listed below. In the future, more procedures are likely to be added.

Table 15.2. Higher-level graphical procedures.

`line x1,y1,x2,y2 Draw a line from the point with coordinates x1, y1 to the point with coordinates x2, y2. All the coordinates should be real numbers.
`polyline {[x,y]} Draw a shape that consists of straight line segments. The argument is a set of tuples containing the coordinates of the points that make up the polyline.
`strokerect x,y,width,height Draw an empty rectangle with the bottom left corner at the point with the x, y coordinates and with the given width and height. All parameters are real numbers.
`fillrect x,y,width,height Draw a filled rectangle with the bottom left corner at the point with the x, y coordinates and with the given width and height. All parameters are real numbers.
`strokecircle x,y,radius Draw an empty circle with the center at the point with the x and y coordinates and with radius radius. All parameters are real numbers. Not implemented yet.
`fillcircle x,y,radius Draw a filled circle with the center at the point with the x and y coordinates and with radius radius. All parameters are real numbers.