FileDocCategorySizeDatePackage
GrayImage.javaAPI DocExample1717Sat Jun 02 02:41:38 BST 2001None

GrayImage

public class GrayImage extends Applet
An applet that display an image, and a filtered version of the image

Fields Summary
Image
orig
Image
gray
Constructors Summary
Methods Summary
public voidinit()
Load the image. Create a new image that is a grayer version of it, using a FilteredImageSource, ImageProducer and a the GrayFilter class, below.

    orig = this.getImage(this.getDocumentBase(), "cover.gif");
    ImageFilter filter = new GrayFilter();
    ImageProducer producer = new FilteredImageSource(orig.getSource(), filter);
    gray = this.createImage(producer);
  
public voidpaint(java.awt.Graphics g)
Display the original image and gray version side-by-side

    g.drawImage(orig, 25, 25, this);
    g.drawImage(gray, 200, 25, this);