Each pixel has a color. The color is a 32-bit integer. The first eight bits determine the redness of the pixel, the next eight bits the greenness, the next eight bits the blueness, and the remaining eight bits the transparency of the pixel.
|
|
|
|
||||||||||||||||||||||||||||||||
Transparency | Red | Green | Blue |
Each of these values can be interpreted as an unsigned byte between 0 and 255. Within the color higher numbers are brighter. Thus a red of 0 is no red at all while a red of 255 is a very bright red.
Currently Java only supports two levels of transparency: Completely opaque (255) and completely transparent (0). Values of 1 through 254 are treated as completely transparent.
Different colors are made by mixing different levels of the three primary colors. For example, medium gray is 127 red, 127 green, and 127 blue.
255 | 127 | 127 | 127 |
Pure white is 255 red, 255 green, 255 blue.
255 | 255 | 255 | 255 |
Pure red is 255 red, 0 green, 0 blue.
255 | 255 | 0 | 0 |
A light cream is 255 red, 231 green, and 187 blue.
255 | 255 | 231 | 187 |