Package java.awt.image |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
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.
protected ImageConsumer consumerThe 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.
public ImageFilter()The default constructor for this method.
public Object clone()Return Value:
Returns a clone of this object.
Overrides:
clone in class Object .
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 .
Parameter Description ic the image consumer
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.
Parameter Description status the status of the image
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:
- The filter can forward this request to the image producer using itself as the requesting image consumer. This is the default behavior provided by the resendTopDownLeftRight method of ImageFilter.
- The filter can resend the pixels in the right order on its own (presumably because the generated pixels have been saved in some sort of buffer).
- The filter can ignore this request.
Parameter Description ip the image producer that is feeding this instance of the filter.
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.
Parameter Description model a color map used in subsequent setPixel calls
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.
Parameter Description width the width of the image height the height of the image
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.
Parameter Description hints hints about the order in which the bits are to be delivered
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.
Parameter Description 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
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.
Parameter Description 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
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:
- If the hashtable already has no key "filters", a string representation of the current filter is added to the hashtable under the key "filter".
- If such a key is already in the hashtable, a string representation of the current filter is appended to the property (which must be a String) already stored under that key, and stores this value back in the hashtable.
Parameter Description props a hashtable that maps image properties to their value