single value color specification

Blitz3D Forums/Blitz3D Beginners Area/single value color specification

Megalomanic(Posted 2007) [#1]
Is there any way specifying a color out of the whole spectrum with a single value instead of RGB (eg. HEX FFFFFF)? I need to give a different color to each value out of a data base. Also vice versa I need to get the data base value out of the color.


Rob Farley(Posted 2007) [#2]
Just set the blue component. If memory serves it's something like colour = (blue Or (green Shl 8) Or (red Shl 16)... I could be wrong though!


Megalomanic(Posted 2007) [#3]
Thanks alot but the right order for RGB to Integer conversation is: value = R + G Shl 8 + B Shl 16, I think.
More interesting is the Integer to RGB conversation. How could I solve it?


Stevie G(Posted 2007) [#4]
See here ..

http://www.blitzbasic.com/codearcs/codearcs.php?code=551


Megalomanic(Posted 2007) [#5]
Thanks! It seams, that helps.


jfk EO-11110(Posted 2007) [#6]
In the early days it was also possibe to use a 24 bit value in the blue parameter of several commands, eg:

EntityColor m,0,0,rgb

This was overwriting the red and green channels. Not sure if this is still working tho.