/* アニメーション実験 Ver 0.10 */ /* */ /* */ /* by Atsushi 2005/8/20 */ package animation.animation; import java.awt.Dimension; import java.awt.image.ColorModel; import net.antun.lib.awt.image.SinglepassImageFilter; public class WaveImageFilter2 extends SinglepassImageFilter { /* --- Field --- */ private int width,height; private int waveLength,amplitude; private double phase; /* --- Constructor --- */ public WaveImageFilter2(int waveLength,int amplitude,double phase) { this.waveLength=waveLength; this.amplitude =amplitude; this.phase =phase; } /* --- フィルタリング --- */ public void setDimensions(int width,int height) { super.setDimensions(width,height); this.width =width +amplitude*2; this.height=height+amplitude*2; consumer.setDimensions(this.width,this.height); } protected void filterImage() { double r,d; int xx,yy,cx,cy; int p[]; p=new int[width]; cx=width /2; cy=height/2; for (int y=0;y<=height-1;y++) { for (int x=0;x<=width-1;x++) { r=Math.sqrt((x-cx)*(x-cx)+(y-cy)*(y-cy)); d=Math.sin(phase+2.0*Math.PI*r/waveLength)*amplitude; xx=(int)((x-cx)*(r+d)/r)+originalSize.width /2; yy=(int)((y-cy)*(r+d)/r)+originalSize.height/2; if (0<=xx && xx