I need to create a colorbar like THIS
I use a scaled array of floats between 0 and 1.
Now I want to compute the RGB color from this float. How to do it? Want to write it in C/c++ so I think I need 2 functions.
The first function to build the colorbar with one parameter like STEPSIZE and the second function need the value and must just return the array index of the colorbar.
I couldn’t find it on google, so please help me.
RGB uses bytes, so assuming your array of floats is something like
then you can do:
This will of course only work if the values in the floats are really in the range from
0.0to1.0.