⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch69.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 3 页
字号:
-rwxr-xr-x   1 root     root         4136 Oct 21  1996 ppmtoilbm



-rwxr-xr-x   1 root     root         4116 Oct 21  1996 ppmtopcx



-rwxr-xr-x   1 root     root         4740 Oct 21  1996 ppmtopgm



-rwxr-xr-x   1 root     root         2444 Oct 21  1996 ppmtopi1



-rwxr-xr-x   1 root     root         3680 Oct 21  1996 ppmtopict



-rwxr-xr-x   1 root     root         3652 Oct 21  1996 ppmtopj



-rwxr-xr-x   1 root     root         2228 Oct 21  1996 ppmtopuzz



-rwxr-xr-x   1 root     root         1956 Oct 21  1996 ppmtorgb3



-rwxr-xr-x   1 root     root         2964 Oct 21  1996 ppmtosixel



-rwxr-xr-x   1 root     root         6312 Oct 21  1996 ppmtotga



-rwxr-xr-x   1 root     root         3644 Oct 21  1996 ppmtouil



-rwxr-xr-x   1 root     root         3160 Oct 21  1996 ppmtoxpm



-rwxr-xr-x   1 root     root         2148 Oct 21  1996 ppmtoyuv



-rwxr-xr-x   1 root     root         2276 Oct 21  1996 psidtopgm



-rwxr-xr-x   1 root     root         2004 Oct 21  1996 qrttoppm



-rwxr-xr-x   1 root     root         3484 Oct 21  1996 rasttopnm



-rwxr-xr-x   1 root     root         2244 Oct 21  1996 rawtopgm



-rwxr-xr-x   1 root     root         3764 Oct 21  1996 rawtoppm



-rwxr-xr-x   1 root     root         2132 Oct 21  1996 rgb3toppm



-rwxr-xr-x   1 root     root         7836 Oct 21  1996 sldtoppm



-rwxr-xr-x   1 root     root         2636 Oct 21  1996 spctoppm



-rwxr-xr-x   1 root     root         2052 Oct 21  1996 sputoppm



-rwxr-xr-x   1 root     root         4776 Oct 21  1996 tgatoppm



-rwxr-xr-x   1 root     root         3492 Oct 21  1996 xbmtopbm



-rwxr-xr-x   1 root     root         4588 Oct 21  1996 ximtoppm



-rwxr-xr-x   1 root     root         4084 Oct 21  1996 xpmtoppm



-rwxr-xr-x   1 root     root         6684 Oct 21  1996 xwdtopnm



-rwxr-xr-x   1 root     root         2120 Oct 21  1996 ybmtopbm



-rwxr-xr-x   1 root     root         2220 Oct 21  1996 yuvtoppm



</FONT></PRE>



<P>Four types of base formats are supported in the pbm toolkit:







<UL>



	<LI>PBM for 1 bits per pixel



	<P>



	<LI>PGM for grayscale images



	<P>



	<LI>PPM for full-color images



	<P>



	<LI>PNM for device-independent images



</UL>







<P>You usually convert from a format to either PPM or PNM. Programs that work with



PPM files can write only PPM files. Programs that process PNM files can write PBM,



PPM, or PGM files.</P>



<P>This powerful toolkit is surprisingly easy to use. Let's say you want to convert



a GIF image into a PCX image. This is the command you would use on the file <TT>myfile.gif</TT>



to get <TT>myfile.pcx</TT>:</P>



<PRE><FONT COLOR="#0066FF">$ giftoppm &lt; myfile.gif | ppmtopcx &gt; myfile.pcx



</FONT></PRE>



<P>The <TT>pnm*</TT> functions let you manipulate the contents of images. You can



rotate or scale an image with these functions. For example, to scale the original



GIF image down by a factor of two, you would use the following command:</P>



<PRE><FONT COLOR="#0066FF">$ giftoppm &lt; myfile.gif | pnmscale 3 | ppmtopcx &gt; myfile.pcx



</FONT></PRE>



<P>Particularly interesting is the pbmtext program, which converts text files into



PPM files. You can therefore take text lines and convert them into images for use



in World Wide Web server applications for generating non-editable messages using



