Reputation: 189
A book i'm working on keeps on mentioning storing colour values in 24bit or 8 bit integers. I searched through the java docs but all it mentions is that integer/byte are "32-bit signed two's complement integer/8bit signed".Thanks.
Upvotes: 0
Views: 327
Reputation: 178
The books is talking about how the color information is stored, and how many values it can have.
Integers can be stored in many different sized containers, but the most common in C/C++ (and probably Java?) are:
char
)short
)int
or long
)In your case, 24bit is referring to the fact that it's using 24 bits to store the color information, which gives you 2^24 color values (16,777,216). Similarly an 8 bit color value can store 256 values.
2's comp refers to the method of representing signed values. See: http://en.wikipedia.org/wiki/Two%27s_complement
Color values are generally unsigned, as far as I know, so it doesn't really apply to your question.
Upvotes: 1