XEROX DSPSCALE 2 4 1 DSPSCALE 1 4 By: Christopher Lane (Lane@Sumex-Aim.Stanford.Edu) INTRODUCTION DSPScale allows a program to output to different kinds of streams (display, Interpress, etc.) without having to do any scaling corrections. This module provides self-scaling graphics through two different methods: a virtual self-scaling image stream that overlays a regular image stream and/or new versions of the various image stream graphic manipulation functions (DRAWLINE, DSPTOPMARGIN, etc.). Virtual Self-Scaling Image Stream This module implements a virtual image stream type called SCALED which is used to overlay a regular image stream and provide automatic scaling to the natural scale of the image stream or some user selected scaling factor. The function OPENIMAGESTREAM is used to overlay a scaled image stream over a regular one. For example, the following will open a scaled image stream on top of an Interpress image stream: (OPENIMAGESTREAM (OPENIMAGESTREAM 'TEST.IP 'INTERPRESS) 'SCALED) The only difference between the virtual stream and a normal image stream is that the SCALE argument to the DSPSCALE function is active and can be used to change the scale of the stream (multiplying SCALE by the standard scaling factor of the stream). Self-Scaling Graphics Functions As an alternative to the self-scaling image stream, self scaling versions of the various graphics functions are provided. For most of the graphic functions, self-scaling versions have been defined which have an ! (exclamation point) at the end of their name (eg. DRAWLINE vs. DRAWLINE!). The set of self-scaling functions consists of: CENTERPRINTINREGION! DRAWELLIPSE! DSPSCALE! CHARWIDTH! DRAWLINE! RELDRAWTO! CHARWIDTHY! DRAWPOINT! RELMOVETO! CURSORPOSITION! DRAWPOLYGON! SCALEDBITBLT! BITBLT! DRAWTO! STRINGREGION! BITMAPBIT! FILLCIRCLE! STRINGWIDTH! BLTSHADE! FILLPOLYGON! DSPSPACEFACTOR! DSPBACKUP! FONTPROP! DSPTOPMARGIN! DSPBOTTOMMARGIN! GETPOSITION! DSPXOFFSET! DSPCLIPPINGREGION! DSPLEFTMARGIN! DSPXPOSITION! DRAWARC! DSPLINEFEED! DSPYOFFSET! DRAWBETWEEN! MOVETO! DSPYPOSITION! DRAWCIRCLE! MOVETOUPPERLEFT! DRAWCURVE! DSPRIGHTMARGIN! The set includes both output and input functions since the package makes it possible to modify the normal scaling factor of a window (and other output streams) invisible to the program using the functions. Thus, it is necessary when getting, for example, a mouse position in a window, to appropriately unscale the position to put it back into the program's virtual coordinate system. By default, these functions can be used directly in place of their non-! counterparts and they will automatically scale their arguments to the DSPSCALE of the output stream. Some of the above functions are not identical with their non-! counterparts; these differences are explained below: (DSPSCALE! SCALE STREAM) [Function] In this version of DSPSCALE, the SCALE argument is active and will multiply STREAM's normal scaling factor. If you have a program that draws a circle, for example, to a window using the appropriate ! functions, you can cause it to draw a different size circle (or whatever) by using DSPSCALE! to change the scaling factor of the window without touching the source program. (CHARWIDTH! CHARCODE FONT STREAM) [Function] (CHARWIDTHY! CHARCODE FONT STREAM) [Function] (FONTPROP! FONT PROP STREAM) [Function] (STRINGWIDTH! STR FONT FLG RDTBL STREAM) [Function] All of the above functions have one extra argument (as compared to their non-! equivalents) which is the STREAM in question. This is necessary to do the scaling calculations. The package also defines a couple of new stream manipulation functions: (DSPTRANSLATE! Tx Ty STREAM) [Function] or (DSPTRANSLATE! POSITION STREAM) [Function] Defines the amount of X and Y translation (if any) that should be added to graphic operations to STREAM. Simlar to DSPTRANSLATE but works even if the image stream does not have an IMTRANSLATE method. The second form of the arguments is for Koto compatibility and all calls should be updated to the new arguments. (DSPUNITS! UNITS STREAM) [Function] Essentially the inverse of DSPSCALE!, this function lets you set how many UNITS (pixels or what have you) the source program generates for each unit pixel on the output stream (multiplied by the output stream's default scaling). It is possible to use both the virtual image stream and the self-scaling graphics functions as long as the functions are applied to the real stream, not the virtual stream. Interlisp Data Type Scaling Functions The routines below are used by the ! functions and the scaled image stream for scaling numbers, positions, regions and other data types and are useful for defining additional self-scaling functions: (DSPSCALE.BRUSH BRUSH STREAM) [Function] (DSPSCALE.DASHING DASHING STREAM) [Function] (DSPSCALE.POINTS KNOTS STREAM) [Function] (DSPSCALE.REGION REGION STREAM [SmashRegion]) [Function] (DSPSCALE.NUMBER NUMBER STREAM) [Function] (DSPSCALE.POSITION POSITION STREAM [SmashPosition]) [Function] (DSPSCALE.XPOSITION NUMBER STREAM) [Function] (DSPSCALE.YPOSITION NUMBER STREAM) [Function] (DSPSCALE.WIDTH WIDTH STREAM) [Function] (DSPUNSCALE.REGION REGION STREAM [SmashRegion]) [Function] (DSPUNSCALE.POSITION POSITION STREAM [SmashPosition]) [Function] (DSPUNSCALE.NUMBER NUMBER STREAM [OFFSET]) [Function] (DSPUNSCALE.XPOSITION NUMBER STREAM) [Macro] (DSPUNSCALE.YPOSITION NUMBER STREAM) [Macro] (LIST ((PAGE NIL (PAPERSIZE LETTER STARTINGPAGE# 65) (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 NIL) (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 NIL . LETTER) (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 NIL) (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 NIL . LETTER) (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 NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))) .ÈÈ166ÈÌP1ÈÈ(È1ÈÈ(È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEAD TERMINAL MODERN MODERN TERMINAL TERMINAL HELVETICA MODERN MODERN MODERN MODERNMODERN LOGO     HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN   HRULE.GETFNMODERN   HRULE.GETFNMODERN  5 î v "ì Akˆ Ô32,!"+$'#*0"#" aG¤6    & uT Q           M AH   `  »    & –­&#¤                             <zº