CONTENTS | PREV | NEXT | Java 2DTM API |
CHAPTER 6 |
Color |
Color imaging is one of the fundamental components of any graphics system, and it is often a source of great complexity in the imaging model. The Java 2DTM API provides support for high-quality color output that is easy to use and allows advanced clients to make sophisticated use of color.The key color management classes in the Java 2D API are ColorSpace, Color, ColorModel:
- A ColorSpace represents a system for measuring colors, typically using three separate numerical values or components. The ColorSpace class contains methods for converting between the color space and two standard color spaces, CI EXYZ and RGB.
- A Color is a fixed color, defined in terms of its components in a particular ColorSpace. To draw a Shape in a color, such as red, you pass a Color object representing that color to the Graphics2D cont ext. Color is defined in the java.awt package.
- A ColorModel describes a particular way that pixel values are mapped to colors. A ColorModel is typically associated with an Image or BufferedImage and provides the information necessary to correctly interpret t he pixel values. ColorModel is defined in the java.awt.image package.