DIRECTORY Imager, Rope; Draw2d: CEDAR DEFINITIONS ~ BEGIN Context: TYPE ~ Imager.Context; VEC: TYPE ~ Imager.VEC; -- RECORD [x, y: REAL] DrawType: TYPE ~ {solid, dash, dot}; MarkType: TYPE ~ {cross, x, asterisk, dot, none}; PixelProc: TYPE ~ PROC [x, y: INTEGER, data: REF ANY _ NIL]; Clear: PROC [context: Context, width, height: INTEGER]; InitFont: PROC [context: Context]; Label: PROC [context: Context, vec: VEC, rope: Rope.ROPE]; DoWithBuffer: PROC [context: Context, width, height: INTEGER, action: PROC]; 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]; Arrow: PROC [context: Context, tail, head: VEC, vary: BOOL _ TRUE]; END. άDraw2d.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, September 16, 1986 12:36:02 pm PDT Type Declarations General Utility Procedures Clear a context to white; width and height refer to the context. Set the font for subsequent calls to Label. Combines Imager.SetXY and Imager.ShowRope. Combine InitFont and ImagerOps.DoWithBuffer; width and height refer to the context. Line Drawing Procedures Draw a pixel wide line from vec0 to vec1 with Bresenham algorithm. If the Imager stroke width is non-zero or the context expects anti-aliasing, then MaskVector is called. Depending on the display mode, Line is two to six times faster than Imager.MaskVector. Apply pixelProc to each pixel of the line; pixels are determined by the Bresenham algorithm. Miscellaneous Procedures Draw a mark at vec. Draw a solid square centered at vec with edges at +/- size. Draw an arrow from tail to head; if vary, arrowhead size varies according to arrow length. Κϋ˜šœ ™ Jšœ Οmœ1™