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.
-
rgbModel
- The default color model - useful for comparisons.
-
ImageFilterPlus(ImageProducer)
- Constructor.
-
ImageFilterPlus(ImageProducer, boolean)
- Constructor, with pixel order change.
-
filterStream(InputStream, OutputStream, ImageFilterPlus)
- Filter a PPM InputStream to a PPM OutputStream.
-
getSource()
- Return the ImageProducer for this filter.
-
imageComplete(int)
- This routine fixes a bug in java.awt.image.ImageFilter.
-
setHints(int)
- Set the hint flags.
-
setSource(ImageProducer)
- Set the ImageProducer for this filter, if it wasn't set by the
constructor.
rgbModel
public static final ColorModel rgbModel
- The default color model - useful for comparisons.
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().
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.
getSource
public ImageProducer getSource()
- Return the ImageProducer for this filter.
setSource
public void setSource(ImageProducer producer)
- Set the ImageProducer for this filter, if it wasn't set by the
constructor.
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
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
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