#

| Chapter 22 java.awt.image Reference |

# FilteredImageSource

## Name

FilteredImageSource

##

## Description

The `FilteredImageSource` class acts as glue to put an original `ImageProducer` and `ImageFilter` together to create a new image. As the `ImageProducer` for the new image, `FilteredImageSource` is responsible for registering image consumers for the new image.

## Class Definition

    public class java.awt.image.FilteredImageSource
        extends java.lang.Object
        implements java.awt.image.ImageProducer {
      // Constructors
      public FilteredImageSource (ImageProducer original,
          ImageFilter filter);
      // Instance Methods
      public synchronized void addConsumer (ImageConsumer ic);
      public synchronized boolean isConsumer (ImageConsumer ic);
      public synchronized void removeConsumer (ImageConsumer ic);
      public void requestTopDownLeftRightResend (ImageConsumer ic);
      public void startProduction (ImageConsumer ic);
    }

## Constructors

### FilteredImageSource

#### public FilteredImageSource (ImageProducer original, ImageFilter filter)

Parameters

  original

    An `ImageProducer` that generates the image to be filtered.

  filter

    The `ImageFilter` to use to process image data delivered by `original`.

Description

  Constructs a `FilteredImageSource` object to filter an image generated by an `ImageProducer`.

## Class Methods

### addConsumer

#### public synchronized void addConsumer (ImageConsumer ic)

Parameters

  ic

    `ImageConsumer` interested in receiving the new image.

Implements

  `ImageProducer.addConsumer(``ImageConsumer``)`

Description

  Registers an `ImageConsumer` as interested in `Image` information.

### isConsumer

#### public synchronized boolean isConsumer (ImageConsumer ic)

Parameters

  ic

    `ImageConsumer` to check.

Returns

  `true` if `ImageConsumer` is registered with this `ImageProducer`, `false` otherwise.

Implements

  `ImageProducer.isConsumer(``ImageConsumer``)`

### removeConsumer

#### public synchronized void removeConsumer (ImageConsumer ic)

Parameters

  ic

    `ImageConsumer` to remove.

Implements

  `ImageProducer.removeConsumer(``ImageConsumer``)`

Description

  Removes an `ImageConsumer` from the registered consumers for this `ImageProducer`.

### requestTopDownLeftRightResend

#### public void requestTopDownLeftRightResend (ImageConsumer ic)

Parameters

  ic

    `ImageConsumer` to communicate with.

Implements

  `ImageProducer.requestTopDownLeftRightResend()`

Description

  Requests the retransmission of the `Image` data in top-down, left-to-right order.

### startProduction

#### public void startProduction (ImageConsumer ic)

Parameters

  ic

    `ImageConsumer` to communicate with.

Implements

  `ImageProducer.startProduction(``ImageConsumer``)`

Description

  Registers `ImageConsumer` as interested in `Image` information and tells `ImageProducer` to start creating the filtered `Image` data immediately.

## See Also

`ImageFilter`, `ImageConsumer`, `ImageProducer`, `Object`

DirectColorModel |  | ImageConsumer