---
title: "Java图形程序水纹倒映效果"
author: "mmdev"
date: "2007-10-22T16:54:00Z"
tags: []
slug: "java"
draft: false
lastmod: "2012-04-14T20:14:55Z"
id: 1486383
url: "https://mmdev.iteye.com/blog/1486383"
---

效果图如下：  
![](http://p.blog.csdn.net/images/p_blog_csdn_net/cping1982/backcc.jpg)

![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)packageorg.test;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.Color;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.Frame;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.Graphics;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.Image;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.MediaTracker;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.Panel;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.image.BufferedImage;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.image.MemoryImageSource;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importjava.awt.image.PixelGrabber;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)importorg.loon.framework.game.helper.ImageHelper;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*\*//\**  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*Title:LoonFramework  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;/p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*Description:Java图形程序水纹倒映效果  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;/p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*Copyright:Copyright(c)2007  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;/p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*Company:LoonFramework  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*&lt;/p&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)*  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*@authorchenpeng  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*@email：ceponline@yahoo.com.cn  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*@version0.1  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)\*/  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)publicclassImageWaveextendsPanelimplementsRunnable...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)/\*\*\*//\**  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)*  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)\*/  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privatestaticfinallongserialVersionUID=1L;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateThreadthread;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateImage\_image;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateMediaTracker\_mt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateint\_delay;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateGraphics\_bg;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateImage\_screen;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateboolean\_playing;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateint\_pixels\[];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateint\_mpixels\[];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateint\_wpixels\[];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privatefinalstaticint\_WIDTH=480;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privatefinalstaticint\_HEIGHT=604;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateImage\_images\[];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateint\_sleep;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateint\_frame;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)/\*\*\*//\**  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*构造函数,注入背景图与延迟时间  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)*  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*@paramimg  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*@paramdelay  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)\*/  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicImageWave(Imageimg,intdelay)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_delay=delay;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)init(img,delay);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicvoidinit(Imageimg,intdelay)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)setBackground(Color.BLACK);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_image=img;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_mt=newMediaTracker(this);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_mt.addImage(\_image,0);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_mt.checkAll(true);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_frame=10;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_screen=newBufferedImage(\_WIDTH,\_HEIGHT,1);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_bg=\_screen.getGraphics();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)thread=newThread(this);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)thread.start();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicvoidrun()...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Thread.currentThread().setPriority(1);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)longl=System.currentTimeMillis();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)while(Thread.currentThread()==thread)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)try...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)repaint();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_sleep++;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)l+=\_delay;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Thread.sleep(Math.max(0L,l-System.currentTimeMillis()));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)}catch(InterruptedException\_ex)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)return;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)/\*\*\*//\**  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*绘制图象  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)\*/  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicvoidpaint(Graphicsg)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)if(!\_playing)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)if(\_mt.checkAll())...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_playing=true;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_bg.drawImage(\_image,0,0,this);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_pixels=newint\[(\_WIDTH\*\_HEIGHT)/2];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_mpixels=newint\[(\_WIDTH\*\_HEIGHT)/2];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_wpixels=newint\[((\_WIDTH\*\_HEIGHT)/2)\*\_frame];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)PixelGrabberpixelgrabber=newPixelGrabber(\_image,0,0,  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_WIDTH,\_HEIGHT/2,\_pixels,0,\_WIDTH);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)try...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)pixelgrabber.grabPixels();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)}catch(InterruptedException\_ex)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)blure();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_images=newImage\[\_frame];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)for(inti=0;i&lt;\_frame;i++)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_images\[i]=createMirrorImage(i);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)}else...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)if(\_sleep&gt;\_frame-1)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_sleep=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_bg.drawImage(\_images\[\_sleep],0,\_HEIGHT/2,this);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)g.drawImage(\_screen,0,0,this);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicvoidupdate(Graphicsg)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)paint(g);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)/\*\*\*//\**  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*创建波纹反射图片  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)*  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*@parami  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*@return  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)\*/  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)ImagecreateMirrorImage(inti)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intk1=\_HEIGHT/2;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intj1=i\*\_WIDTH\*k1;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)for(intk=0;k&lt;k1;k++)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intl=k\*\_WIDTH;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)inti1=k1-k-1;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)i1+=(int)((double)((k\*5)/k1+2)\*Math  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif).sin((25.132741228718345D\*(double)i1\*(double)i1)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)/(double)k1/(double)k1  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)-(6.2831853071795862D\*(double)i)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)/(double)\_frame));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)if(i1&lt;0)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)i1=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)if(i1&gt;k1-1)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)i1=k1-1;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)i1\*=\_WIDTH;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)for(intj=0;j&lt;\_WIDTH;j++)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_wpixels\[j1+j+l]=\_mpixels\[j+i1];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Imageimage=createImage(newMemoryImageSource(\_WIDTH,k1,\_wpixels,  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)j1,\_WIDTH));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)returnimage;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)/\*\*\*//\**  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\*模糊化反射图片  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)*  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)\*/  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)voidblure()...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intl=\_HEIGHT/2;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)for(intj=0;j&lt;l;j++)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intk=j\*\_WIDTH;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)for(inti=0;i&lt;\_WIDTH;i++)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)inti1=\_pixels\[i+k];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intj1;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)if(i!=\_WIDTH-1)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)j1=\_pixels\[i+k+1];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)else  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)j1=\_pixels\[(i+k)-1];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intk1=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)if(j!=l-1)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)k1=\_pixels\[i+k+\_WIDTH];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)else  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)k1=\_pixels\[(i+k)-\_WIDTH];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intl1=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)if(j!=l-1&&i!=\_WIDTH-1)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)l1=\_pixels\[i+k+\_WIDTH+1];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)else  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)l1=\_pixels\[i+k];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)inti2=(i1&gt;&gt;16&0xff)+(j1&gt;&gt;16&0xff)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)+(k1&gt;&gt;16&0xff)+(l1&gt;&gt;16&0xff);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intj2=(i1&gt;&gt;8&0xff)+(j1&gt;&gt;8&0xff)+(k1&gt;&gt;8&0xff)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)+(l1&gt;&gt;8&0xff);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)intk2=(i1&0xff)+(j1&0xff)+(k1&0xff)+(l1&0xff);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)i2&gt;&gt;=3;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)j2=(j2&gt;&gt;3)+(j2&gt;&gt;4);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)k2=(k2&gt;&gt;3)+(k2&gt;&gt;4);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)\_mpixels\[i+k]=i1&0xff000000|i2&lt;&lt;16|j2&lt;&lt;8|k2;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicstaticvoidmain(String\[]args)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Framefrm=newFrame();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)frm.setTitle("Java图形程序水纹倒映效果(由Loonframework提供)");  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)frm.setSize(\_WIDTH,\_HEIGHT+20);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)frm.setResizable(false);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)frm.add(newImageWave(ImageHelper.loadImage("C:/back.jpg",true),100));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)frm.setVisible(true);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)