LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning values to the color array of a distribution plot

I want to calculate my own color gradations for a distribution plot in LabView 6.0. However, I can't seem to make the final jump from a RGB value to a color array.
0 Kudos
Message 1 of 4
(2,774 Views)
The color array is of format U32, but only 24 bits are being used to represent an RGB value. The high-order 8 bits are unused, while the remaining 24 bits are used for the Red, Green, and Blue components of the color.

To clarify this, I will give an example.

x00FF0000 would be red.
x0000FF00 would be green.
x000000FF would be blue.

For the color blue:

Unused Byte : 00
Red Component : 00
Green Component: 00
Blue Component : FF

To get a U32 value from your 3 RGB U8 values, use the equation:

U32 = R*2^16 + G*2^8 + B
0 Kudos
Message 2 of 4
(2,774 Views)
Hey Dude;

It turns out that I have a vi similar to what you are looking for. So, I modified it using the equation Matt R. provides in the previous answer and it seems to be working OK. The vi is attached to this message.

Please note the following. First, the VI convert an array where every three consecutive elements are considered the R,G and B components of the desired value, respectively. That mean the size of the original array must be a multiple of three. The value of each element should be a number between 0 and 255, anything else is coerced.

Let me know if this work. Also, if you improve the vi, it will be appreciated if you post the improved vi. Thanks to Matt R. for the equation.

Enrique
www.vartortech.com
0 Kudos
Message 3 of 4
(2,774 Views)
I think I found the information that I was looking for in a "coloring of molecules" article. Attached is a vi that creates color gradients that can be used in various distributions.

I found that it was more intuitive, though, to shift the numbers of the "color values" and to append the numbers rather than add the decimal equivilants.
0 Kudos
Message 4 of 4
(2,774 Views)