// This example is from the book _Java AWT Reference_ by John Zukowski. // Written by John Zukowski. Copyright (c) 1997 O'Reilly & Associates. // You may study, use, modify, and distribute this example for any purpose. // This example is provided WITHOUT WARRANTY either expressed or import java.applet.*; import java.awt.*; import java.awt.image.*; public class MemoryImage extends Applet { Image i, j; int width = 200; int height = 200; public void init () { int rgbPixels[] = new int [width*height]; byte indPixels[] = new byte [width*height]; int index = 0; Color colorArray[] = {Color.red, Color.orange, Color.yellow, Color.green, Color.blue, Color.magenta}; int rangeSize = width / colorArray.length; int colorRGB; byte colorIndex; byte reds[] = new byte[colorArray.length]; byte greens[] = new byte[colorArray.length]; byte blues[] = new byte[colorArray.length]; for (int i=0;i-->