Solved
Pixel data (ARGB) question
Posted on 2004-08-23
Hi guys,
I am currently studying on how Java stores the ARGB of a pixel data into an integer. However, I have a little problem understanding one area. This is it:
According to a certain article, an integer in Java is 32 bits (4 bytes). The first 8 bits store the alpha, the next 8 bits store the red component, the next 8 bits store the green component, and the final 8 bits store the blue component. Now, imagine I have an opaque white color. Does this mean that the integer that store this pixel data can be represented this way in hex: 0xFFFFFFFF? If yes, here comes my problem. How can 0xFFFFFFFF fit into one integer? This value exceeds the limit of an integer value. If I remember correctly, the first bit is always the sign type of the number (0 means positive, 1 means negative). Yet the article claims that "FF" is used for opaque (no transparency) colors.
What is happening?