quote:
Originally posted by CookieRevised
Though, the actual color used by windows consists of 4 individual values. so instead of a maximum of FFFFFF (hexadecimal) you can have FFFFFFFF (hexadecimal), or a maximum of 32bits. But the principle is just the same of course...
the 8 extra bits are used for transparency (alpha channel) so at the end you still have 24 bits.
quote:
Originally posted by CookieRevised
go from -32767 to +32767 [...] So, a signed 32bits number goes from -2^31+1 to +2^31-1, thus from -2147483647 to +2147483647
actually signed numbers stored with n bits go from -2^(n-1) to 2^(n-1) - 1, ie: from -32768 to 32767 and from -2147483648 to 2147483647 for 16 and 32 bits
quote:
Originally posted by CookieRevised
Now, instead of storing the number as a signed number and then calculate the unsigned number from it when you read it again, you could also store it directly as a unsigned number of course. There are functions for that in each programming language, thus including C++
I'd use that signed (and maybe negative) number to store the color and wouldn't change/convert it. You don't have to worry about what number it saves, you just know that the same that saves you can read it later and will be a valid number that represents a color (or whatever other thing you want to save).,