All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Acme.JPM.Filters.ImageFilterPlus

java.lang.Object
   |
   +----java.awt.image.ImageFilter
           |
           +----Acme.JPM.Filters.ImageFilterPlus

public class ImageFilterPlus
extends ImageFilter
An ImageFilter with some extra features and bug fixes.

You can use an image filter to turn one Image into another via a FilteredImageSource, e.g.:

 Image newImage = comp.createImage( new FilteredImageSource(
     oldImage.getSource(), new SomeFilter( oldImage.getSource() ) ) );
 
Or use the convenient utility JPMUtils.filterImage():
 Image newImage = JPMUtils.filterImage(
     comp, SomeFilter( oldImage.getSource() ) );
 

You can also use image filters from the command line, reading PPM from stdin and writing PPM to stdout, if you add code like the following to each filter:

 System.exit( 
     ImageFilterPlus.filterStream(
         System.in, System.out,
         new SomeFilter( null ) ) );
 

Fetch the software.
Fetch the entire Acme package.


Variable Index

 o rgbModel
The default color model - useful for comparisons.

Constructor Index

 o ImageFilterPlus(ImageProducer)
Constructor.
 o ImageFilterPlus(ImageProducer, boolean)
Constructor, with pixel order change.

Method Index

 o filterStream(InputStream, OutputStream, ImageFilterPlus)
Filter a PPM InputStream to a PPM OutputStream.
 o getSource()
Return the ImageProducer for this filter.
 o imageComplete(int)
This routine fixes a bug in java.awt.image.ImageFilter.
 o setHints(int)
Set the hint flags.
 o setSource(ImageProducer)
Set the ImageProducer for this filter, if it wasn't set by the constructor.

Variables

 o rgbModel
 public static final ColorModel rgbModel
The default color model - useful for comparisons.

Constructors

 o ImageFilterPlus
 public ImageFilterPlus(ImageProducer producer)
Constructor.

Parameters:
producer - The ImageProducer is required, so that we can remove ourself from its consumers list when we're done. However, if you don't have the producer available when you want to create the filter, you can pass in null and set it later via setSource().
 o ImageFilterPlus
 public ImageFilterPlus(ImageProducer producer,
                        boolean pixelOrderChanges)
Constructor, with pixel order change.

Parameters:
producer - The ImageProducer is required, so that we can remove ourself from its consumers list when we're done. However, if you don't have the producer available when you want to create the filter, you can pass in null and set it later via setSource().
pixelOrderChanges - If the filter may output pixels in a different order from the one they were delivered in, this flag must be set.

Methods

 o getSource
 public ImageProducer getSource()
Return the ImageProducer for this filter.

 o setSource
 public void setSource(ImageProducer producer)
Set the ImageProducer for this filter, if it wasn't set by the constructor.

 o setHints
 public void setHints(int hintflags)
Set the hint flags. If the pixel order may change, we have to turn off the TOPDOWNLEFTRIGHT flag; otherwise the flags are passed through unmodified.

Overrides:
setHints in class ImageFilter
 o imageComplete
 public void imageComplete(int status)
This routine fixes a bug in java.awt.image.ImageFilter. All ImageConsumers are required remove themselves from the producer's list when they're done reading. If they don't do this then some producers will generate an error. The standard ImageFilter class fails to do this, but this one does it.

Overrides:
imageComplete in class ImageFilter
 o filterStream
 public static int filterStream(InputStream in,
                                OutputStream out,
                                ImageFilterPlus filter)
Filter a PPM InputStream to a PPM OutputStream.

Create the filter with a null producer, and this routine will fill it in for you.

Returns:
a status code suitable for use with System.exit().

All Packages  Class Hierarchy  This Package  Previous  Next  Index

ACME Java  ACME Labs