/* * A more efficient MemoryImageSource example? * * Lifted from John Zukowski's article "Creating in-memory images * in Java Save network bandwidth by creating images at run time" * (http://www.javaworld.com/javaworld/javatips/jw-javatip16.html) * by Andrew Barclay, abb@nuccard.eushc.org on 10/4/96. * */ import java.awt.*; import java.awt.image.*; public class jwmem_abb extends java.applet.Applet { Image i; int pad = 0 ; public void init() { String param ; if( (param = getParameter( "pad" )) != null ) { pad = Integer.parseInt( param ) ; } /* * This is a potential costly computation and should not be * done in the init() method as this runs in the browser's * thread, but I'm too lazy to set up a thread. */ //Since image doesn't vary in x, make width = 1. int height = size().height ; int[] pixels = new int [height]; double radianConversion = Math.PI / 180.0; for (int y=0;y