DIRECTORY Imager, Rope; Draw2d: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; Context: TYPE ~ Imager.Context; VEC: TYPE ~ Imager.VEC; -- RECORD [x, y: REAL] DrawType: TYPE ~ {solid, dashed, dotted}; MarkType: TYPE ~ {cross, x, asterisk, dot, none}; PixelProc: TYPE ~ PROC [x, y: INTEGER, data: REF ANY _ NIL] RETURNS [continue: BOOL _ TRUE]; Clear: PROC [context: Context]; Label: PROC [context: Context, vec: VEC, rope: ROPE]; DoWithBuffer: PROC [context: Context, action: PROC, clear: BOOL _ TRUE]; Line: PROC [context: Context, vec0, vec1: VEC, drawType: DrawType _ solid]; DoWithLine: PUBLIC PROC [vec0, vec1: VEC, pixelProc: PixelProc]; Mark: PROC [context: Context, vec: VEC, markType: MarkType _ cross]; Square: PROC [context: Context, vec: VEC, size: REAL]; Circle: PUBLIC PROC [context: Context, vec: VEC, radius: REAL, fill: BOOL _ FALSE]; Arrow: PROC [ context: Context, tail, head: VEC, drawType: DrawType _ solid, vary: BOOL _ TRUE]; END. Draw2d.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, September 20, 1986 3:27:15 pm PDT Type Declarations General Utility Procedures Clear context to white. Combines Imager.SetXY and Imager.ShowRope. Font, if unitialized, is set to helvetica10. Set stroke width to zero and perform action while double buffering. If clear, the buffer is first cleared to white. Line Drawing Procedures If the Imager stroke width is non-zero or the context expects anti-aliasing, then MaskVector is called; otherwise a pixel wide line from vec0 to vec1 is drawn with Bresenham algorithm. Depending on the display mode, this is two to six times faster than Imager.MaskVector. Apply pixelProc to each pixel of the line, as determined by the Bresenham algorithm. Miscellaneous Procedures Draw a mark at vec. Draw a solid square centered at vec with edges at +/- size. Draw a circle at the given center with the given radius. Draw an arrow from tail to head; if vary, arrowhead size varies according to arrow length. Κ]˜šœ ™ Jšœ Οmœ1™