What would be the correct way of converting color value from float to byte? At first I thought b=f*255.0 should do it, but now I'm thinking, that in this case only the exact 1.0 will be converted to 255, but 0.9999 will already be 254 which is probably not what I want...
It seems that b=f*256.0 would be better except that it would have an unwanted case of making 256 in the case of exact 1.0.
In the end I'm using this:
#define F2B(f) ((f) >= 1.0 ? 255 : (int)((f)*256.0))