Note BufferedImageOp and/or RasterOp implementationsareknownas im-
age operators .Theyarealsoknownas filters becauseeachinterfacedeclaresa fil-
ter() method—filters are used in photography.
The central method of the BufferedImageOp interface is BufferedImage
filter(BufferedImage src, BufferedImage dest) ,which filters (trans-
forms)thecontentsofasource BufferedImage instanceintoresultsthatarestored
in a destination BufferedImage instance. If the color models of both buffered
images don't match, a color conversion into the destination buffered image's color
model is performed. If you pass null to dest , a BufferedImage instance with
an appropriate ColorModel instance is created. This method throws
java.lang.IllegalArgumentException when the source and/or destination
menting this interface.
The central method of the RasterOp interface is WritableRaster fil-
ter(Raster src, WritableRaster dest) , which filters the contents of
a source Raster instance into results that are stored in a destination Writ-
ableRaster instance.Ifyoupass null to dest ,a WritableRaster instanceis
created. This method may throw IllegalArgumentException when the source
implementing this interface.
Note Depending on the implementing class, BufferedImageOp 's and/or
RasterOp 's filter() methodsmayallow in-place filtering wherethesourceand
destination buffered images/rasters are the same.
Java 2D provides five java.awt.image classes that implement both interfaces:
AffineTransformOp , ColorConvertOp , ConvolveOp , LookupOp , and
RescaleOp .Furthermore,thispackageprovidesthe BandCombineOp class,which
only implements RasterOp :
• AffineTransformOp geometrically transforms (e.g., rotates) buffered im-
age colors or raster samples.
• BandCombineOp combines raster sample arrays according to a set of coef-
ficient values. You can use this class to invert the sample equivalent of color
component bands and perform other operations efficiently.
• ColorConvertOp converts buffered image colors/raster samples from one
color space to another.