FileDocCategorySizeDatePackage
ColorPan.javaAPI DocExample794Wed Mar 26 03:18:26 GMT 1997None

ColorPan

public class ColorPan extends Applet

Fields Summary
Image
img
int
width
int
height
int[]
pixData
Constructors Summary
Methods Summary
public voidinit()

		width = getSize().width;
		height = getSize().height;
		pixData = new int [width * height];
		int i=0;

        for (int y = 0; y < height; y++) {
            int red = (y * 255) / (height - 1);
            for (int x = 0; x < width; x++) {
                int green = (x * 255) / (width - 1);

				int blue = 128;
				int alpha = 255;
                pixData[i++] = (alpha << 24) | (red << 16) | (green << 8 ) | blue;
            }
        }
	
public voidpaint(java.awt.Graphics g)

		if ( img == null )
			img = createImage( new MemoryImageSource(width, height, pixData, 0, width));
		g.drawImage( img, 0, 0, this );