a fixed font. This would be a typical usage of pbmtext:</P>



<PRE><FONT COLOR="#0066FF">$ pbmtext  &lt; /etc/motd | pnmscale 4 |  ppmtogif &gt; motd.gif



</FONT></PRE>



<P>The scale factor would have to be adjusted to fit the particular GIF image size



you want. To get rotated text at a 45-degree angle (0 degrees is a horizontal line



going from left to right), try the following command:</P>



<PRE><FONT COLOR="#0066FF">$ pbmtext  &lt; /etc/motd | pnmrotate 45 |  ppmtogif &gt; motd.gif



</FONT></PRE>



<P>The angle parameter should be between -90 and 90 degrees. For angles greater than



that, try flipping the image with pnmflip to get that extra 180-degree rotation.</P>



<P>The best use for the pbm toolkit is from within shell scripts where you do not



want to have any user interaction, especially if you are doing only basic scalar



operations on images or converting data from one graphical format to another.</P>



<P>Of course, the major thing lacking with the pbm toolkit is the capability to graphically



show the data. Let's see how to display the data we create with the pbm toolkit by



using the xv toolkit.



<H3 ALIGN="CENTER"><A NAME="Heading6<FONT COLOR="#000077">xv</FONT></H3>



<P>The xv program in Linux is written by John Bradley. The version number of the



program on the CD-ROM is 3.10 and is dated 12/16/94. To see an image, issue the following



command:</P>



<PRE><FONT COLOR="#0066FF">$ xv filename &amp;



</FONT></PRE>



<P>It's a good idea to run xv in the background to free up the terminal on which



you are working. For example, to see the <TT>motd.gif</TT> image we just created



with the pbm toolkit, we would issue this command:</P>



<PRE><FONT COLOR="#0066FF">$ xv motd.gif &amp;



</FONT></PRE>



<P>You can bring up the main menu for the screen by clicking the right mouse button



anywhere on the display window. You are presented with the menu shown in Figure 69.1.<BR>



<BR>



<A NAME="Heading7<A HREF="../art/69/69lnx02.jpg"><FONT COLOR="#000077">FIGURE



69.1.</FONT></A><FONT COLOR="#000077"> </FONT><I>The xv main menu screen. <BR>



</I><BR>



The menu lets you load and save graphics files in several formats, and load and save



programs in different formats. Several files can be loaded at one time, but only



one can be viewed at a time. Using this graphical program is helpful if you want



to work within an interactive environment.</P>



<P>Several filtering algorithms are available. You can rotate images at an angle,



as shown in Fig-ure 69.2. An image can also be embossed, as shown in Figure 69.3.



An embossed image can be a bit hard to read at times, so you might want to edit the



colors with the color editor in the 24/8 Bit menu option. Embossing looks better



for graphical images, as shown in Figure 69.4, than for text.



<H6></H6>



<P><A NAME="Heading8<A HREF="../art/69/69lnx03.jpg"><FONT COLOR="#000077">FIGURE



69.2.</FONT></A><FONT COLOR="#000077"> </FONT><I>An image rotated at a 12-degree



angle.</I>



<H6></H6>



<P><A NAME="Heading9<A HREF="../art/69/69lnx04.jpg"><FONT COLOR="#000077">FIGURE



69.3.</FONT></A><FONT COLOR="#000077"> </FONT><I>An embossed image with text.</I>



<H6></H6>



<P><A NAME="Heading10<A HREF="../art/69/69lnx05.jpg"><FONT COLOR="#000077">FIGURE



69.4.</FONT></A><FONT COLOR="#000077"> </FONT><I>An embossed image without text.



<BR>



</I><BR>



The xv program provides you with the power of the pbm toolkit and the capability



to show the results right away. It is an interactive program, however, and if you



want to do something within a shell script, you would want to do it with the pbm



toolkit. It's an excellent package for manipulating 2D images.



<H3 ALIGN="CENTER"><A NAME="Heading11<FONT COLOR="#000077">Geomview</FONT></H3>



<P>The Geomview toolkit is another freeware tool that works great for displaying



3D images. You can get the software for Linux from the Web site at</P>



<PRE><FONT COLOR="#0066FF">http://www.geom.umn.edu/software/download/geomview.html



