01-29-2009 08:43 AM
Hello,
When I use CW3DGraphLib_CWPlot3DSetFillColor on a plot I created in the uir everything is OK apart that the blue value is in fact the red and vice versa with the red color value.
When I add a new plot using CW3DGraphLib_CWPlots3DAdd and then change the color with CW3DGraphLib_CWPlot3DSetFillColor the displayed color is not the same as when I set the same color value to the plot I created in the uir.
Worse, it is not possible to set the color to white or black. As long as RED, GREEN and BLUE have the same value the result is always light grey.
What did I wrong?
You will find attached a test program that shows this behaviour.
Bertrand
Solved! Go to Solution.
01-30-2009 01:35 PM
Hello Bertrand,
After looking at your code, you are right that the Red and Blue values appear to be swapped. This is because the fillcolor property of the 3DGraph expects an OLE_COLOR, which is merely a 32 bit integer. Unfortunately, the OLE_COLOR type stores the color information differently than the CVI UI library and specifically the MakeColor function do. According to the CVI Help, the return from MakeColor "is a 4-byte integer with the hexadecimal format 0x00RRGGBB. RR, GG, and BB are the respective red, green, and blue components of the color value." However, the OLE_COLOR type stores the color information with the blue and red values swapped - or 0x00BBGGRR. Thus, you will need to swap the blue and red values before you set the fill color if you plan to use the CVI MakeColor function.
As far as your second question is concerned, I'm still investigating the reason for this difference, and will let you know when I find something.
NickB
National Instruments
02-02-2009 10:05 AM - edited 02-02-2009 10:05 AM
Hello Bertrand,
I've found the other setting you need to change to get the fill colors to look right. When you create a new plot, the new plot takes on the properties of the PlotTemplate object. In this case, the default PlotTemplate object has the ColorMapStyle property set to "1 - cwShaded" by default. If you change this to "0 - cwNone", the behavior will match that of your other plot. Please let me know if you have any questions!
NickB
National Instruments
02-02-2009 02:06 PM
Thank you Nick for your help
Bertrand