API documentation for visualization library

Michael Galloy

single page | use frames     summary     class     fields     routine details     file attributes



includes main-level program

top vis_rgb2index

direct graphics

result = vis_rgb2index(rgb)

Convert RGB coordinates of colors to the decomposed color indices of the colors. Color indices are long integers used in decomposed color in direct graphics where the lowest order byte value is the red value, the next byte is the green value, the next byte is the blue value, and the highest order byte value is unused.

Return value

long or lonarr(n)


rgb in required type=bytarr

either bytarr(3) or bytarr(n, 3) array of RGB coordinates of colors


For example:

IDL> print, vis_rgb2index([255, 255, 255]), format='(Z06)' ; white FFFFFF IDL> print, vis_rgb2index([255, 255, 0]), format='(Z06)' ; yellow 00FFFF IDL> print, vis_rgb2index([0, 0, 255]), format='(Z06)' ; blue FF0000
Multiple RGB triplets can also be passed to VIS_RGB2INDEX in an n by 3 byte array:
IDL> vis_loadct, 5, /brewer % LOADCT: Loading table PuBu (Sequential) IDL> tvlct, rgb, /get IDL> print, vis_rgb2index(rgb), format='(8Z)'

File attributes

Modification date: Mon Nov 29 18:33:10 2010
Lines: 65
Docformat: rst rst