亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch14.htm

?? JAVA Developing Professional JavaApplets
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
filter so you can see the results as they are generated. However,understanding how the classes interrelate is a little tricky.Figure 14.1 shows the workflow involved in producing a Mandelbrotimage. Understanding this flow is the key to understanding thisproject.<P><A HREF="f14-1.gif" ><B>Figure 14.1 : </B><I>Workflow of producing a Mandelbrot image.</I></A><P>The process begins when an applet displaying Mandelbrot sets constructsa Mandelbrot object. (In this project, the two Applet classesare MandelApp and MandelZoomApp.) The Mandelbrot object, in turn,creates an instance of the CalculatorImage class. The Mandelbrotset passes itself as a part of the CalculatorImage constructor.It is referenced as a CalculatorProducer object, an interfacethat the Mandelbrot class implements. This interface implementationwill be used to communicate with the image filter.<P>In the next step, the applet requests a Mandelbrot image. Thisis initiated by calling the <TT>getImage()</TT>method of the Mandelbrot object, which in turn leads to a callto a like-named method of the CalculatorImage object. At thispoint, the CalculatorImage object first creates a color paletteby using an instance of the ImageColorModel class, then createsa MemoryImageSource object. This object, which implements ImageProducer,produces an image initialized to all zeros (black); it's combinedwith an instance of the CalculatorFilter class to produce a FilteredImageSource.<P>When the MemoryImageSource object produces its empty image, itis passed to the CalculatorFilter, which takes the opportunityto produce the calculated image. It does this by kicking off thethread of the image to be calculated. The CalculatorFilter doesn'tknow that it is the Mandelbrot set that's calculated-it just knowsthat some calculation needs to occur in the CalculatorProducerobject in which it has a reference.<P>Once the Mandelbrot thread is started, it begins the long calculationsto produce a Mandelbrot set. Whenever it finishes a section ofthe set, it notifies the filter with new data through the CalculatorFilterNotifyinterface. The filter, in turn, lets the viewing applet know thatit has new data to display by updating the corresponding ImageConsumer,which causes the applet's <TT>imageUpdate()</TT>method to be called. This causes a repaint, and the new imagedata to be displayed. This process repeats until the full imageis created.<P>As you have probably observed, this is a complicated process.Although the mechanics of image processing were introduced inPart III, it doesn't hurt to have another example. The Calculatorclasses here are meant to provide a generic approach toward manipulatingimages that need long calculations. You can replace the Mandelbrotclass with some other calculation thread that implements CalculatorProducer,and everything should work. A good exercise would be to replaceMandelbrot with another fractal calculation or some other scientificimaging calculation (I found that replacing Mandelbrot with aJulia fractal class calculation was very easy).<H2><A NAME="FractalsandtheMandelbrotSet"><FONT SIZE=5 COLOR=#FF0000>Fractalsand the Mandelbrot Set</FONT></A></H2><P>Before going into the internals of the classes that make up thisproject, it's worth spending a couple of moments to understandwhat's behind the images produced by the Mandelbrot class.<P>In the 1970s, Benoit Mandelbrot at IBM was using computers tostudy curves generated by iterations of complex formulas. He foundthat these curves had unusual characteristics, one of which iscalled <I>self-similarity</I>. The curves have a series of patternsthat repeat themselves when inspected more closely.<P>One of the characteristics of the curves Mandelbrot studied wasthat they could be described as having a certain dimensional qualitythat Mandelbrot termed &quot;fractal.&quot; One of the fractalsthat Mandelbrot was investigating is called a <I>Julia set</I>.By mapping the set in a certain way, Mandelbrot came across aset that turned out to include all the Julia sets-a kind of amaster set that was deemed the <I>Mandelbrot set</I>. This sethas several spectacular features, all of them beautiful. The moststriking of these is its self-similarity and a extraordinary sensitivityto initial conditions. As you explore the Mandelbrot set, youwill be amazed by both its seeming chaos and exquisite order.<P>Figure 14.2 shows the famous Mandelbrot set, produced by thischapter's MandelApp applet. The figures in this chapter show thekind of images that appear when you zoom into various places inthis set. The Mandelbrot set is based on a seemingly simple iteratedfunction, shown in Formula 14.1.<P><A HREF="f14-2.gif" ><B>Figure 14.2 : </B><I>The full Mandelbrot set image.</I></A><HR><BLOCKQUOTE><B>Formula 14.1. Formula for calculating the Mandelbrot set.<BR></B></BLOCKQUOTE><BLOCKQUOTE><TT>z</FONT><FONT SIZE=1 FACE="Courier">n+1</FONT>=z</FONT><FONT SIZE=1 FACE="Courier">n2</FONT>+ c</TT></BLOCKQUOTE><HR><P>In Formula 14.1, <TT>z</TT> and <TT>c</TT>are complex numbers. The Mandelbrot set is concerned with whathappens when <TT>z0</TT> is zero and<TT>c</TT> is set over a range ofvalues. The real part of <TT>c</TT>is set to the x-axis, and the complex portion corresponds to they-axis. A color is mapped to each point based on how quickly thecorresponding value of <TT>c</TT>causes the iteration to reach infinity. The process of &quot;zooming&quot;in and out of the Mandelbrot set is equivalent to defining whatranges of <TT>c</TT> are going tobe explored. It is amazing that something so simple can yieldpatterns so sophisticated!<BR><P><CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%><TR VALIGN=TOP><TD><B>Note</B></TD></TR><TR VALIGN=TOP><TD><BLOCKQUOTE>If you are more interested in chaos and fractals, there are a lot of places to turn. <I>Chaos</I> by James Gleick (Penguin, 1987) is a layman's introduction to the ideas and discoveries that gave rise to chaos theory and the study of fractals. Mandelbrot's<I> The Fractal Geometry of Nature</I> (W.H. Freeman, 1983) lays out his ideas on fractals and nature. For a rigorous mathematical treatment of fractals, see the beautiful book <I>Fractals Everywhere</I> (Academic Press, 1988), written by one of the foremost figures in fractals, Michael Barnsley. Among other things, Barnsley is a major innovator on how to use fractal geometrics to achieve high rates of data compression. For a no-nonsense approach to writing programs that display fractals, see <I>Fractal Programming in C</I> by Roger T. Stevens (M&amp;T Books, 1989). The algorithms for the Mandelbrot set were developed from this book. The C programs in this book map very easily to Java-except for the underlying graphics tools, which were developed for MS-DOS. However, the image calculation classes created in this chapter aim to fill this gap. With Stevens's book and these classes, you should be able to move his C code right over to Java and begin exploring the amazing world of fractals!</BLOCKQUOTE></TD></TR></TABLE></CENTER><P><H2><A NAME="UsingtheApplets"><FONT SIZE=5 COLOR=#FF0000>Usingthe Applets</FONT></A></H2><P>There are two applets in this chapter. The first applet, MandelApp,generates the full Mandelbrot set. This will take a little while,depending on your computer; for example, on a 486DX2-50 PC, ittakes a couple of minutes. When the image is complete, indicatedby a message on the browser's status bar, you can save the imageto a BMP formatted file by clicking anywhere on the applet's displayarea. The file will be called mandel.bmp. Remember to run thisapplet from a program, such as appletviewer, that lets appletswrite to disk.<P>The other applet, MandelAppZoom, is more full-featured. It beginsby loading the Mandelbrot bitmap specified by an HTML applet parametertag. The default <TT>mandel1</TT>corresponds to a BMP file and a data file that specifies x-y parametervalues-included on this book's CD-ROM.<P>Once the image is up, you can pick regions to zoom in on by clickingon a point in the image, then dragging the mouse to the endpointof the region you want to display. Enter <TT>z</TT>or <TT>Z</TT> on the keyboard, andthe applet creates the image representing the new region of theMandelbrot set. The key to this applet is patience! The calculationscan take a little while to set up and run. The applet tries tohelp your patience by updating the status bar to indicate whatis going on. Furthermore, the image filter displays each columnof the set as the calculations advance.<P>You might select a region that doesn't appear to have anythinginteresting to show when you zoom in on it. You can stop a calculationin the middle by entering <TT>a</TT>or <TT>A</TT> on the keyboard. Theapplet will take a moment to wrap up, but then you can proceed.When you are having problems finding an interesting region tolook at, try increasing the size of the highlighted area. Thiswill yield a bigger area that is generated, giving you a betterfeel for what should be inspected. You get the best results byworking with medium-sized highlighted regions, rather than largeor small ones.<P>Figures 14.3 to 14.6 show what some of the zoomed-in regions ofthe Mandelbrot set look like. Figure 14.3 is a large area pickedabove the black &quot;circles&quot; of the full Mandelbrot set;Figure 14.5 explores an area between two of the black areas. Therichest displays seem to occur at the boundaries of the blackareas. The black color indicates that the particular value takesa long time to reach infinity. Consequently, these are also theregions that take the longest to calculate. You get what you payfor!<P><A HREF="f14-3.gif" ><B>Figure 14.3 : </B><I>Zoom in over block regions of Figure 14.2.</I></A><P><A HREF="f14-4.gif" ><B>Figure 14.4 : </B><I>Zoom in of Figure 14.3.</I></A><P>The zoom applet maintains a cache of processed images so you canmove back and forth among the processed images. Table 14.2 liststhe text codes for using the zoom applet.<P><A HREF="f14-5.gif" ><B>Figure 14.5 : </B><I>Zoom in between black regions of Figure 14.2</I></A><I>.</I><P><A HREF="f14-6.gif" ><B>Figure 14.6 : </B><I>Zoom in of Figure 14.5.</I></A><BR><P><CENTER><B>Table 14.2. Codes for controlling the Mandelbrot applet.</B></CENTER><P><CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%><TR VALIGN=TOP><TD WIDTH=97><CENTER><I>Characters</I></CENTER></TD><TD WIDTH=355><I>Action</I></TD></TR><TR VALIGN=TOP><TD WIDTH=97><CENTER><TT>A or a</TT></CENTER></TD><TD WIDTH=355>Abort current Mandelbrot calculation.</TD></TR><TR VALIGN=TOP><TD WIDTH=97><CENTER><TT>B or b</TT></CENTER></TD><TD WIDTH=355>Go to previous image.</TD></TR><TR VALIGN=TOP><TD WIDTH=97><CENTER><TT>F or f</TT></CENTER></TD><TD WIDTH=355>Go to next image.</TD></TR><TR VALIGN=TOP><TD WIDTH=97><CENTER><TT>C or c</TT></CENTER></TD><TD WIDTH=355>Remove all but full image from memory.</TD></TR><TR VALIGN=TOP><TD WIDTH=97><CENTER><TT>N or n</TT></CENTER></TD><TD WIDTH=355>Go to next image.</TD></TR><TR VALIGN=TOP><TD WIDTH=97><CENTER><TT>P or p</TT></CENTER></TD><TD WIDTH=355>Go to previous image.</TD></TR><TR VALIGN=TOP><TD WIDTH=97><CENTER><TT>S or s</TT></CENTER></TD><TD WIDTH=355>Save the current image to a BMP file prefixed by <TT>tempMandel</TT>.</TD></TR><TR VALIGN=TOP>`<TD WIDTH=97><CENTER><TT>Z or z</TT></CENTER></TD><TD WIDTH=355>Zoom in on currently highlighted region.</TD></TR></TABLE></CENTER><H2><A NAME="TheMandelbrotClass"><FONT SIZE=5 COLOR=#FF0000>TheMandelbrot Class</FONT></A></H2><P>The Mandelbrot class, shown in Listing 14.1, calculates the Mandelbrotset. It implements the Runnable interface, so it can run as athread, and also implements the CalculatorProducer interface,so it can update an image filter of progress made in its calculations.<P>There are two constructors for the Mandelbrot class. The defaultconstructor produces the full Mandelbrot set and takes the dimensionsof the image to calculate. The Real and Imagine variables in theconstructors and the <TT>run()</TT>method are used to map the x-y axis to the real and imaginaryportions of <TT>c</TT> in Formula14.1. The other constructor is used to zoom in on a user-definedmapping.<P>A couple of the other variables are worth noting. The variable<TT>maxIterations</TT> representswhen to stop calculating a number. If this number, set to <TT>512</TT>,is reached, then the starting value of <TT>c</TT>takes a long time to head toward infinity. The variable <TT>maxSize</TT>is a simpler indicator of how quickly the current value grows.How the current calculation is related to these variables is mappedto a specific color; the higher the number, the slower the growth.If you have a fast computer, you can adjust these variables toget a richer or duller expression of the Mandelbrot set.<P>Once the thread is started (by the CalculatorFilter object throughthe <TT>start()</TT> method), the<TT>run()</TT> method calculates theMandelbrot values and stores a color corresponding to the growthrate of the current complex number into a pixel array. When acolumn is complete, it uses the CalculateFilterNotify to let therelated filter know that new data has been produced. It also checksto see whether you want to abort the calculation. Note how itsynchronizes the <TT>stopCalc</TT>boolean object in the <TT>run()</TT>and <TT>stop()</TT> methods.<P>The calculation can take a while to complete. Still, it takesonly a couple of minutes on a 486-based PC. This performance isquite a testament to Java! With other interpreted, portable languagesyou would probably be tempted to use the reset button becausethe calculations would take so long. With Java you get fast visualfeedback on how the set unfolds.<P>A good exercise is to save any partially developed Mandelbrotset; you can use the <TT>saveBMP()</TT>method here. You also need some kind of data file to indicatewhere the calculation was stopped.<HR><BLOCKQUOTE><B>Listing 14.1. The Mandelbrot class.<BR></B></BLOCKQUOTE><BLOCKQUOTE><TT>import java.awt.image.*;<BR>import java.awt.Image;<BR>import java.lang.*;<BR><BR>// Class for producing a Mandelbrot set image...<BR>public class Mandelbrot implements Runnable, CalculatorProducer{<BR>&nbsp;&nbsp;&nbsp;int width;&nbsp;&nbsp;// The dimensions of theimage...<BR>&nbsp;&nbsp;&nbsp;int height;<BR>&nbsp;&nbsp;&nbsp;CalculateFilterNotify filter; // Keeps trackof image production...<BR>&nbsp;&nbsp;&nbsp;int pix[]; // Pixels used to construct image...<BR>&nbsp;&nbsp;&nbsp;CalculatorImage img;<BR>&nbsp;&nbsp;&nbsp;// General Mandelbrot parameters...<BR>&nbsp;&nbsp;&nbsp;int numColors = 256;<BR>&nbsp;&nbsp;&nbsp;int maxIterations = 512;<BR>&nbsp;&nbsp;&nbsp;int maxSize = 4;<BR>&nbsp;&nbsp;&nbsp;double RealMax,ImagineMax,RealMin,ImagineMin;&nbsp;&nbsp;//Define sizes to build...<BR>&nbsp;&nbsp;&nbsp;private Boolean stopCalc = new Boolean(false);&nbsp;&nbsp;//Stop calculations...<BR><BR>&nbsp;&nbsp;&nbsp;// Create standard Mandelbrot set<BR>&nbsp;&nbsp;&nbsp;public Mandelbrot(int width,int height) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.width = width;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.height = height;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RealMax = 1.20;&nbsp;&nbsp;//Default starting sizes...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RealMin = -2.0;<BR>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久66热re国产| www日韩大片| 91视频在线看| 亚洲欧美日韩成人高清在线一区| 91视频一区二区| 日本精品视频一区二区| 国产一区二区主播在线| 亚洲男人电影天堂| 国产98色在线|日韩| 奇米精品一区二区三区在线观看一| 久久精品国产第一区二区三区 | 国产精品你懂的| 亚洲成人免费视| 国产亚洲欧美在线| 欧美亚日韩国产aⅴ精品中极品| 秋霞av亚洲一区二区三| 国产精品污网站| 欧美一级一级性生活免费录像| 粉嫩av一区二区三区粉嫩| 亚洲国产高清在线观看视频| 欧美一级xxx| 91丨porny丨国产| 奇米影视7777精品一区二区| 亚洲成a人v欧美综合天堂| 国产精品久久久久婷婷二区次| 欧美美女一区二区在线观看| 国产剧情在线观看一区二区| 久久99精品久久久| 午夜精品一区二区三区免费视频| 国产精品高潮久久久久无| 国产日韩一级二级三级| 久久精品日韩一区二区三区| 久久综合成人精品亚洲另类欧美| 欧美日韩一区二区在线观看视频| 色婷婷久久久亚洲一区二区三区| 九色|91porny| 蜜桃av一区二区三区| 国产资源精品在线观看| 成人久久18免费网站麻豆| 成人午夜看片网址| 99久久综合狠狠综合久久| 91在线免费播放| 欧美羞羞免费网站| 色噜噜狠狠一区二区三区果冻| 99riav一区二区三区| 在线亚洲高清视频| 欧美人体做爰大胆视频| 欧美一区二区三区不卡| 久久综合色一综合色88| 26uuu国产在线精品一区二区| 国产婷婷色一区二区三区在线| 亚洲免费资源在线播放| 日本成人在线不卡视频| 国产一区二区三区黄视频 | 91小宝寻花一区二区三区| 99久久婷婷国产精品综合| 欧美美女视频在线观看| 国产精品视频免费看| 亚洲一区二区av电影| 激情五月激情综合网| 色素色在线综合| 日韩精品中午字幕| 一区二区三区精品久久久| 久久精品72免费观看| 97se亚洲国产综合自在线观| 日韩你懂的在线播放| 国产精品久久久久久久久免费桃花| 一区二区三区四区视频精品免费| 欧美美女直播网站| 国产精品久久久久久户外露出| 日韩国产精品大片| av动漫一区二区| 在线成人av网站| 国产精品久久久久一区二区三区 | 欧美最新大片在线看| 国产亚洲成aⅴ人片在线观看| 亚洲成人精品影院| 色琪琪一区二区三区亚洲区| 国产校园另类小说区| 五月综合激情日本mⅴ| 91麻豆国产福利在线观看| 国产日韩欧美精品在线| 日本三级亚洲精品| 欧美色窝79yyyycom| 视频一区欧美日韩| 精品黑人一区二区三区久久| 在线观看www91| 国产欧美日韩在线观看| 国产真实乱子伦精品视频| 欧美精品三级日韩久久| 日韩有码一区二区三区| 一本色道a无线码一区v| 国产精品成人一区二区艾草| 91在线国产福利| 亚洲精品久久7777| 欧美日韩国产美女| 久久国产精品一区二区| 欧美视频完全免费看| 免费不卡在线视频| 久久影院午夜片一区| 91在线视频18| 秋霞影院一区二区| 亚洲午夜久久久久中文字幕久| 93久久精品日日躁夜夜躁欧美| 日本道在线观看一区二区| 日日噜噜夜夜狠狠视频欧美人| 欧美日韩国产精选| 久久不见久久见免费视频7| 亚洲最大色网站| 337p亚洲精品色噜噜狠狠| 北条麻妃国产九九精品视频| 亚洲三级在线免费观看| 精品久久久三级丝袜| 成人av资源下载| 免费成人在线视频观看| 国产精品午夜久久| 91精品国产高清一区二区三区蜜臀 | 日韩一区在线免费观看| 欧美国产日韩亚洲一区| 欧美日韩高清在线播放| 国产成人综合网| 亚洲福利一区二区| 亚洲精品成人悠悠色影视| 日韩免费在线观看| 日韩欧美久久一区| 另类小说图片综合网| 午夜视频在线观看一区二区 | 日本一区二区三区电影| av不卡在线播放| 国产精品中文有码| 国产精品一二三在| 91亚洲精品久久久蜜桃网站| 成人一道本在线| 毛片av一区二区| 九九久久精品视频| 极品美女销魂一区二区三区| 日韩黄色免费网站| 美国一区二区三区在线播放| 日韩和欧美的一区| 美女一区二区在线观看| 亚洲va欧美va人人爽| 亚洲影院久久精品| 亚洲在线成人精品| 日韩成人午夜精品| 国产高清精品在线| 成人免费一区二区三区在线观看| 亚洲欧洲无码一区二区三区| 亚洲国产精品av| 亚洲一区二区三区四区不卡| 国产欧美精品一区aⅴ影院| 久久久www免费人成精品| 亚洲三级在线免费| 国产午夜精品一区二区三区四区 | bt7086福利一区国产| 国产成人av电影在线| 欧美视频一区二| 欧美日韩久久不卡| 国产精品福利影院| 亚洲成人免费在线观看| 国产一区二区三区av电影| 99久久综合狠狠综合久久| 日韩视频一区二区三区在线播放| 久久久久久久综合色一本| 亚洲成人av资源| 国产剧情一区二区三区| 91免费看`日韩一区二区| 亚洲精品在线观看网站| 午夜电影网亚洲视频| 国产成人精品影视| 99久久国产免费看| 精品人伦一区二区色婷婷| 综合欧美亚洲日本| 不卡的av中国片| 精品久久99ma| 日本视频一区二区三区| 91久久久免费一区二区| 亚洲视频网在线直播| 国产伦精品一区二区三区视频青涩| 欧美主播一区二区三区美女| 中文字幕精品三区| kk眼镜猥琐国模调教系列一区二区| 欧美一区二区三区视频免费播放 | 免费久久99精品国产| 99这里只有久久精品视频| 亚洲免费毛片网站| 日韩一区二区免费电影| 粉嫩欧美一区二区三区高清影视| 丝袜美腿亚洲色图| 欧美激情一区三区| 欧美日本免费一区二区三区| 成人免费视频免费观看| 亚洲国产wwwccc36天堂| 中文字幕的久久| 欧美精品一区二区三区一线天视频| 91福利视频在线| 日韩av中文字幕一区二区| 国产欧美一区二区精品婷婷 | 理论电影国产精品| 综合激情成人伊人| 国产精品乱人伦一区二区|