Draw2dDoc.tioga
Bloomenthal, November 24, 1990 12:23 pm PST
PCEDAR 2.0 —
Draw2d
Jules Bloomenthal
© Copyright 1985, 1990 Xerox Corporation. All rights reserved.
Abstract: An interface is provided for drawing lines and marking points in an Imager context.
Created by: Jules Bloomenthal and Michael Plass
Maintained by: Jules Bloomenthal <Bloomenthal.pa>
Keywords: 2D, Imager, Context, LineDrawing, Arrows, Squares.
Df File: /PCedar/Top/Draw2d-Suite.df.
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

1. The Interface
Draw2d provides a number of Imager context utilities, including clearing and font initialization.
Line is a procedure that connects two points by a solid, dashed, or dotted line. For pixel-wide, non anti-aliased lines, this procedure executes two to six times faster than the comparable Imager.MaskVector, depending on whether the context is on the LF display or, if on the color display, whether the display is in dither, gray or full color mode. The execution improvement is achieved by using the Bresenham line drawing algorithm. All calls are made through the Imager; if Imager stroke width is not zero, or if the Imager context calls for anti-aliasing, then the system Imager.MaskVector call is used. The lines may be in color or shades of gray. The lines drawn by Line do not necessarily match exactly those drawn by MaskVector; Draw2dTest demonstrates the (minor) differences.
A utility, DoWithLine, applies a callback procedure to every pixel in a given line.
Other Draw2d procedures place crosses, x's, asterisks, dots, squares, or arrows at a given location in the Imager context.
2. Programs
The command Draw2dLines compares execution times of Draw2d.Line, Imager.MaskVector, and ImagerCG6Context.Line.