/** * CircularFilterApplet2.java * Copyright (c) 1998 Yoon Kyung Koo. All rights reserved. * * First release date 1998/06/07 * * @version 1.0c 1998/07/07 * @author Yoon Kyung Koo */ import java.awt.*; import java.awt.image.*; /** * CircularFilterApplet2 class * This applet shows an image filter example */ public class CircularFilterApplet2 extends java.applet.Applet implements Runnable { private Image image=null; private int nodes=0; private int amplitude=0; private int frameNo=0; private int currentFrame=0; private int animInterval=0; private Image filtered[]=null; private boolean isLoaded=false; private boolean isFiltered=false; private MediaTracker tracker=null; private Thread animThread=null; public void init() { image = getImage(getCodeBase(), getParameter("image")); String nodes = getParameter("node"); if (nodes==null) this.nodes=5; else this.nodes=Integer.valueOf(nodes).intValue(); String amplitude = getParameter("amplitude"); if (amplitude==null) this.amplitude=15; else this.amplitude=Integer.valueOf(amplitude).intValue(); String frameNo = getParameter("frame"); if (frameNo==null) this.frameNo=5; else this.frameNo=Integer.valueOf(frameNo).intValue(); String animInterval = getParameter("delay"); if (animInterval==null) this.animInterval=100; else this.animInterval=Integer.valueOf(animInterval).intValue(); tracker=new MediaTracker(this); } public void start() { tracker.addImage(image, 0); if (animThread==null) { animThread=new Thread(this); animThread.start(); } } public void run() { Thread me=Thread.currentThread(); try { tracker.waitForID(0); int width=image.getWidth(this); int height=image.getHeight(this); Point center=new Point(width/2, height/2); double radius=Math.sqrt(width*width/4.0+height*height/4.0); isLoaded=true; repaint(); ImageProducer prod=image.getSource(); filtered=new Image[frameNo]; for (int i=0; i