Top Description Fields Constructors Methods
java.awt.image

public Class FilteredImageSource

extends Object
implements ImageProducer
Class Inheritance
All Implemented Interfaces
java.awt.image.ImageProducer
Imports
java.awt.Image, java.awt.image.ImageFilter, .ImageConsumer, .ImageProducer, .ColorModel, java.util.Hashtable

This class is an implementation of the ImageProducer interface which takes an existing image and a filter object and uses them to produce image data for a new filtered version of the original image. Furthermore, FilteredImageSource is safe for use by multiple threads. Here is an example which filters an image by swapping the red and blue components:

     Image src = getImage("doc:///demo/images/duke/T1.gif");
     ImageFilter colorfilter = new RedBlueSwapFilter();
     Image img = createImage(new FilteredImageSource(src.getSource(),
                                                     colorfilter));

Author
Jim Graham
See Also
ImageProducer

Field Summary

Modifier and TypeField and Description
pack-priv ImageFilter
private Hashtable<ImageConsumer, ImageFilter>
pack-priv ImageProducer

Constructor Summary

AccessConstructor and Description
public
FilteredImageSource(ImageProducer
the specified ImageProducer
orig
,
ImageFilter
the specified ImageFilter
imgf
)

Constructs an ImageProducer object from an existing ImageProducer and a filter object.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addConsumer(ImageConsumer
the consumer for the filtered image
ic
)

Implements java.awt.image.ImageProducer.addConsumer.

Adds the specified ImageConsumer to the list of consumers interested in data for the filtered image.

public synchronized boolean

Returns:

true if the ImageConsumer is on the list; false otherwise
isConsumer
(ImageConsumer
the specified ImageConsumer
ic
)

Implements java.awt.image.ImageProducer.isConsumer.

Determines whether an ImageConsumer is on the list of consumers currently interested in data for this image.

public synchronized void
removeConsumer(ImageConsumer
the specified ImageConsumer
ic
)

Implements java.awt.image.ImageProducer.removeConsumer.

Removes an ImageConsumer from the list of consumers interested in data for this image.

public synchronized void
requestTopDownLeftRightResend(ImageConsumer
the specified ImageConsumer
ic
)

Implements java.awt.image.ImageProducer.requestTopDownLeftRightResend.

Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order.

public synchronized void
startProduction(ImageConsumer
the consumer for the filtered image
ic
)

Implements java.awt.image.ImageProducer.startProduction.

Starts production of the filtered image.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

filterback to summary
pack-priv ImageFilter filter
proxiesback to summary
private Hashtable<ImageConsumer, ImageFilter> proxies
srcback to summary
pack-priv ImageProducer src

Constructor Detail

FilteredImageSourceback to summary
public FilteredImageSource(ImageProducer orig, ImageFilter imgf)

Constructs an ImageProducer object from an existing ImageProducer and a filter object.

Parameters
orig:ImageProducer

the specified ImageProducer

imgf:ImageFilter

the specified ImageFilter

See Also
ImageFilter, java.awt.Component#createImage

Method Detail

addConsumerback to summary
public synchronized void addConsumer(ImageConsumer ic)

Implements java.awt.image.ImageProducer.addConsumer.

Adds the specified ImageConsumer to the list of consumers interested in data for the filtered image. An instance of the original ImageFilter is created (using the filter's getFilterInstance method) to manipulate the image data for the specified ImageConsumer. The newly created filter instance is then passed to the addConsumer method of the original ImageProducer.

This method is public as a side effect of this class implementing the ImageProducer interface. It should not be called from user code, and its behavior if called from user code is unspecified.

Parameters
ic:ImageConsumer

the consumer for the filtered image

See Also
ImageConsumer
isConsumerback to summary
public synchronized boolean isConsumer(ImageConsumer ic)

Implements java.awt.image.ImageProducer.isConsumer.

Determines whether an ImageConsumer is on the list of consumers currently interested in data for this image.

This method is public as a side effect of this class implementing the ImageProducer interface. It should not be called from user code, and its behavior if called from user code is unspecified.

Parameters
ic:ImageConsumer

the specified ImageConsumer

Returns:boolean

true if the ImageConsumer is on the list; false otherwise

See Also
ImageConsumer
removeConsumerback to summary
public synchronized void removeConsumer(ImageConsumer ic)

Implements java.awt.image.ImageProducer.removeConsumer.

Removes an ImageConsumer from the list of consumers interested in data for this image.

This method is public as a side effect of this class implementing the ImageProducer interface. It should not be called from user code, and its behavior if called from user code is unspecified.

Parameters
ic:ImageConsumer

Doc from java.awt.image.ImageProducer.removeConsumer.

the specified ImageConsumer

See Also
ImageConsumer
requestTopDownLeftRightResendback to summary
public synchronized void requestTopDownLeftRightResend(ImageConsumer ic)

Implements java.awt.image.ImageProducer.requestTopDownLeftRightResend.

Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order. The request is handed to the ImageFilter for further processing, since the ability to preserve the pixel ordering depends on the filter.

This method is public as a side effect of this class implementing the ImageProducer interface. It should not be called from user code, and its behavior if called from user code is unspecified.

Parameters
ic:ImageConsumer

Doc from java.awt.image.ImageProducer.requestTopDownLeftRightResend.

the specified ImageConsumer

See Also
ImageConsumer
startProductionback to summary
public synchronized void startProduction(ImageConsumer ic)

Implements java.awt.image.ImageProducer.startProduction.

Starts production of the filtered image. If the specified ImageConsumer isn't already a consumer of the filtered image, an instance of the original ImageFilter is created (using the filter's getFilterInstance method) to manipulate the image data for the ImageConsumer. The filter instance for the ImageConsumer is then passed to the startProduction method of the original ImageProducer.

This method is public as a side effect of this class implementing the ImageProducer interface. It should not be called from user code, and its behavior if called from user code is unspecified.

Parameters
ic:ImageConsumer

the consumer for the filtered image

See Also
ImageConsumer