Finally,the color model interpretsapixel'ssamplesasacoloraccordingtoaspecific
Whenyouinvoke getRGB() toobtainapixel'sred,green,blue,and(possibly)alpha
the samples from the data buffer and passes them to the raster, which passes them to
getRGB() . At this point, getRGB() tells the color model to convert the samples to
Whenyouinvoke setRGB() tosetapixel'scolorcomponents,thismethodtellsthe
color model to obtain sample values corresponding to the color components, and then
tells the raster to store these samples. The raster tells the sample model to store the
pixel's samples, and the sample model stores these samples in the data buffer.
of samples (per pixel) must equal the number of color model components.
The java.awt.image package contains a concrete Raster class for describing
read-only rasters, an abstract DataBuffer class for describing data buffers, an ab-
stract SampleModel class for describing sample models, and an abstract Color-
Model class for describing color models. The java.awt.color package contains
anabstract ColorSpace classfordescribingcolorspaces.ConsulttheJavadocument-
ation to learn more about these classes and their subclasses (e.g., Raster 's Writ-
Buffered Image Processing
Image processing is a form of signal processing ( http://en.wikipedia.org/
wiki/Signal_processing ) where mathematical transformations convert digital
images into other digital images. Transformations exist to blur, sharpen, colorize, em-
boss, sepia tone, and apply other kinds of operations to images.
Java 2D lets you process buffered images or their rasters by providing the
java.awt.image.BufferedImageOp and java.awt.image.RasterOp in-
thatperformequivalenttasks),theydifferinthat BufferedImageOp canaccessthe
bufferedimage'scolormodel,whereas RasterOp cannotaccessthecolormodel.Also,
RasterOp issomewhatmoreperformantthan BufferedImageOp ,butisabitmore
involved to work with.