1
0
mirror of synced 2026-01-17 00:52:40 +00:00
Interlisp.medley/docs/primer/15-DISPLAYSTREAMS.TEDIT
2020-12-13 17:04:48 -07:00

36 lines
58 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1
Medley for the Novice, Release 2.0
1
Medley for the Novice, Release 2.0
15. DISPLAYSTREAMS
1
15. DISPLAYSTREAMS
1
"15"15. DISPLAYSTREAMS
6
A displaystream(DISPLAYSTREAM NIL Displaystream NIL NIL 1) is a generaJized "place to display". They determine exactly what is displayed where. One example of a displaystream is a window. Windows are the only displaystreams that will be used in this chapter. If you want to draw on a bitmap that is not a window, other than with BITBLT, or want to use other types of displaystreams, please refer to Chapter 27 in the IRM.
This chapter explains functions for drawing on displaystreams: DRAWLINE, DRAWTO, DRAWCIRCLE., and FILLCIRCLE. In addition, functions for locating and changIng your curreAt position in the displaystream are covered: DSPXPOSITION, DSPYPOSITION, and MOVETO.
Drawing on a Displaystream
1
The examples belowshow you how the functions for drawing on a display stream work. First, create a window. Windows are displaystreams, and the one you create are used for the examples in this chapter. Type:
(SETQ EXAMPLE.WINDOW (CREATEW))
DRAWLlNE
DRAWLINE(DRAWLINE (Function) NIL NIL NIL 1) draws a line in a displaystream. For example, type:
(DRAWLINE 10 15 100 150 5 'INVERT EXAMPLE.WINDOW)
The results should look like Figure 15-1:
Y™SÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÀ`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿà
Figure 15-1. Line Drawn onto the EXAMPLE.WINDOW Displayrtream
The syntax of DRAWLINE is
(DRAWLINE x1 y1 x2 y2 width operation stream color dashing)
The coordinates of the left bottom corner of the displaystream are 0 0.
xl and yl x and y coordinates of the beginning of the line
x2andy2 ending coordinates of the line
width width of the line, in pixels
operation way the line is to be drawn. INVERT causes the line to invert the bits that are already in the displaystream. Drawing a line the second time using INVERT erases the line. For other operations, see Chapter 27 in the IRM.
stream displaystream. In this case, you used a window.
DRAWTO
DRAWTO(DRAWTO (Function) NIL NIL NIL 2) draws a line that begins at your current position in the displaystream. For example, type:
(DRAWTO 120 135 5 'INVERT EXAMPLE.WINDOW)
The results should look like Figure 15-2:
Y™^
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿðÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿð`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`@0``0`ˆ0`œ0`ž0`ÿ€0`ŸÀ0`‡à0`ø0`>ü0`>~0`|?€0`øÀ0`øà0`ðø0`àü0`à|0`À<0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`>0`>0`|0`ø0`ø0`ð0`à0`à0`À0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿðÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿð
Figure 15-2. Another Line drawn onto the EXAMPLE.WINDOW Displaystream
The syntax of DRAWTO is
(DRAWTO x y width operation stream color dashing)
The line begins at the current position in the displaystream.
x x coordinate of the end of the line
y y coordinate of the end of the line
width width of the line
operation way the lino is to be drawn. INVERT causes the line to invert the bits that aro already in tho displaystream. Drawing a line the second time using INVERT erases the line. For other operations, see Chapter 27 in the IRM
stream displaystreom. In this case. you used a window.
DRAWClRCLE
DRAWCIRCLE(DRAWCIRCLE (Function) NIL NIL NIL 2) draws a circle on a displaystream. To use it, type:
(DRAWCIRCLE 150 100 30 '(VERTICAL 5) NIL EXAMPLE.WINDOW)
Now your window, EXAMPLE.WlNDOW, should look like Figure 15-3:
Y™W?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿø?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿø000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000Ä0Î0Ï0ÿÀ0Ïà0Ãð0<0F>ü0þ0?0>À0|à0|ð0øü0ðþ0ð>0à0À0À0ÿÀ0ÿü0ÿÿ0>ÿÿÿà0|ÿÿÿð0|þ0øþ0ð€ÿ0ðü0àøÀ0Ààà0ÀÀð0ø0|0<0><0|x0|p0øp0ðà0ðÀ0àÀÀ0ÀÀÀ0ÀÀ0À0`0`0>`0|`0| 0ø 0ð 0ð 0à 0À 0À 0`0`0`0>`0|À0|À0øÀÀ0ðÀÀ0ðÀ0àà0Àp0Àp0x0<0<0>|0|ø0|Àð0øàà0ðøÀ0ðü0à€ÿ0Àþ0Àþ0ÿÿÿð0ÿÿÿà0ÿÿ0>ÿü0|ÿÀ0|0ø0ð0ð0à0À0À0000>0|0|0ø0ð0ð0à0À0À0000>0|0|0ø0ð0ð0à0À0À0000>0|0|0ø0ð0ð0à0À0À0000>0|0|0ø0ð0ð0à00000000000000000?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿø?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿø
Figure 15-3. Circle Drawn onto the EXAMPLE.WlNDOW Displaystream
The syntax of DRAWCIRCLE is
(DRAWCIRCLE centerx centery radius brush dashing stream)
centerx x coordinate of the center of the circle
centery coordinate of the center of the circle
radius radius of the circle in pixels
brush list.- The first- item of the list is the shape of the brush. Some of your options include ROUND, SQUARE, and VERTICAL. The second item of that list is the width of the brush in pixels.
dashing list of positive integers. The brush is "on" for the number of units indicated by the first element of the list, "off" for the number of units indicated by the second element of the list. The third element specifies how long it will be on again, and so forth. The sequence is repeated until the circle has been drawn.
stream displaystream. In this case, you used a window.
FlLLClRCLE
FILLCIRCLE(FILLCIRCLE (Function) NIL NIL NIL 3) draws a filled circle on a displaystream. To use it, type:
(FILLCIRCLE 200 150 10 GRAYSHADE EXAMPLE.WINDOW)
EXAMPLE.WlNDOW now looks like Figure 15-4:
Y™TÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÀ`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`Àª€`ÀU@`ÀUP`À
ª¨`À
ª¨`ÀUT`ÀUT`À*ªª`À*ªª`ÀÀUT`ÀUT`À8*ªª`À<*ªª`ÀÿUT`À?€UT`ÀÀ
ª¨`À>ð
ª¨`À|øUP`À|üUP`Àøª `Àð?€ª€`ÀðÀ`Ààð`ÀÀø`ÀÀø`Àx`À8`À`À>ÿ`À|ÿð`À|ÿÿü`Àøÿÿÿ€`ÀðÿÿÿÀ`Àðÿð`Ààÿ€ø`ÀÀþü`ÀÀð~`Àà?`À`ÀÀ`À>>à`À||ð`À|xð`Àøðx`Àðà<`ÀðÀ`ÀàÀ`ÀÀ`ÀÀ`À`À`À`À>`À| `À| `Àø `Àð `Àð`Àà`ÀÀ`ÀÀ`À`À`À`À> `À| `À| `Àø `Àð`Àð`Àà`ÀÀ`ÀÀ`À`ÀÀ`ÀÀ`À>à<`À|ðx`À|xð`Àø|ð`Àð>à`ÀðÀ`Àà`ÀÀà?`ÀÀð~`Àþü`Àÿ€ø`Àÿð`À>ÿÿÿÀ`À|ÿÿÿ€`À|ÿÿü`Àøÿð`Àðÿ`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À>`À|`À|`Àø`Àð`Àð`Àà`ÀÀ`ÀÀ`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`À`ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿà
Figure 15-4. A filled circle drawn onto the displaystream
The syntax of FILLCIRCLE is:
(FILLCIRCLE centerx centery radius texture stream)
centerx x coordinate of the center of the circle
centery y coordinate of the center of the ci rcle
radius radius of the circle in pixels
texture shade that will be used to fill in the circle. Interlisp-D provides you with three shades: WHlTESHADE, BLACKSHADE, and GRAYSHADE. You can also create your own shades. For more information on how to do this, see Chapter 27 in the IRM.
stream displaystream. In this case, you used a window
There are many other functions for drawing on a displaystream. Please refer to Chapter 27 in the IRM.
Text can also be placed into displaystreams. To do this, use printing functions such as PRIN1 and PRIN2, but supply the name of the displaystream as the "file" to print to. To place the text in the proper position in the displaystream, see the section below.
Locating and Changing Your Position in a Displaystream
1
There are functions provided to locate, and to change your current position in a displayitream. This can help you place text, and other images where you want them in a displaystream. This primer will only discuss three of these. There are others, and they can be found in the Chapter 27 of the IRM.
DSPXPOSlTlON
DSPXPOSITION(DSPXPOSITION (Function) NIL NIL NIL 4) is a function that will either change the current x position in a displaystream, or simply report it. To have the function report the current x position in EXAMPLE.WlNDOW, type:
(DSPXPOSITION NIL EXAMPLE.WINDOW)
DSPXPOSITION expects two arguments. The first is the new x position. If this argument is NIL, the current position is not changed, merely reported. The second argument is the displaystream.
DSPYPOSlTlON
DSPYPOSITION(DSPYPOSITION (Function) NIL NIL NIL 5) is an analogous function, but It changes or reports the current y position in a displaystream. As with DSPXPOSlTlON, if the first argument is a number, the current y position will be changed to that position. If it is NIL, the current position is simply reported. To have the function report the current y position in EXAMPLE.WlNDOW, type:
(DSPYPOSITION NIL EXAMPLE.WlNDOW)
MOVETO
The function MOVETO(MOVETO (Function) NIL NIL NIL 5) always changes your position in the displaystream. It expects three arguments:
(MOVETO x y stream)
x new x position in the display stream
y new y position in the display stream
stream display stream. The examples so far have used a window
(LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "15-" "") STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "15-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (TEXT NIL NIL (54 54 504 690) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "15-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "15-" "")) (54 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGV) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE VERSOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "15-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "15-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE RECTOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))))),,llà2llà<00>2HHà<00>2H<00>à<00>,HHà,HHà,HHà
-$$àT-àT-àT,HHà,2àà5àÌàFøø PAGEHEADING VERSOHEADFøø PAGEHEADING RECTOHEADEøø PAGEHEADINGFOOTINGVEøø PAGEHEADINGFOOTINGR, CLASSIC
TITAN
 HELVETICA
CLASSIC HELVETICAMODERN HELVETICACLASSIC
 HELVETICA
MODERN

TIMESROMAN
 HRULE.GETFNMODERN

"  HRULE.GETFNCLASSIC
#   HRULE.GETFNCLASSIC
  HRULE.GETFNCLASSIC

IM.CHAP.GETFN HELVETICA HRULE.GETFNMODERN
  +IM.INDEX.GETFNg?

k   
 HRULE.GETFNCLASSIC Ï  #IM.INDEX.GETFN52*,8 BMOBJ.GETFN3CLASSIC
!  1 H<($(p>8  !IM.INDEX.GETFN\** BMOBJ.GETFN3CLASSIC
)) >''(p>8   
%IM.INDEX.GETFN57   BMOBJ.GETFN3CLASSIC
#

,20'bDG8   
%IM.INDEX.GETFN; 1 BMOBJ.GETFN3CLASSIC
:

%23'd

 e7aXœ 7
 HRULE.GETFNCLASSIC
 &   'IM.INDEX.GETFN<00>" Mb   'IM.INDEX.GETFNh ga"  
!IM.INDEX.GETFNP ((?ÍRXzº