Until this point, we’ve confined ourselves to working with the high-level drawing
commands of the
Graphics2D class, using
hands-off mode. In this section, we’ll clear up some of the mystery surrounding images
and see how they can be created and transformed. The classes in the
java.awt.image package handle images and their internals;
Figure 21-1 shows the important
classes in this package.
First, we’ll return to our discussion of image loading and see how we can get more
control over image data using an
watch as it’s processed asynchronously by GUI components. We’ll also see how to use the
MediaTracker utility to handle the details for
us. Then, we’ll move on to the good stuff and have a look at
BufferedImage, which is an image whose pixel data is exposed to you
through a memory buffer. If you’re interested in creating sophisticated graphics,
rendered images, or video, this will teach you about the foundations of image
construction in Java.
A few notes before we move on: Prior to Java 1.2, creating and modifying images was
only possible through the
ImageConsumer interfaces, which, along with
ImageObserver, provide low-level, stream-oriented views of
the image data. We won’t be covering image producers and consumers in this chapter;
instead, we’ll stick to the new APIs, which are more capable and easier to use in most
Looking in the other directions, we will also be referring occasionally ...