The following table describes the three variants of the basic line primitive and the functions that draw them.
Functions that Draw Straight Lines
┌────────────┬────────────────────────┬──────────────────────────────────┐ │Variants │Function │Description │ ├────────────┼────────────────────────┼──────────────────────────────────┤ │Lines │GpiLine │Draws a single line from the │ │ │ │current position to a specified │ │ │ │point. │ ├────────────┼────────────────────────┼──────────────────────────────────┤ │Polylines │GpiPolyLine │Draws a series of connected lines,│ │ │ │from the current position through │ │ │ │successive points. │ ├────────────┼────────────────────────┼──────────────────────────────────┤ │(series of │GpiPolyLineDisjoint │Draws a series of unconnected │ │lines) │ │lines. │ ├────────────┼────────────────────────┼──────────────────────────────────┤ │Boxes │GpiBox │Draws a rectangular box with one │ │ │ │corner at the current position. │ └────────────┴────────────────────────┴──────────────────────────────────┘
When the operating system draws a line, it includes the pels at the starting and ending points of the line. The algorithm used to draw the rest of the line depends on the device driver. For example, a driver for a raster device might use a modified Bresenham algorithm to draw a line, but a driver for a vector device, such as a plotter, simply would connect the starting and ending points of the line. In all cases, the result is a line primitive that looks the same from device to device.