import java.awt.*; import java.net.*; public class Blur extends PixApplet { ImagePyramid pyramid; Image src; double t = 1, w = 1; public boolean mouseDrag(Event e, int x, int y) { t = Math.max(0, Math.min(1, (double)x / bounds().width)); w = Math.max(0, Math.min(1, (double)y / bounds().width)); return true; } public void setPix(int frame) { super.setPix(frame); if (pyramid == null) { try { src = getImage(new URL(getCodeBase(), getParameter("texture0"))); } catch (Exception e) { } pyramid = new ImagePyramid(new ImageBuffer(src, this)); } double s = .001 + t * (.3 - .001); for (int x = 0 ; x < W ; x++) for (int y = 0 ; y < H ; y++) { double u = (double)x / W; double v = (double)y / H; double rr = (u-.5) * (u-.5) + (v-.5) * (v-.5); pix[xy2i(x,y)] = pyramid.get(u, v, s + w * (16 * rr - s)); } } }