XEROX TWODGRAPHICS 2 4 1 TWODGRAPHICS 1 4 By: Jan Pedersen (Pedersen.PA @ Xerox.com) used in conjunction with UNBOXEDOPS TWODGRAPHICS implements viewports. A viewport is a subregion of a window (or image stream) within which graphics is clipped and a linear transformation from a world coordinate system to the window (or image stream) coordinates. A given window (or image stream) may have any number of viewports defined and the viewports may be arbitrarily nested or overlapping. If a window is reshaped the subregions of all currently defined viewports are proportionately reshaped. Viewports will operate in the context of any image stream, (Interpress printers, etc.), although not all DIG (Device independent graphics) primitives are supported. (CREATEVIEWPORT stream streamsubregion source) [Function] Creates a viewport on stream. Stream is the target stream. Streamsubregion is a region in stream coordinates that defines the extent of the viewport. Source may be a REGION in world coordinates, in which case the world to stream linear transformation is set up to map left to left and bottom to bottom, etc., or a VIEWPORT, in which case the new viewport inherits its world to stream transformation. Returns a VIEWPORT (SETWORLDREGION region viewport) [Function] (Re)sets the worldregion of viewport and recomputes the transformation. (SETSTREAMSUBREGION region viewport) [Function] (Re)sets the streamsubregion of viewport and recomputes the transformation. Modified versions of selected DIG primitives are supplied to take advantage of the world to stream transformation. (TWODGRAPHICS.BITBLT source sourceleft sourcebottom destinationviewport destinationleft destinationbottom width height sourcetype operation texture clippingregion) [Function] World coordinates may be used where it makes sense. The destination must be a VIEWPORT. Destination left and bottom default to the viewport's stream subregion left and bottom. The clippingregion argument is always in destinationviewport world coordinates. The source may be a VIEWPORT, a BITMAP, or NIL in the case of texture patterns. In the following, all coordinates must be world coordinates. (TWODGRAPHICS.MOVETO x y viewport) [Function] (TWODGRAPHICS.MOVETOPT position viewport) [Function] Here position is a POSITION in world coordinates (TWODGRAPHICS.RELMOVETO dx dy viewport) [Function] (TWODGRAPHICS.RELMOVETOPT dposition viewport) [Function] (TWODGRAPHICS.DRAWTO x y width operation viewport color dashing) [Function] (TWODGRAPHICS.DRAWTOPT position width operation viewport color dashing) [Function] (TWODGRAPHICS.RELDRAWTO dx dy width operation viewport color dashing) [Function] (TWODGRAPHICS.RELDRAWTOPT dposition width operation viewport color dashing) [Function] (TWODGRAPHICS.DRAWLINE x1 y1 x2 y2 width operation viewport color dashing) [Function] (TWODGRAPHICS.DRAWBETWEEN position1 position2 width operation viewport color dashing) [Function] (TWODGRAPHICS.DSPRESET viewport) [Function] Does a ``DSPRESET©© on the VIEWPORT (TWODGRAPHICS.DSPFILL region texture operation viewport) [Function] region must be in world coordinates The following function is an extension which may be of use to those who wish to produce analytic plots. (TWODGRAPHICS.PLOTAT position glyph viewport operation) [Function] Bitblts glyph to position with operation, with glyph centered at position. Several functions provide access to the world to stream transformations. (WORLDTOSTREAM position viewport oldposition) [Function] Position is in world coordinates. Oldposition is smashed if provided. Returns the corresponding position in stream coordinates. (WORLDREGIONTOSTREAMREGION region viewport) [Function] Region is in world coordinates Returns the corresponding region in stream coordinates (WORLDTOSTREAMX x viewport) [Macro] Returns x in stream coordinates. Uses unboxed floating point arithmetic (WORLDTOSTREAMY y viewport) [Macro] Returns y in stream coordinates Uses unboxed floating point arithmetic. (WORLDXLENGTH dx viewport) [Macro] Returns the length dx in stream coordinates Uses unboxed floating point arithmetic. (WORLDYLENGTH dy viewport) [Macro] Returns the length dy in stream coordinates. Uses unboxed floating point arithmetic. (STREAMTOWORLD position viewport oldposition) [Function] Returns position in world coordinates. (STREAMTOWORLDX x viewport) [Macro] Returns x in world coordinates. Uses unboxed floating point arithmetic. (STREAMTOWORLDY y viewport) [Macro] Returns y in world coordinates. Uses unboxed floating point arithmetic. (STREAMXLENGTH dx viewport) [Macro] Returns dx in world coordinates. Uses unboxed floating point arithmetic. (STREAMYLENGTH dy viewport) [Macro] Returns dy in world coordinates. Uses unboxed floating point arithmetic. For those who desire tighter control over the two-stage process, transform into stream coordinates, and then clip against the viewport, the following functions provide primitive clipping for line drawing and text output in any image stream. (CLIPPED.BITBLT clippingregion source sourceleft sourcebottom destination destinationleft destinationbottom width height sourcetype operation texture) [Function] As in BITBLT, although the operation is clipped against clippingregion in destination stream coordinates. (CLIPPED.DRAWLINE clippingregion x1 y1 x2 y2 width operation stream color dashing) [Function] As in DRAWLINE, although the operation is clipped against clippingregion in stream coordinates. (CLIPPED.DRAWTO clippingregion x y width operation stream color dashing) [Function] As in DRAWTO, although the operation is clipped against clippingregion in stream coordinates. (CLIPPED.DRAWBETWEEN clippingregion pt1 pt2 width operation stream color dashing) [Function] As in DRAWBETWEEN, although the operation is clipped against clippingregion in stream coordinates. (CLIPPED.PLOTAT clippingregion position glyph stream operation) [Function] BITBLT glyph to stream centered at position and clipped against clippingregion. (CLIPPED.PRIN1 clippingregion expr stream) [Function] PRIN1 expr on stream clipped against clippingregion. (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC) STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC) STARTINGPAGE# NIL) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC) STARTINGPAGE# NIL) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL)))))(È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEAD1È ¼È1ø$€MODERN MODERN MODERNLOGOMODERN MODERN GACHA   HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN   HRULE.GETFNMODERN  HRULE.GETFNMODERN ,$ Ùî¥ –ú HLs R=   1 * / , 0 2 Œ  $! $h! KI F: 7  !'   (  ,(  -( '   (   (  !(  !(ñÕ jp `7 ^; c. P 4zº