DIRECTORY Imager USING [Trajectory, Color], Graphics USING [Context], JunoStorage USING [Coords, IntCoords], ViewerClasses USING [Viewer], Rope USING [ROPE]; JunoGraphics: DEFINITIONS = BEGIN OPEN Rope, Stor: JunoStorage; Coords: TYPE = Stor.Coords; -- Juno coordinates (big points from bottom left corner of buffer) IntCoords: TYPE = Stor.IntCoords; -- same as above, rounded to nearest integer for speed Trajectory: TYPE = Imager.Trajectory; PaintMode: TYPE = {opaque, invert}; Color: TYPE = Imager.Color; Viewer: TYPE = ViewerClasses.Viewer; black, white, invert: READONLY Color; currentColor: READONLY Color; currentEnds: READONLY ATOM; -- $round, $butt, $square currentWidth: READONLY REAL; -- line width for draw command (juno units) currentFontName: READONLY ROPE; -- "Helvetica", "Times", etc currentFontSize: READONLY REAL; -- in big points currentFontFace: READONLY ATOM; -- $regular, $italic, $bold, $boldItalic currentJustification: READONLY ATOM; -- $left, $center, $right (affects DrawRope) currentPictureWidth: READONLY INTEGER; -- current picture dimensions (Juno units) currentPictureHeight: READONLY INTEGER; caretOn: READONLY BOOL; -- if TRUE, caret is supposed to be blinking on the image viewer caretPos: READONLY Coords; -- current caret position, in Juno coordinates SetScreenContext: PUBLIC PROC; SetPaperContext: PUBLIC PROC [device: ATOM, fileName: Rope.ROPE, mag: REAL _ 1.0]; SetPictureSize: PUBLIC PROC [width, height: INTEGER]; SetColor: PUBLIC PROC [color: Color] RETURNS [old: Color]; IntensityToColor: PUBLIC PROC [intensity: REAL] RETURNS [color: Color]; RGBToColor: PUBLIC PROC [r, g, b: REAL] RETURNS [color: Color]; SetEnds: PUBLIC PROC [ends: ATOM] RETURNS [old: ATOM]; SetWidth: PUBLIC PROC [width: REAL] RETURNS [old: REAL]; SetFontName: PUBLIC PROC [name: ROPE] RETURNS [old: ROPE]; SetFontSize: PUBLIC PROC [size: REAL] RETURNS [old: REAL]; SetFontFace: PUBLIC PROC [face: ATOM] RETURNS [old: ATOM]; SetJustification: PUBLIC PROC [justification: ATOM] RETURNS [old: ATOM]; SetCaret: PUBLIC PROC [on: BOOL _ TRUE, coords: Coords _ [0,0]]; Whiten: PUBLIC PROC; PointSymbol: TYPE = {dot, plus, cross, box, diamond, bigDot}; Hilyte: PUBLIC PROC[coords: Coords, symbol: PointSymbol]; DrawPoint: PUBLIC PROC[coords: Coords]; DrawEdge: PUBLIC PROC [p, q: Coords, thin: BOOL _ TRUE]; DrawArc: PUBLIC PROC [p, r, s, q: Coords, thin: BOOL _ TRUE]; AppendEdge: PUBLIC PROC [t: Trajectory, p, q: Coords] RETURNS [new: Trajectory]; AppendArc: PUBLIC PROC [t: Trajectory, p, r, s, q: Coords] RETURNS [new: Trajectory]; FillTrajectory: PUBLIC PROC [t: Trajectory]; StrokeTrajectory: PUBLIC PROC [t: Trajectory]; GcTrajectory: PUBLIC PROC [t: Trajectory]; DrawChar: PUBLIC PROC [coords: Coords, char: CHAR]; DrawRope: PUBLIC PROC [coords: Coords, rope: ROPE]; GetRopeDispl: PUBLIC PROC[rope: ROPE] RETURNS [vec: Coords]; ViewerToJuno: PROC [viewer: Viewer, view: IntCoords] RETURNS [coords: IntCoords]; JunoToViewer: PROC [viewer: Viewer, coords: Coords] RETURNS [view: IntCoords]; picChanged: READONLY BOOL; PaintBuffer: PUBLIC PROC [viewer: Viewer, context: Graphics.Context, viewerChanged: BOOL]; END.  JunoGraphics.mesa Coded July 1982 by Donna M. Auguste & Greg Nelson Last edited December 7, 1982 3:20 pm Last edited by Stolfi June 6, 1984 3:53:02 am PDT TO FIX: callers: replace SetpaintMode by SetColor[invert]. callers: Blink, ViewerToJuno, JunoToViewer, StartImageViewer, imageViewer have moved to JunoUserEvents. - - - - TYPES - - - - GRAPHICS STATE - - - - CHANGING THE GRAPHIC STATE Resets the painting context to be the screen bitmap (or, rather, an internal bitmap that is periodically copied onto the screen) Also clears the bitmap buffer, and resets all context paramters (font, width, color, etc) to their defaults. Set the painting context to be a brand new context that writes into a PD file. The device must be $Raven, $Puffin, $PlateMaker. The context is clipped to the width and height specified by the last SetPictureSize, magnified by the given factor, and centered on the page. Replaces the internal bitmap buffer by a new one having the specified dimensions. The ink on the old bitmap will be lost. Moves the blinking caret at the given position in the image viewer. The position is in Juno coordinates (big points from lower left corner of picture). If on=TRUE, the caret is turned on (if not yet on). If on=FALSE, the caret is turned off (of not already off) - - - - IMAGE BLANKING Paints the entire picture white. - - - - POINT HIGHLIGHTS (AFFECTS SCREEN IMAGE ONLY) Highlights selected point with given symbol. Symbol is painted with color=XOR, and only if the current context is the screen one. - - - - POINTS Draws p as a small circle of the current color and diameter equal to the current stroke width. - - - - LINES, STROKES, FILLED PATHS These procedures draw a straight lines or bezier arc from p.coords to q.coords. The "Draw" procedures do the drawing immediately. If thin=FALSE, the line is drawn as a stroke (using the current line width and ends type), otherwise it is drawn 1 pixel thick. The "Append" procedures extend a trajectory that can later be drawn as a stroke or filled with color. Fills the trajectory t with the current color. Draws the trajectory t as a stroke, using current stroke width and ends type. Reclaims the trajectory t (currently no-op) - - - - CHARS AND ROPES Draws a character at a specific position. Draws a rope at a specific position. The parameter pos tells where in the rope is the refeerence point; it is one of $left, $center, $right. Returns the x- and y- displacement of the given rope in the current font and device. - - - - VIEWER/JUNO COORDINATE MAPPING Maps from viewer's coordinates (big points from upper left corner of viewer) into Juno coordinates (big points from lower left corner of bitmap buffer). Maps from Juno coordinates (big points from lower left corner of bitmap buffer) into viewer's coordinates (big points from upper left corner of viewer). - - - - BUFFER PAINTING PROC if TRUE, the bits in the bitmap buffer, the buffer size, its position, or the caret position have changed since last call of PaintBuffer. Paints the bitmap buffer in the given context. Ê›˜™™J™1J™$J™3——šœÏbœ™Jšœ3™3Jšœh™hšœÏk ˜ Jš œžœžœžœ$žœžœžœ˜”——Jšœ œž œ˜šœž˜Jšœžœ˜ —šÏnœ ™JšœœžœÏcB˜_Jšœ œžœ 6˜YJšœ œžœ˜&Jšœ œžœ˜%Jšœœžœ˜Jšœœžœ˜&—šŸœ™Jš œœœœžœ˜&Jš4œ œžœ œžœžœ œ œžœžœ +œœžœžœ œœžœžœ œœžœžœ (œœžœžœ ,˜¦Jšœœžœžœ +œžœžœ˜zJšœœžœžœ @œœžœ  .˜£—šŸœ"™#šœŸœžœžœ˜™4J™NJ™n——š œŸœžœžœ žœžœžœ˜T™OJ™1J™——š œŸœžœžœžœ˜6™QJ™(——Jš œŸœžœžœžœ˜;Jš œŸœžœžœ žœžœ˜HJš œŸ œžœžœ žœžœ˜@Jš œŸœžœžœžœžœžœ˜7Jš œŸœžœžœ žœžœžœ˜9Jš œŸ œžœžœžœžœžœ˜;Jš œŸ œžœžœžœžœžœ˜;Jš œŸ œžœžœžœžœžœ˜;Jš œŸœžœžœžœžœžœ˜Iš œŸœžœžœžœžœ˜AJ™˜J™o——šŸœ™šœŸœžœžœ˜J™ ——šŸœ4™5Jšœžœ,˜>šœŸœžœžœ&˜:™,J™T———šŸœ™šœŸ œžœžœ˜(J™_——šŸœ$™%™PJ™Jšœ:žœr™±Jšœg™g—Jš œŸœžœžœžœžœ˜9Jš œŸœžœžœžœžœ˜>Jš œŸ œžœžœžœ˜QJš œŸ œžœžœ%žœ˜VšœŸœžœžœ˜-J™.—šœŸœžœžœ˜/J™M—šœŸ œžœžœ˜+J™+——šŸœ™š œŸœžœžœžœ˜4J™)—š œŸœžœžœžœ˜4™$J™g——š œŸ œžœžœžœžœ˜=J™T——šŸœ&™'šœŸ œžœ#žœ˜RJ™™—šœŸ œžœ"žœ˜OJ™™——šŸœ™šœ œžœžœ˜Jšœ‰™‰—š œÐbn œžœžœ>žœ˜]Jšœ.™.——Jšœžœ˜—…— t!