Packages  This Package  Prev  Next  Index  

§2.5 Class ImageFilter

public  class  java.awt.image.ImageFilter
    extends  java.lang.Object  (I-§1.12)
    implements java.awt.image.ImageConsumer  (II-§2.10),
               java.lang.Cloneable  (I-§1.22)
{
        // Fields
    protected ImageConsumer consumer;	§2.5.1

        // Constructors
    public ImageFilter();	§2.5.2

        // Methods
    public Object clone();	§2.5.3
    public ImageFilter getFilterInstance(ImageConsumer  ic)	§2.5.4
    public void imageComplete(int  status);	§2.5.5
    public void resendTopDownLeftRight(ImageProducer  ip);	§2.5.6
    public void setColorModel(ColorModel  model);	§2.5.7
    public void setDimensions(int  width, int  height);	§2.5.8
    public void setHints(int  hints);	§2.5.9
    public void setPixels(int  x, int  y, int  w, int  h,	§2.5.10
           ColorModel  model, byte  pixels[],
           int  off, int  scansize);
    public void setPixels(int  x, int  y, int  w, int  h,	§2.5.11
           ColorModel  model, int  pixels[],
           int  off, int  scansize);
    public void setProperties(Hashtable  props);	§2.5.12
}
This class is the superclass of all classes that are meant to filter the data delivered from an ImageProducer (II-§2.12) to an ImageConsumer (II-§2.10).

This class and its subclasses are meant to be used in conjunction with a FilteredImageSource (II-§2.4) object to produce filtered versions of existing images.

The image filter implemented by this class is the "null filter" which has no effect on the data passing through. Filters should subclass this class and override the methods in order to modify the data as necessary.


Fields

consumer

protected ImageConsumer consumer
The image consumer (II-§2.10) of the particular image data stream for which this image filter is filtering data.


The field is not initialized by the constructor, but by the call to the getFilterInstance method (II-§2.5.4), when the FilteredImageSource (II-§2.4) is creating a unique instance of this object for a particular image data stream.


Constructors

ImageFilter

public ImageFilter()
The default constructor for this method.

Methods

clone

public Object clone()
Returns:
a clone of this object.
Overrides:
clone in class Object (I-§1.12.2).

getFilterInstance

public ImageFilter getFilterInstance(ImageConsumer ic)
Creates an image filter which filters the image for the specified image consumer.
The getFilterInstance method of ImageFilter clones the object. and sets its consumer field to the image consumer argument. Subclasses can override this method, if they require more setup than this..
Parameters:
ic - the image consumer
Returns:
a unique instance of an image filter object which actually performs the filtering for the specified image consumer (II-§2.10).

imageComplete

public void imageComplete(int status)
The image producer calls the imageComplete method when it has completed an image or it has encountered an error in producing or loading the image. For more information on this method and its status argument, see §2.10.10 on page 304.


The imageComplete method of ImageFilter calls the imageComplete method (II-§2.10.10) of the image consumer with the identical argument.

Parameters:
status - the status of the image

resendTopDownLeftRight

public void resendTopDownLeftRight(ImageProducer ip)
An image consumer calls the resendTopDownLeftRight of its producer to request that the pixel data be resent in that order. For more information on this method see §2.12.4 on page 314.


An image filter can respond to this request in one of three ways:
Parameters:
ip - the image producer that is feeding this instance of the filter.

setColorModel

public void setColorModel(ColorModel model)
The image producer calls the setColorModel method to specify the color model for the majority of the subsequent setPixels method calls. For more information on this method and its model argument, see §2.10.11 on page 305.


The setColorModel method of ImageFilter calls the setColorModel method (II-§2.10.11) of the image consumer with the identical argument.

Parameters:
model - a color map used in subsequent setPixel calls

setDimensions

public void setDimensions(int width, int height)
The image producer calls the setDimensions of the image consumer to tell it the width and height of the image.
The setDimensions method of ImageFilter calls the setDimensions method (II-§2.10.12) of its image consumer with the identical arguments.

Parameters:
width - the width of the image
height - the height of the image

setHints

public void setHints(int hints)
The image producer calls the setHints method of the image consumer to indicate the order in which the bits are to be delivered. For more information on the hints passed to the image consumer, see §2.10.13 on page 306.


The setHints method of ImageFilter calls the setHints method (II-§2.10.13) of its image consumer with the identical argument.

Parameters:
hints - hints about the order in which the bits are to be delivered

setPixels

public void
setPixels(int x, int y, int w, int h, ColorModel model,
byte pixels[], int off, int scansize)
The image producer calls the setPixels method of the image consumer one or more times to deliver the pixels of the image. For more information on this method and its arguments, see §2.10.14 on page 307.


The setPixels method of ImageFilter calls the setPixels method (II-§2.10.14) of its image consumer with the identical arguments.

Parameters:
x - left coordinate of rectangle
y - top coordinte of rectangle
w - width of rectangle
h - height of rectangle
model - color model for bits
pixels - array of bits
off - offset for first element
scansize - number of elements per row

setPixels

public void
setPixels(int x, int y, int w, int h, ColorModel model,
int pixels[], int off, int scansize)
The image producer calls the setPixels method of the image consumer one or more times to deliver the pixels of the image. For more information on this method and its arguments, see §2.10.15 on page 308.


The setPixels method of ImageFilter calls the setPixels method (II-§2.10.15) of its image consumer with the identical arguments.

Parameters:
x - left coordinate of rectangle
y - top coordinte of rectangle
w - width of rectangle
h - height of rectangle
model - color model for bits
pixels - array of bits
off - offset for first element
scansize - number of elements per row

setProperties

public void setProperties(Hashtable props)
The image producer calls the setProperties method of the image consumer to let it know of additional properties of the image. For more information on this method and its arguments, see §2.10.16 on page 308.


The setProperties method of ImageFilter calls the setProperties method of its image consumer §2.10.16 with the properties argument after modifying it slightly:

Parameters:
props - a hashtable that maps image properties to their value

Packages  This Package  Prev  Next  Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com