Finally, Graphics2D combinesthecoloredpixels(sourcepixels)withexistingdes-
tination pixels to form new pixels according to its current composite rule.
Rasterizing and Compositing
andtheimage'scollectionofalphavaluesisknownasits alpha channel .(Alphavalues
also can be expressed as floating-point values ranging from 0.0 through 1.0.)
The rasterizer defaults to choosing alpha values of 255 or 0. Because the resulting
source pixel will either fully cover the existing destination pixel or will not cover this
known as aliasing .
When you specify antialiasing as a rendering hint, the rasterizer slows down some-
what (it has more work to do), but chooses a wider range of alpha values so that
graphics primitives look smoother. This smoothness derives from combining percent-
ages of source and current destination pixel red, green, and blue color components
current destination pixels show through when the new destination pixels are drawn.
The final step in the rendering process involves combining source pixels with des-
tination pixels. This step is carried out according to the current composite rule, which
determines how this combining takes place.
The composite rule takes alpha value percentages into account. For example, the
“source over” rule (which is the most intuitive) combines 100 percent of the source
which happens to be (255-source pixel's alpha value)/255*100.
Consider a source pixel with an alpha of255(it contributes 100percent to the final
Now that you've grasped the basics of the Graphics2D rendering pipeline, you're