WoColorConvert Function
Convert from a long RGB value to an index into the current color table, or from an index in the current color table to an RGB value.
Usage
result = WoColorConvert(color)
Input Parameters
color — The input RGB value or color index.
Returned Value
The returned value depends on the type of system and the keyword parameters that are used. Return values for some typical systems are shown in Return Values for Common Systems.
System and Keyword |
Returned Value |
8-bit systems with either keyword |
Return value is the same as the input color value. |
24-bit system with /ColorToIndex keyword |
Returns a color table index. |
24-bit system with /IndexToColor keyword |
Returns a long RGB value. |
Keywords
ColorToIndex — If nonzero, converts an RGB value to a color table index.
IndexToColor — If nonzero, converts a color table index to an RGB value. This is the default if no keyword is set.
Discussion
WoColorConvert ensures that a selected color (e.g., in a VDA Tool application) looks the same on 8-bit and 24-bit dispays.
The ColorToIndex and IndexToColor keywords are mutually exclusive.
The color conversion only occurs on 24-bit systems; the original color index is returned for other display types.
Example
The following PLOT command uses WoColorConvert to convert the plot color so that it works properly on a 24-bit display.
color = 4
seed=2
PLOT, RANDOMN(seed,20), Color=WoColorConvert(color, $
/IndexToColor)