Pixel Color Values
In ActionScript, the color values of pixels in bitmaps are stored in 32-bit unsigned integers, providing a vast range of 4,294,967,296 possible color values. Each individual color value in a BitmapData object is conceptually made up of four separate numbers, representing four different color components—Alpha (i.e., transparency), Red, Green, and Blue. These four components are known as color channels. The amount of each channel in a given color ranges from 0 to 255. Accordingly, in binary, each channel occupies 8 of the 32 bits in the color value, as follows: Alpha, bits 24–31 (the most significant byte); Red, bits 16–23; Green, bits 8–15; and Blue, bits 0-7. The higher the value of Red, Green, or Blue, the more each color contributes to the final color. If all three RGB channels are equal, the result is a shade of gray; if they are all 0, the result is black; if they are all 255, the result is white. This 32-bit color format allows for a possible 16,777,216 colors, each with a separate Alpha level between 0 (transparent) and 255 (opaque).
For example, pure red is described by the following channel values:
Alpha: 255, Red: 255, Green: 0, Blue: 0
Those values correspond to the following bit settings in a 32-bit unsigned integer color value (shown with spaces separating the four bytes):
11111111 11111111 00000000 00000000
In decimal, the preceding integer value reads:
Of course, when presented as a single decimal number, the different channels in a color value ...