encoding of pixels in Javas AWT?
<< Previous question: Access image pixels Next question: Java imaging libraries >> At some places in the AWT, classes use a special encoding to store a pixel as a single int value. This includes PixelGrabber, MemoryImageSource and the methods getRGB and setRGB of the BufferedImage class. In Java, int values are always 32 bits large. ARGB encoding uses a single int value to store four values for red, green, blue and a transparency value (alpha). Each of these four values is eight bits large, allowing for 28 (256) different values from 0 to 255. The intensity of red, green and blue is on a linear scale from not used (0) to fully used (255). The alpha value ranges from 0 for transparent (the pixel itself cannot be seen, only what is behind it) to 255 for opaque (nothing from behind the pixel shines through). Now for the actual encoding. The least signficant eight bits are used by blue, the next eight bits by green, then eight bits for red and the most significant eight bits are used for t