</FONT></PRE>



<P>Geomview is available in source form or in binary form for Linux. (Unless you



are the adventurous kind or are impatient, get the binary form. The source files



took forever to build on my Linux box, and I wished I had downloaded the ELF binary



image instead.) The Web site is from University of Minnesota's Geometry Center, where



Geomview was developed.</P>



<P>You need to be aware of certain requirements for visualizing 3D images on Linux



machines:







<UL>



	<LI>You should get a fast machine with 32MB of RAM and a 486 at the very least. A



	386 running with 16MB of RAM might cause you to fall asleep at the keyboard.



	<P>



	<LI>Rendered images look better on at least an 800x600 screen.



</UL>











<DL>



	<DD>If you attempt to view Geomview images on a 640x480 screen, you really will not



	be able to appreciate the power of this toolkit.



</DL>











<UL>



	<P>



	<LI>This will work best with a three-button mouse. For example, in some options,



	the left mouse button is used for lateral movements, the middle button for perpendicular



	movements of the view angle, and the right button for other object selections. With



	a two-button mouse, you have to simulate the middle button by pressing both the left



	and the right buttons at the same time.



</UL>







<P>After you untar the file, change to the Geomview directory that tar creates for



you. Then you can issue the following command in bash to set the environment variable



<TT>GEOMVIEW</TT> to this current directory:</P>



<PRE><FONT COLOR="#0066FF">$ GEOMVIEW=`pwd`; export GEOMVIEW



</FONT></PRE>



<P>The <TT>INSTALL</TT> file provides more details about how and where to store the



executable if the current directory is not suitable for you. If you want to make



Geomview available to you all the time, be sure to set <TT>GEOMVIEW</TT> in your



<TT>.profile</TT> file. Then make sure that Geomview is in the <TT>PATH</TT>, and



enter the following command at the prompt:</P>



<PRE><FONT COLOR="#0066FF">$ geomview



</FONT></PRE>



<P>When you start Geomview, you are presented with the main screen, as shown in Figure



69.5. Use the File menu to go to the <TT>./data/geom</TT> directory, and open a file



with the <TT>oogl</TT> extension. (See Figure 69.6.) These files are good demo files



to work with. You can load more than one file at a time.<BR>



<BR>



<A NAME="Heading12<A HREF="../art/69/69lnx06.jpg"><FONT COLOR="#000077">FIGURE



69.5.</FONT></A><FONT COLOR="#000077"> </FONT><I>The main menu for Geomview.</I>







<DL>



	<DT></DT>



</DL>







<H6></H6>



<P><A NAME="Heading13<A HREF="../art/69/69lnx07.jpg"><FONT COLOR="#000077">FIGURE



69.6.</FONT></A><FONT COLOR="#000077"> </FONT><I>The object selection menu for Geomview.</I>







<DL>



	<DD>



<HR>



<A NAME="Heading14<FONT COLOR="#000077"><B>TIP:</B> </FONT>You can find several



	other great 3D imaging tools for many operating systems and workstations at <TT>http://www.geom.umn.edu</TT>.



	Check them out while you are there. 



<HR>







</DL>







<P>The Geomview software is great for visualizing 3D images, and it includes the



option to do &quot;fly-bys&quot; on images. You can literally walk around a 3D object



you have created and can even &quot;step into&quot; it. Several tools are available



with the buttons in the Tools menu, shown in Fig- ure 69.7. The buttons in the menu



enable you to rotate and translate objects with the mouse button. Press the left



mouse button and move the image by holding down the button and moving the mouse.



The movement is based on the inertia of the object. Releasing the mouse does not



stop the object from rotating! This is a bit hard to master at first because the



speed of motion is somehow proportional to the speed your mouse is moving when the



button is released. To get static movement, you must stop the mouse movement before



you release the mouse button.



<H6></H6>



<P><A NAME="Heading15<A HREF="../art/69/69lnx08.jpg"><FONT COLOR="#000077">FIGURE



69.7.</FONT></A><FONT COLOR="#000077"> </FONT><I>The Tools menu for Geomview. </I><BR>



<BR>



The speed of the mouse is also a factor when you select the &quot;fly&quot; option.



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -