Changeset 231 for trunk/SRC/Colors/color24.pro
- Timestamp:
- 03/19/07 18:15:51 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Colors/color24.pro
r163 r231 1 1 ;+ 2 2 ; 3 ; @file_comments 3 ; @file_comments 4 4 ; The purpose of this function is to convert a RGB color triple 5 ; into the equivalent 24-big long integer. 5 ; into the equivalent 24-big long integer. 6 ; This routine was written to be used with routines like COLORS or 7 ; <pro>GETCOLOR</pro>. 6 8 ; 7 ; @categories Graphics, Color 9 ; @categories 10 ; Graphics, Color 8 11 ; 9 ; @param rgb_triple {in}{required} 10 ; A three-element column or row array representing 12 ; @param rgb_triple {in}{required} 13 ; A three-element column or row array representing 11 14 ; a color triple. The values of the elements must be between 0 and 255. 12 15 ; 13 ; @returns 14 ; a 24-bit long integer that is equivalent the input color. 16 ; @returns 17 ; a 24-bit long integer that is equivalent the input color. 15 18 ; The color is described in terms of a hexadecimal number (e.g., FF206A) 16 ; where the left two digits represent the blue color, the 17 ; middle two digits represent the green color, and the right 19 ; where the left two digits represent the blue color, the 20 ; middle two digits represent the green color, and the right 18 21 ; two digits represent the red color. 19 22 ; 20 ; @examples 21 ; To convert the color triple for the color YELLOW, 22 ; (255, 255, 0), to the hexadecimal value '00FFFF'x 23 ; @examples 24 ; To convert the color triple for the color YELLOW, 25 ; (255, 255, 0), to the hexadecimal value '00FFFF'x 23 26 ; or the decimal number 65535, type: 24 27 ; 25 28 ; IDL> color = COLOR24([255, 255, 0]) 26 ; 27 ; This routine was written to be used with routines like COLORS or GETCOLOR 29 ; 28 30 ; 29 31 ; @history 30 32 ; Written by: David Fanning, 3 February 96. 31 33 ; 32 ; @version $Id$ 34 ; @version 35 ; $Id$ 33 36 ; 34 37 ;- … … 36 39 ; 37 40 compile_opt idl2, strictarrsubs 38 ; 41 ; 39 42 ON_ERROR, 1 40 43 … … 51 54 FOR j=0,2 DO num24bit = num24bit + ((rgb_triple[j] MOD 16) * base16[0,j]) + $ 52 55 (Fix(rgb_triple[j]/16) * base16[1,j]) 53 56 54 57 RETURN, num24bit 55 END 58 END
Note: See TracChangeset
for help on using the changeset viewer.