
CHAPTER 18
Thejava.awt.image Package
The java.awt.image package contains classes and interfaces for manipulating images.
Note that the java.awt.Image class itself is not part of this package. In Java 1.0 and
Java 1.1, the image processing model was optimized for streaming image data
loaded over a network and processed on the fly. It involved the ImageProducer,
ImageConsumer, and ImageObser ver inter faces and the ImageF ilter class. This image-pro-
cessing model is complex and difficult to use. Much of it has been superseded in
Java 1.2.
In Java 2D, the image-processing model has been extended (and simplified) to
accommodate image data that is stored and manipulated in memory. The key
pieces of this new image-processing model are the BufferedImage class, which rep-
resents an image in memory, and the BufferedImageOp inter face, which repr esents
an image-processing operation. Every BufferedImage contains a Raster object that
hold the pixels of the image and a ColorModel object that can interpret those pixel
values as Color objects. A Raster object, in turn, contains a DataBuffer that holds the
raw image data and a SampleModel object that knows how to extract pixel values
fr om that raw data.
Figur e 18-1 shows the class hierarchy of this package. See Chapter 4, Graphics
with AWT and Java 2D, for a discussion of images and image processing.
AffineTransfor mOp Ja va 1.2
java.awt.image
This class is a