Drawing lines on a window

The program Draw.m3 demonstrates how lines and curves are drawn in a VBT. The basic primitive line segments are part of the Path interface. Each segment can be straight or curved. The Stroke method of the VBT interface actually draws the shape given by a path.

The result is shown in the image Draw:

An object of type TexasVBT contains a path that is roughly in the shape of the state of Texas. This shape is carefully designed not in accordance with the precise geography of the state, but so that a tessellation of the plane is possible. The path is made in units of pixels. The Repaint subprocedure uses the path to draw the shape is several places. Four vertically ascending rows are drawn. A nested subprocedure Pair draws two adjacent shapes at a time. One is filled in with the color red, the other is outlined in the color blue.

Rather than create the paint operations explicitly in the main program module, this program (and all the remaining programs that require them) import the operations from another module. This module, Colors.i3, serves no other purpose than removing some code from the program. The painting operations that the module provides are those that simply paint a particular solid color. A number of different paint operations are provided including the red, white, and blue operations used by Draw.m3. The implementation of the module, as well as the interface, can be found in the appendix Auxiliary Modules.