?? ch14.htm
字號(hào):
<HTML><HEAD><TITLE>developer.com - Reference</TITLE><META NAME="Author" CONTENT="developer.com"><META NAME="Keywords" CONTENT="javascript, ActiveX, VRML, Push, channel,push channel, applet, directory, news, community, developer, internet,intranet, java, java applet, J++, javabeans, java products, tools, javatools, JDK, java development kit, java development environment, JIT,JavaPlan, enterprise tools, JVM, Java Virtual Machine, Java resources, API,browser, java documentation, CDF, Common Desktop Format, RDF, ResourceDescription Framework, Netcaster, Netcast, Castanet, meta-language, metadata,solaris, Solaris, SUN, CGI, Perl, Oracle, database, network, Netscape API,Apache, apache, SSL, mSQL, Netscape, Fasttrack, FastTrack,industry standard, ActiveX bridge, web, internet, site, sitedesign, microsoft, active server pages, asp, iis, nt, win95, 95, html, cgi,frontpage, business, corporate, vbscript, javascript, activex, isapi,database, access, sql, server, www, 3.0, 3.01, 3.02, 3.03, 3.04, 4.0,4.0b2, 4.01, 4.03, 4.04, connection, online, commerce, publisher,publishing, publish, webmaster, dynamic html, dhtml, windows 98, netscape,netscape software, shareware, magazines, jobs, japan, free, freeware, freestuff"><META NAME="description" CONTENT="Developer.com is the leading onlineservice for developers. It includes Gamelan, the official directory for Java, as wellas news, information, tutorials, and directories for other Internet technologiesincluding ActiveX, JavaScript, perl, VRML, Java Beans, push technologies, andother Internet and intranet technologies. Developer.com is also the home ofDeveloper Direct, the Professional Developer's Store, where developers canpurchase and download thousands of Web, authoring and other developmentproducts at some of today's lowest prices."><META NAME="distribution" CONTENT="global"><META NAME="resource-type" CONTENT="document"><META NAME="language" CONTENT="en"></HEAD><BODY BACKGROUND="/images/curve_r-wide.gif" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#DD0000" VLINK="#999999" ALINK="#FF0000"><TABLE><TR><TD VALIGN=TOP WIDTH=120><A HREF="/" ><IMG SRC="/images/masthead_r.gif" WIDTH="100" HEIGHT="78" BORDER="0"ALT="Developer.com Logo"></a></TD><TD><a target="resource window" href="http://adserver.developer.com/cgi-bin/accipiter/adclick.exe/AREA=DCBAN.REF/DT=null"><img src="http://adserver.developer.com/cgi-bin/accipiter/adserver.exe/AREA=DCBAN.REF/DT=null" HEIGHT="60" WIDTH="468" ALT="Click here to support our advertisers"><BR><CENTER>Click here to support our advertisers</CENTER></a></TD></TR></TABLE><!--outer table--><TABLE><!--outer table--><TR><!--outer table--><TD VALIGN="TOP"><!--navbar info --><table><tr><td><A HREF="http://www.developerdirect.com/" ><IMG SRC="/images/button_s.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>SHOPPING</b></font></a></td></tr><tr><td><A HREF="/community/jobs/c_jobs.html"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>JOB BANK</B></font></a></td></tr><tr><td><A HREF="http://www.classifieds2000.com/cgi-cls/display.exe?Developer+computer+searchcomputercategories"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>CLASSIFIEDS</B></font></a></td></tr><tr><td><A HREF="/directories/directories.html"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>DIRECTORIES</B></font></a></td></tr><tr><td><A HREF="/reference/"><IMG SRC="/images/button_r.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>REFERENCE</B></font></a><br><a href="/reference/r_library.html"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000">Online Library</a></font></td></tr><tr><td><A HREF="/classroom/"><IMG SRC="/images/button_r.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>LEARNING CENTER</B></font></a></td></tr><tr><td><A HREF="/journal/"><IMG SRC="/images/button_n.gif" width="15" height="11" BORDER="0"><B><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000">JOURNAL</font></B></a></td></tr><tr><td><A HREF="/news/"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>NEWS CENTRAL</b></font></a></td></tr><tr><td><A HREF="/downloads/"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>DOWNLOADS</b></font></a></td></tr><tr><td><A HREF="/community/" ><IMG SRC="/images/button_c.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>COMMUNITY</B></font></a></td></tr><tr><td><A HREF="/calendar/"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>CALENDAR</b></font></a></td></tr><tr><td><A HREF="/about/"><IMG SRC="/images/button_a.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>ABOUT US</b></a></font></td></tr></table><table><tr><td><form action="/subscribe/list.cgi" method=post ><img src="/images/rule.gif" width="100" height="2"><br><B><FONT FACE="Arial, Helvetica" SIZE="-1">Journal:</b></font><br><input name='email' value='your e-mail' size="11"><input type='hidden' name='state' value='Subscribe'></td></tr><tr><td><input type='submit' value='Subscribe'><br><font size="-1">Get the weekly email highlights from the most popular journal for developers!<br><a href="http://www.developer.com/subscribe.html">Current issue</a><img src="/images/rule.gif" width="100" height="2"><input type='hidden' name='name' value='New Subscriber'></FORM></td></tr></table><!--/navbar--><font size="-1"><A HREF="http://www.developer.com">developer.com</a><BR><A HREF="http://www.developerdirect.com">developerdirect.com</a><BR><A HREF="http://www.htmlgoodies.com">htmlgoodies.com</a><BR><A HREF="http://www.javagoodies.com">javagoodies.com</a><br><A HREF="http://www.jars.com">jars.com</a><BR><a href="http://www.intranetjournal.com">intranetjournal.com</a><br><a href="http://www.javascripts.com">javascripts.com</a><br></font><!--outer table--></TD><!--outer table--><TD VALIGN="TOP"><BLOCKQUOTE><P><img src="/images/header_r.gif" width="440" height="50"><P><MAP NAME ="header_r2.gif.map"><AREA SHAPE ="RECT" HREF ="/reference/author.html" COORDS ="361,0,440,29"><AREA SHAPE ="RECT" HREF ="/reference/basic.html" COORDS ="254,0,360,29"><AREA SHAPE ="RECT" HREF ="/reference/help.html" COORDS ="183,0,251,29"><AREA SHAPE ="RECT" HREF ="/reference/cool.html" COORDS ="100,0,181,29"><AREA SHAPE ="RECT" HREF ="/reference/mybook.html" COORDS ="0,0,100,29"></MAP><MAP NAME ="header_r1.gif.map"><AREA SHAPE ="RECT" HREF ="/reference/personalize.html" COORDS ="339,0,439,29"></MAP><p><font face="Arial,Helvetica" size="-1" color="#006666"><A HREF="/reference/r_library.html"><B>All Categories</A> :</B><b><A HREF="/reference/r_java.html">Java</A></b></font><p> <META NAME="GENERATOR" CONTENT="Mozilla/3.0b5aGold (WinNT; I) [Netscape]"><H1><FONT COLOR=#FF0000>Chapter 14</FONT></H1><H1><B><FONT SIZE=5 COLOR=#FF0000>Advanced Image Processing</FONT></B></H1><P><HR WIDTH="100%"></P><P><H3 ALIGN=CENTER><FONT COLOR="#000000"><FONT SIZE=+2>CONTENTS<A NAME="CONTENTS"></A></FONT></FONT></H3><UL><LI><A HREF="#ChapterProject" >Chapter Project</A><LI><A HREF="#ClassOrganization" >Class Organization</A><LI><A HREF="#HowItWorks" >How It Works</A><LI><A HREF="#FractalsandtheMandelbrotSet" >Fractals and the Mandelbrot Set</A><LI><A HREF="#UsingtheApplets" >Using the Applets</A><LI><A HREF="#TheMandelbrotClass" >The Mandelbrot Class</A><LI><A HREF="#CalculateFilterNotifyInterface" >CalculateFilterNotify Interface</A><LI><A HREF="#CalculatorProducerInterface" >CalculatorProducer Interface</A><LI><A HREF="#TheCalculatorFilterClass" >The CalculatorFilter Class</A><LI><A HREF="#TheCalculatorImageClass" >The CalculatorImage Class</A><LI><A HREF="#TheMandelAppClass" >The MandelApp Class</A><LI><A HREF="#TheMandelZoomAppClass" >The MandelZoomApp Class</A><LI><A HREF="#TheBmpImageClass" >The BmpImage Class</A><UL><LI><A HREF="#AutomaticDocumentationwithjavadoc" >Automatic Documentation with javadoc</A></UL><LI><A HREF="#Summary" >Summary</A></UL><HR><P>This chapter's project, one that views the Mandelbrot set, givesyou examples of some of the more advanced concepts you have beenintroduced to. The Mandelbrot set is the most spectacular exampleof fractals, which represents one of the hot scientific topicsof recent years. With the applets in this chapter, you can viewor generate an original Mandelbrot image and zoom in and out ofit to produce new portions of the set.<P>Since the Mandelbrot set can take a while to generate-requiringmillions of calculations-it gives you a chance to combine threadsand image filters so you can view the set as it's being generated.You might also want to save the Mandelbrot images. The BmpClass,introduced in Part III, that converts a BMP formatted file intoa Java image, is enhanced so you can save the Mandelbrot dataas a BMP file. You can then view or modify it with any tool thatcan handle the BMP format. Finally, the chapter concludes by showinghow you can auto-document the source of a Java class into a HTMLfile. This can be viewed by a browser and has links to other classes.<P>Since you have already been introduced to most aspects of Java,this chapter will jump straight into the project. Topics willbe introduced as appropriate.<H2><A NAME="ChapterProject"><FONT SIZE=5 COLOR=#FF0000>ChapterProject</FONT></A></H2><P>There are actually two applets in this chapter. The first applet,MandelApp, is used to generate a full Mandelbrot set. The toolsand BMP file produced by this applet are input into the secondapplet, called MandelZoomApp. This applet displays a Mandelbrotset, then allows you to zoom (magnify) portions of the set soyou can inspect its fractal qualities. You can also return toprevious images and zoom into another area.<P>If you want to use the file-saving capabilities of this program,you need to run it from something that does not prevent file saving,such as the appletviewer program. You can run the program in abrowser like Netscape, though; it will be able to do everythingexcept save the images as files.<H2><A NAME="ClassOrganization"><FONT SIZE=5 COLOR=#FF0000>ClassOrganization</FONT></A></H2><P>Table 14.1 lists the classes used in this chapter's applets. Mostof the classes are new, so their names are set in boldface type.Existing classes that were modified have their names italicized.<BR><P><CENTER><B>Table 14.1. Mandelbrot project classes and interfaces.</B></CENTER><P><CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%><TR VALIGN=TOP><TD WIDTH=169><I>Class/Interface</I></TD><TD WIDTH=421><I>Description</I></TD></TR><TR VALIGN=TOP><TD WIDTH=169>BmpImage</TD><TD WIDTH=421>For BMP-Image conversion.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>CalculatorFilter</B></TD><TD WIDTH=421>ImageFilter that produces updates of images as they are generated.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>CalculatorFilterNotify</B></TD><TD WIDTH=421>Interface that defines ways an ImageFilter can receive data updates.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>CalculatorImage</B></TD><TD WIDTH=421>Used to tie a calculation object, an image, and a CalculatorFilter together.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>CalculatorProducer</B></TD><TD WIDTH=421>Interface that defines a mechanism for establishing how an ImageFilter can update a calculation class.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>MandelApp</B></TD><TD WIDTH=421>An Applet that produces a full Mandelbrot image and lets you save it to a file.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>MandelEntry</B></TD><TD WIDTH=421>Accessor class for keeping information about a Mandelbrot image.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>Mandelbrot</B></TD><TD WIDTH=421>A Thread that produces Mandelbrot data for the specified parameters. It implements CalculatorProducer to get started by a filter. It uses CalculatorFilterNotify to update a filter with new data.</TD></TR><TR VALIGN=TOP><TD WIDTH=169><B>MandelZoomApp</B></TD><TD WIDTH=421>An Applet that displays the full Mandelbrot set and allows you to zoom in and out of the set.</TD></TR></TABLE></CENTER><H2><A NAME="HowItWorks"><FONT SIZE=5 COLOR=#FF0000>How It Works</FONT></A></H2><P>Because the Mandelbrot set can take quite a while to generate,it was designed by combining a calculation thread with an image
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -