3 lines
17 KiB
HTML
3 lines
17 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>15-DISPLAYSTREAMS</title><link href="navigation.css" rel="stylesheet" type="text/css"/><link href="document.css" rel="stylesheet" type="text/css"/></head><body><p class="top_nav"><a href="part17.htm">< Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part19.htm">Next ></a></p><h1 style="padding-top: 3pt;padding-left: 35pt;text-indent: 0pt;text-align: left;"><a name="bookmark17">15. DISPLAYSTREAMS</a></h1><p style="padding-left: 35pt;text-indent: 0pt;line-height: 6pt;text-align: left;"><span><img width="640" height="8" alt="image" src="Image_099.png"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 15pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">A displaystream is a genera Jized "place to display". They determine exactly what is displayed where. One example of a displaystream is a window. Windows are the only</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">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 <i>IRM</i>.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">This chapter explains functions for drawing on displaystreams: <span class="s3">DRAWLINE </span>, <span class="s3">DRAWTO</span>, <span class="s3">DRAWCIRCLE</span>., and <span class="s3">FILLCIRCLE</span>. In addition, functions for locating and changIng your curreAt position in the displaystream are covered: <span class="s3">DSPXPOSITION </span>, <span class="s3">DSPYPOSITION</span>, and <span class="s3">MOVETO</span>.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h2 style="padding-left: 35pt;text-indent: 0pt;text-align: left;">Drawing on a Displaystream </h2><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">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:</p><p class="s3" style="padding-top: 6pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(SETQ EXAMPLE.WINDOW (CREATEW))</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h4 style="padding-left: 71pt;text-indent: 0pt;text-align: left;">DRAWLlNE</h4><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;text-align: left;">DRAWLINE <span class="p">draws a line in a displaystream. For example, type:</span></p><p class="s3" style="padding-top: 7pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(DRAWLINE 10 15 100 150 5 ’INVERT EXAMPLE.WINDOW)</p><p style="padding-top: 7pt;padding-bottom: 2pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">The results should look like Figure 15-1:</p><p style="padding-left: 168pt;text-indent: 0pt;text-align: left;"><span><img width="316" height="240" alt="image" src="Image_100.gif"/></span></p><p style="padding-top: 5pt;padding-left: 107pt;text-indent: 48pt;line-height: 164%;text-align: left;">Figure 15-1. Line Drawn onto the <span class="s3">EXAMPLE.WINDOW </span>Displayrtream The syntax of <span class="s3">DRAWLINE </span>is</p><p class="s3" style="padding-top: 1pt;text-indent: 0pt;text-align: right;">(DRAWLINE <span class="s4">x1 y1 x2 y2 width operation stream color dashing</span>)</p><p style="padding-top: 7pt;text-indent: 0pt;text-align: right;">The coordinates of the left bottom corner of the displaystream are 0 0.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;line-height: 165%;text-align: left;">xl and yl x and y coordinates of the beginning of the line x2andy2 ending coordinates of the line</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">width width of the line, in pixels</p><p style="padding-top: 7pt;padding-left: 179pt;text-indent: -72pt;line-height: 106%;text-align: left;">operation way the line is to be drawn. <span class="s3">INVERT </span>causes the line to invert the bits that are already in the displaystream. Drawing a line the second time using <span class="s3">INVERT </span>erases the line. For other operations, see Chapter 27 in the <i>IRM.</i></p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">stream displaystream. In this case, you used a window.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h4 style="padding-left: 70pt;text-indent: 0pt;text-align: left;">DRAWTO</h4><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">DRAWTO <span class="p">draws a line that begins at your current position in the displaystream. For example, type:</span></p><p class="s3" style="padding-top: 6pt;padding-left: 142pt;text-indent: 0pt;text-align: left;">(DRAWTO 120 135 5 ’INVERT EXAMPLE.WINDOW)</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">The results should look like Figure 15-2:</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 170pt;text-indent: 0pt;text-align: left;"><span><img width="316" height="240" alt="image" src="Image_101.gif"/></span></p><p style="padding-top: 8pt;padding-left: 107pt;text-indent: 28pt;line-height: 188%;text-align: left;">Figure 15-2. Another Line drawn onto the <span class="s3">EXAMPLE.WINDOW </span>Displaystream The syntax of <span class="s3">DRAWTO </span>is</p><p class="s3" style="padding-left: 143pt;text-indent: 0pt;line-height: 11pt;text-align: left;">(DRAWTO <span class="s4">x y width operation stream color dashing</span>)</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 165%;text-align: left;">The line begins at the current position in the displaystream. x x coordinate of the end of the line</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">y y coordinate of the end of the line</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">width width of the line</p><p style="padding-top: 7pt;padding-left: 179pt;text-indent: -72pt;line-height: 106%;text-align: left;">operation way the lino is to be drawn. <span class="s3">INVERT </span>causes the line to invert the bits that aro already in tho displaystream. Drawing a line the second time using <span class="s3">INVERT </span>erases the line. For other operations, see Chapter 27 in the <i>IRM</i></p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">stream displaystreom. In this case. you used a window.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h4 style="padding-top: 4pt;padding-left: 71pt;text-indent: 0pt;text-align: left;">DRAWClRCLE</h4><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;text-align: left;">DRAWCIRCLE <span class="p">draws a circle on a displaystream. To use it, type:</span></p><p class="s3" style="padding-top: 7pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(DRAWCIRCLE 150 100 30 ’(VERTICAL 5) NIL EXAMPLE.WINDOW<span class="p">)</span></p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">Now your window, <span class="s3">EXAMPLE.WlNDOW</span>, should look like Figure 15-3:</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 192pt;text-indent: 0pt;text-align: left;"><span><img width="316" height="240" alt="image" src="Image_102.gif"/></span></p><p style="padding-top: 10pt;padding-left: 107pt;text-indent: 44pt;line-height: 164%;text-align: left;">Figure 15-3. Circle Drawn onto the <span class="s3">EXAMPLE.WlNDOW </span>Displaystream The syntax of <span class="s3">DRAWCIRCLE </span>is</p><p style="padding-top: 1pt;padding-left: 107pt;text-indent: 36pt;line-height: 164%;text-align: left;">(<span class="s3">DRAWCIRCLE </span><i>centerx centery radius brush dashing stream</i>) centerx x coordinate of the center of the circle</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 165%;text-align: left;">centery coordinate of the center of the circle radius radius of the circle in pixels</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">brush list.- The first- item of the list is the shape of the brush. Some of your</p><p style="padding-left: 179pt;text-indent: 0pt;line-height: 107%;text-align: left;">options include <span class="s3">ROUND</span>, <span class="s3">SQUARE</span>, and <span class="s3">VERTICAL</span>. The second item of that list is the width of the brush in pixels.</p><p style="padding-top: 6pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">dashing list of positive integers. The brush is "on" for the number of units</p><p style="padding-left: 179pt;text-indent: 0pt;text-align: left;">indicated by the first element of the list, "off" for the number of units</p><p style="padding-left: 179pt;text-indent: 0pt;text-align: left;">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.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">stream displaystream. In this case, you used a window.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h4 style="padding-left: 71pt;text-indent: 0pt;text-align: left;">FlLLClRCLE</h4><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;text-align: left;">FILLCIRCLE <span class="p">draws a filled circle on a displaystream. To use it, type:</span></p><p class="s3" style="padding-top: 7pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(FILLCIRCLE 200 150 10 GRAYSHADE EXAMPLE.WINDOW)</p><p class="s3" style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">EXAMPLE.WlNDOW <span class="p">now looks like Figure 15-4:</span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 168pt;text-indent: 0pt;text-align: left;"><span><img width="316" height="240" alt="image" src="Image_103.gif"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 73pt;line-height: 165%;text-align: left;">Figure 15-4. A filled circle drawn onto the displaystream The syntax of <span class="s3">FILLCIRCLE </span>is:</p><p style="padding-left: 107pt;text-indent: 36pt;line-height: 164%;text-align: left;">(<span class="s3">FILLCIRCLE </span><i>centerx centery radius texture stream</i>) centerx x coordinate of the center of the circle</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 165%;text-align: left;">centery y coordinate of the center of the ci rcle radius radius of the circle in pixels</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">texture shade that will be used to fill in the circle. Interlisp-D provides you with</p><p style="padding-left: 179pt;text-indent: 0pt;line-height: 107%;text-align: left;">three shades: <span class="s3">WHlTESHADE </span>, <span class="s3">BLACKSHADE</span>, and <span class="s3">GRAYSHADE</span>. You can also create your own shades. For more information on how to do this, see</p><p style="padding-left: 179pt;text-indent: 0pt;line-height: 11pt;text-align: left;">Chapter 27 in the <i>IRM</i>.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">stream displaystream. In this case, you used a window</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">There are many other functions for drawing on a displaystream. Please refer to Chapter 27 in the <i>IRM</i>.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;line-height: 106%;text-align: left;">Text can also be placed into displaystreams. To do this, use printing functions such as <span class="s3">PRIN1 </span>and <span class="s3">PRIN2</span>, 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.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h2 style="padding-left: 35pt;text-indent: 0pt;text-align: left;">Locating and Changing Your Position in a Displaystream </h2><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">There are functions provided to locate, and to change your current position in a</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">displayitream. This can help you place text, and other images where you want them in</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">a displaystream. This primer will only discuss three of these. There are others, and they can be foun d in the Chapter 27 of the <i>IRM</i>.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h4 style="padding-left: 71pt;text-indent: 0pt;text-align: left;">DSPXPOSlTlON</h4><p class="s3" style="padding-top: 8pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">DSPXPOSITION <span class="p">is a function that will either change the current x position in a</span></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">displaystream, or simply report it. To have the function report the current x position in</p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;text-align: left;">EXAMPLE.WlNDOW<span class="p">, type:</span></p><p class="s3" style="padding-top: 7pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(DSPXPOSITION NIL EXAMPLE.WINDOW)</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">DSPXPOSITION <span class="p">expects two arguments. The first is the new x position. If this argument is </span>NIL<span class="p">, the current position is not changed, merely reported. The second argument is</span></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">the displaystream.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h4 style="padding-left: 71pt;text-indent: 0pt;text-align: left;">DSPYPOSlTlON</h4><p class="s3" style="padding-top: 8pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">DSPYPOSITION <span class="p">is an analogous function, but It changes or reports the current y</span></p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 106%;text-align: left;">position in a displaystream. As with <span class="s3">DSPXPOSlTlON </span>, if the first argument is a number, the current y position will be changed to that position. If it is <span class="s3">NIL</span>, the current position is simply reported. To have the function report the current y position in <span class="s3">EXAMPLE.WlNDOW</span>, type:</p><p class="s3" style="padding-top: 7pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(DSPYPOSITION NIL EXAMPLE.WlNDOW)</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h4 style="padding-left: 71pt;text-indent: 0pt;text-align: left;">MOVETO</h4><p style="padding-top: 8pt;padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">The function <span class="s3">MOVETO </span>always changes your position in the displaystream. It expects three arguments:</p><p style="padding-top: 6pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(<span class="s3">MOVETO </span><i>x y stream</i>)</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">x new x position in the display stream</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">y new y position in the display stream</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">stream display stream. The examples so far have used a window</p><p class="nav"> </p><p class="nav"> </p><p class="nav"><a href="part17.htm">< Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part19.htm">Next ></a></p><p class="nav"> </p></body></html>
|