vis/color/
mg_rgb2index.pro
includes main-level programRoutines
top mg_rgb2index
direct graphics
result = mg_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)
Parameters
- rgb in required type=bytarr
either
bytarr(3)
orbytarr(n, 3)
array of RGB coordinates of colors
Examples
For example:
IDL> print, mg_rgb2index([255, 255, 255]), format='(Z06)' ; white
FFFFFF
IDL> print, mg_rgb2index([255, 255, 0]), format='(Z06)' ; yellow
00FFFF
IDL> print, mg_rgb2index([0, 0, 255]), format='(Z06)' ; blue
FF0000
MG_RGB2INDEX
in an n
by
3 byte array:
IDL> mg_loadct, 5, /brewer
% LOADCT: Loading table PuBu (Sequential)
IDL> tvlct, rgb, /get
IDL> print, mg_rgb2index(rgb), format='(8Z)'
File attributes
Modification date: | Wed May 14 15:07:15 2014 |
Lines: | 22 |
Docformat: | rst rst |
Contact me if you have enhancement requests or bug fixes.