Package java.awt.image Previous
Previous
Java API
Java API
Index
Index
Next
Next

Class ImageFilter

Fields , Constructors , Methods

public  class  java.awt.image.ImageFilter
    extends  java.lang.Object  
    implements java.awt.image.ImageConsumer  ,
               java.lang.Cloneable  
{
        // Fields
    protected ImageConsumer consumer;	

        // Constructors
    public ImageFilter();	

        // Methods
    public Object clone();	
    public ImageFilter getFilterInstance(ImageConsumer  ic)	
    public void imageComplete(int  status);	
    public void resendTopDownLeftRight(ImageProducer  ip);	
    public void setColorModel(ColorModel  model);	
    public void setDimensions(int  width, int  height);	
    public void setHints(int  hints);	
    public void setPixels(int  x, int  y, int  w, int  h,	
           ColorModel  model, byte  pixels[],
           int  off, int  scansize);
    public void setPixels(int  x, int  y, int  w, int  h,	
           ColorModel  model, int  pixels[],
           int  off, int  scansize);
    public void setProperties(Hashtable  props);	
}

This class is the superclass of all classes that are meant to filter the data delivered from an ImageProducer to an ImageConsumer .

This class and its subclasses are meant to be used in conjunction with a FilteredImageSource 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 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 , when the FilteredImageSource 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() 

Return Value:

Returns a clone of this object.

Overrides:

clone in class Object .


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..

Return Value:

Returns a unique instance of an image filter object which actually performs the filtering for the specified image consumer .

ParameterDescription
ic the image consumer


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 imageComplete.

The imageComplete method of ImageFilter calls the imageComplete method of the image consumer with the identical argument.

ParameterDescription
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 resendTopDownLeftRightResend.

An image filter can respond to this request in one of three ways:

ParameterDescription
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 setColorModel.

The setColorModel method of ImageFilter calls the setColorModel method of the image consumer with the identical argument.

ParameterDescription
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 of its image consumer with the identical arguments.

ParameterDescription
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 setHints.

The setHints method of ImageFilter calls the setHints method of its image consumer with the identical argument.

ParameterDescription
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 setPixels.

The setPixels method of ImageFilter calls the setPixels method of its image consumer with the identical arguments.

ParameterDescription
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 setPixels.

The setPixels method of ImageFilter calls the setPixels method of its image consumer with the identical arguments.

ParameterDescription
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 setProperties.

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

ParameterDescription
props a hashtable that maps image properties to their value



Top© 1996 Sun Microsystems, Inc. All rights reserved.