Packages  This Package  Prev  Next  Index  

§2.4 Class FilteredImageSource

public  class  java.awt.image.FilteredImageSource
    extends  java.lang.Object  (I-§1.12)
    implements java.awt.image.ImageProducer  (II-§2.12)
{
        // Constructors
    public FilteredImageSource(ImageProducer  orig,	§2.4.1
                         ImageFilter  imgf);

        // Methods
    public void addConsumer(ImageConsumer  ic);	§2.4.2
    public boolean isConsumer(ImageConsumer  ic);	§2.4.3
    public void removeConsumer(ImageConsumer  ic);	§2.4.4
    public void 	§2.4.5
        requestTopDownLeftRightResend(ImageConsumer  ic);
    public void startProduction(ImageConsumer  ic);	§2.4.6
}
A filtered image source is an implementation of the image producer interface (II-§2.12) which takes an existing image and an image filter (II-§2.5) 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 §2.9 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 (II-§2.5).

Parameters:
orig - an existing image producer
imgf - an image filter

Methods

addConsumer

public void addConsumer(ImageConsumer ic)
Registers the image consumer (II-§2.10) argument as wanting th image produced by this image producer. For more information on this method and its arguments, see §2.12.1 on page 313.


The addConsumer method of FilteredImageSource calls its image filter's getFilterInstance method (II-§2.5.4) 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 (II-§2.12.1).

Parameters:
ic - an image consumer

isConsumer

public boolean isConsumer(ImageConsumer ic)
Parameters:
ic - an image consumer
Returns:
true if the specified image consumer argument (II-§2.10) is currently registered with this image producer as one of its consumers; false otherwise.

removeConsumer

public void removeConsumer(ImageConsumer ic)
Removes the specified image consumer (II-§2.10) 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 §2.12.3 on page 314.


The removeConsumer method of FilteredImageSource calls its image producer's removeConsumer method (II-§2.12.3) with the image filter than was created when this image consumer was first registered (§2.4.2, §2.4.6).

Parameters:
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 §2.12.4 on page 314.


The requestTopDownLeftRightResend method of FilteredImageSource calls its image producer's requestTopDownLeftRightResent method (II-§2.12.4) with the image filter than was created when this image consumer was first registered (§2.4.2, §2.4.6).

Parameters:
ic - an image consumer

startProduction

public void startProduction(ImageConsumer ic)
Registers the image consumer (II-§2.10) 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 §2.12.5 on page 314.


The startProduction method of FilteredImageSource calls its image filter's getFilterInstance method (II-§2.5.4) 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 (II-§2.12.5).

Parameters:
ic - an image consumer

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