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

Class FilteredImageSource

Constructors , Methods

public  class  java.awt.image.FilteredImageSource
    extends  java.lang.Object  
    implements java.awt.image.ImageProducer  
{
        // Constructors
    public FilteredImageSource(ImageProducer  orig,	
                         ImageFilter  imgf);

        // Methods
    public void addConsumer(ImageConsumer  ic);	
    public boolean isConsumer(ImageConsumer  ic);	
    public void removeConsumer(ImageConsumer  ic);	
    public void 	
        requestTopDownLeftRightResend(ImageConsumer  ic);
    public void startProduction(ImageConsumer  ic);	
}

A filtered image source is an implementation of the image producer interface which takes an existing image and an image filter and uses them to produce a new filtered version of the original image.

Here is an example which filters an image by swapping the red and blue components:


Image  src  =  getImage("doc:///demo/images/duke/T1.gif");
// see comments in  for an implementation of RedBlueSwapFilter

ImageFilter  colorfilter  =  new  RedBlueSwapFilter();
Image  img  =  createImage(new  FilteredImageSource(src.getSource(),
                                                                                               colorfilter));



Constructors


FilteredImageSource

public 
FilteredImageSource(ImageProducer  orig,  ImageFilter  imgf) 

Constructs a new image producer from an existing image producer and an an image filter .

ParameterDescription
orig an existing image producer
imgf an image filter


Methods


addConsumer

public void addConsumer(ImageConsumer  ic) 

Registers the image consumer argument as wanting th image produced by this image producer. For more information on this method and its arguments, see addConsumer.

The addConsumer method of FilteredImageSource calls its image filter's getFilterInstance method to creates a new filter instance for the image consumer argument. The resulting filter instance is then passed as an argument to the image producer's addConsumer method .

ParameterDescription
ic an image consumer


isConsumer

public boolean isConsumer(ImageConsumer  ic) 

Return Value:

Returns true if the specified image consumer argument is currently registered with this image producer as one of its consumers; false otherwise.

ParameterDescription
ic an image consumer


removeConsumer

public void removeConsumer(ImageConsumer  ic) 

Removes the specified image consumer object from the list of consumers registered to receive the image data from this image producer. For more information on this method and its arguments, see removeConsumer.

The removeConsumer method of FilteredImageSource calls its image producer's removeConsumer method with the image filter than was created when this image consumer was first registered (addConsumer, startProduction).

ParameterDescription
ic an image consumer


requestTopDownLeftRightResend

public void
requestTopDownLeftRightResend(ImageConsumer  ic) 

An image consumer sends this message to request that the image producer attempt to resend the image data one more time in top-down, left-to-right order. For more information on this method and its arguments, see requestTopDownLeftRightResend.

The requestTopDownLeftRightResend method of FilteredImageSource calls its image producer's requestTopDownLeftRightResent method with the image filter than was created when this image consumer was first registered (addConsumer, startProduction).

ParameterDescription
ic an image consumer


startProduction

public void startProduction(ImageConsumer  ic) 

Registers the image consumer argument as wanting the image produced by this image producer. In addition, this method forces the image producer to start an immediate reconstruction of the image data. For more information on this method and its arguments, see startProduction.

The startProduction method of FilteredImageSource calls its image filter's getFilterInstance method to creates a new filter instance for the image consumer argument. The resulting filter instance is then passed as an argument to the image producer's startProduction method .

ParameterDescription
ic an image consumer



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