3 lines
14 KiB
HTML
3 lines
14 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>14-BITMAPS</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="part16.htm">< Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part18.htm">Next ></a></p><h1 style="padding-top: 3pt;padding-left: 35pt;text-indent: 0pt;text-align: left;"><a name="bookmark16">14. BITMAPS</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_093.png"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">A bitmap is a rectangular array of dots. The dots are called "pixels" (for picture</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">elements). Each dot, or pixel, is represented by a single bit. When a pixel or bit is turned on (i.e. that bit set to 1), a black dot is inserted into a bitmap. If you have a bitmap of a floppy on your screen (Figure 14-1), then all of the bits in the area that make up the floppy are turned on, and the surrounding bits are turned off.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 198pt;text-indent: 0pt;text-align: left;"><span><img width="303" height="281" alt="image" src="Image_094.gif"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 237pt;text-indent: 0pt;text-align: left;">Figure 14-1. Bitmap of a Floppy</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-left: 106pt;text-indent: 0pt;text-align: left;">BITMAPCREATE <span class="p">creates a bitmap, even though it can’t be seen.</span></p><p class="s3" style="padding-top: 7pt;padding-left: 142pt;text-indent: 0pt;text-align: left;">(BITMAPCREATE <span class="s4">width height</span>)</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">If the width and height are not supplied, the system will prompt you for them.</p><p class="s3" style="padding-top: 7pt;padding-left: 106pt;text-indent: 0pt;text-align: left;">EDITBM <span class="p">edits the bitmap. The syntax of the function is:</span></p><p class="s3" style="padding-top: 7pt;padding-left: 142pt;text-indent: 0pt;text-align: left;">(EDITBM <span class="s4">bitmapname</span>)</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">Try the following to produce the results in Figure 14-4:</p><p class="s3" style="padding-top: 7pt;padding-left: 143pt;text-indent: 0pt;line-height: 106%;text-align: left;">(SETQ MY.BITMAP (BITMAPCREATE 60 40)) EDITBM MY.BITMAP)</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s10" style="padding-left: 107pt;text-indent: 0pt;text-align: justify;">To dra w <span class="p">In the bitmap, move the mouse into the gridded section of the bitmap editor, and press and hold the leff mouse button. Move the mouse around to turn on the bits</span></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: justify;">represented by the spaces in the grid. Notice that each space in the grid represents one pixel on the bitmap</p><p class="s10" style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: justify;">To erase <span class="p">Move the mouse into the gridded section of the bitmap editor, and press and hold the center mouse button. Move the mouse around to turn off the bits represented by the spaces in the gridded section of the bitmap editor.</span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s10" style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">To w ork on a different section <span class="p">Point with the mouse cursor to the picture of the</span></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">actual bitmap (the upper left corner of the bitmap editor). Press and hold the left mouse button. A menu with the single item, Move will appear. (See Figure 14-2.) Choose this</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">item.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 139pt;text-indent: 0pt;text-align: left;"><span><img width="457" height="360" alt="image" src="Image_095.gif"/></span></p><p style="padding-top: 7pt;padding-left: 211pt;text-indent: 0pt;text-align: left;">Figure 14-2. Menu with Single Item (Move)</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">You will be asked to position a ghost window over the bitmap. This ghost window</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">represents the portion of the bitmap that you are currently editing. Place it over the</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">section of the bitmap that you wish to edit and click the left mouse button (see Figure 14-3).</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 218pt;text-indent: 0pt;text-align: left;"><span><img width="258" height="270" alt="image" src="Image_096.gif"/></span></p><p style="padding-top: 7pt;padding-left: 195pt;text-indent: 0pt;text-align: left;">Figure 14-3. Ghost Window Awaiting Positioning</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s10" style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">To end the session, <span class="p">bring the mouse cursor into the upper-right portion of the window (the grey area) and press the center button. Select OK from the menu to save your</span></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">artwork.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 197pt;text-indent: 0pt;text-align: left;"><span><img width="305" height="271" alt="image" src="Image_097.gif"/></span></p><p style="padding-top: 6pt;padding-left: 241pt;text-indent: 0pt;text-align: left;">Figure 14-4. Editing a Bitmap</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;text-align: left;">BITBLT <span class="p">is the primitive function for moving bits (or pixels) from one bitmap to another.</span></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">It extracts bits from the source bitmap, and combines them in appropriate ways with those of the destination bitmap. The syntax of the function is:</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-left: 143pt;text-indent: 0pt;line-height: 88%;text-align: left;">(BITBLT sourcebitmap sourcelefl sourcebottom destinationbitmap destinationleft destinationbottom width height sourcetype operation texture clippIngregion)</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;">Here’s how it’s done —using <span class="s3">MY.BITMAP </span>as the sourcebitmap and <span class="s3">MY.WlNDOW </span>as the destinationbitmap.</p><p class="s3" style="padding-top: 6pt;padding-left: 143pt;text-indent: 0pt;line-height: 11pt;text-align: left;">(BITBLT MY.BITMAP NIL NIL</p><p class="s3" style="padding-left: 191pt;text-indent: 0pt;line-height: 11pt;text-align: left;">MY.WINDOW NIL NIL NIL NIL ‘INPUT ‘REPLACE)</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">Note that the destination bitmap can be, and usually is, a window. Actually, it is the bitmap of a window, but the system handles that detail for you. Because of the <span class="s3">NIL</span>s</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">(meaning "use the default"), <span class="s3">MY.BITMAP </span>will be <span class="s3">BITBLT</span>’d into the lower right corner of</p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;text-align: left;">MY.WlNDOW <span class="p">(see Figure 14-5).</span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 161pt;text-indent: 0pt;text-align: left;"><span><img width="399" height="427" alt="image" src="Image_098.gif"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 90pt;line-height: 245%;text-align: left;">Figure 14-5. <span class="s3">BITBLT </span>ing a Bitmap onto a Window Here is what each of the <span class="s3">BITBLT </span>arguments to the function mean:</p><p class="s3" style="padding-top: 2pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">sourcebitmap <span class="p">The bitmap to be moved into the destinationbitmap</span></p><p class="s3" style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">sourceleft <span class="p">A number, starting at 0 for the left edge of the</span></p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">sourcebitmap, that tells <span class="s3">BITBLT </span>where to start moving pixels from the sourcebitmap. For example, if the leftmost 10 pixels of sourcebitmap were not to be moved, sourceleft should be 10. The default value is 0.</p><p class="s3" style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">sourcebottom <span class="p">A number, starting at 0 for the bottom edge of the</span></p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">sourcebitmap, that tells <span class="s3">BITBLT </span>where to start moving pixels from the sourcebitmap. For example, if the bottom 10 rows of pixels of sourcebitmap were not to be moved, sourcebottom should be 10 The default value is 0.</p><p class="s3" style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">destinationbitmap <span class="p">The bitmap that will receive the sourcebitmap. This is</span></p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">often a window (actually the bitmap of a window, but Interlisp-D takes care of that for you).</p><p class="s3" style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">destinationleft <span class="p">A number, starting at 0 for the left edge of the</span></p><p style="padding-left: 239pt;text-indent: 0pt;line-height: 107%;text-align: left;">destinationbitmap, that tells <span class="s3">BITBLT </span>where to start placing pixels from the sourcebitmap. For example, to place the</p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">sourcebitmap 10 pixels in from the left, destinationleft should be 10. The default value is 0.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p class="s3" style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">destinationbottom <span class="p">A number, starting at 0 for the bottom edge of the</span></p><p style="padding-left: 239pt;text-indent: 0pt;line-height: 107%;text-align: left;">destinationbitmap, that tells <span class="s3">BITBLT </span>where to start placing pixels from the sourcebitmap. For example, to place the</p><p style="padding-left: 239pt;text-indent: 0pt;line-height: 11pt;text-align: left;">sourcebitmap 10 pixels up from the bottom,</p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">destinationbottom should be 10. The default value is 0.</p><p class="s3" style="padding-top: 7pt;padding-left: 239pt;text-indent: -132pt;line-height: 107%;text-align: left;">width <span class="p">How many pixels in each row of sourcebitmap should be moved. The samc amount of space is used in</span></p><p style="padding-left: 239pt;text-indent: 0pt;line-height: 11pt;text-align: left;">destinationbitmap to receive the sourcebitmap. If this</p><p style="padding-left: 239pt;text-indent: 0pt;line-height: 107%;text-align: left;">argument is <span class="s3">NIL</span>, it defaults to the number of pixels from sourceleft to the end of the row of sourcebitmap.</p><p class="s3" style="padding-top: 6pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">height <span class="p">How many rows of pixels of sourcebitmap should be moved.</span></p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">The same amount of space is used in destinationbitmap to receive the sourcebitmap. If this argument is <span class="s3">NIL</span>, it</p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">defaults to the number of rows from sourcebottom to the top of the sourcebitmap.</p><p class="s3" style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">sourcetype <span class="p">Refers to one of three ways to convert the sourcebitmap for</span></p><p style="padding-left: 239pt;text-indent: 0pt;text-align: left;">writing. For now, just use <span class="s3">’INPUT</span>.</p><p class="s3" style="padding-top: 7pt;padding-left: 239pt;text-indent: -132pt;line-height: 107%;text-align: justify;">operation <span class="p">Refers to how the sourtebitmap gets </span>BITBLT <span class="p">’d on to the destinationbitmap. </span>’REPLACE <span class="p">will </span>BLT <span class="p">the exact</span></p><p style="padding-left: 239pt;text-indent: 0pt;line-height: 107%;text-align: justify;">sourcebitmap. Other operations allow you to <span class="s3">AND</span>, <span class="s3">OR </span>or <span class="s3">XOR </span>the bits from the sourcebitmap onto the bits on the destinationbitmap.</p><p class="s3" style="padding-top: 6pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">texture <span class="p">J ust use </span>NIL <span class="p">for now.</span></p><p class="s3" style="padding-top: 7pt;padding-left: 106pt;text-indent: 0pt;text-align: left;">clippingregion <span class="p">J ust use </span>NIL <span class="p">for now.</span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">For more information on these operations, see Chapter 27 in the <i>IRM</i>.</p><p class="nav"> </p><p class="nav"> </p><p class="nav"><a href="part16.htm">< Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part18.htm">Next ></a></p><p class="nav"> </p></body></html>
|