Changeset 136 for trunk/SRC/Colors


Ignore:
Timestamp:
07/10/06 17:20:19 (18 years ago)
Author:
pinsard
Message:

some improvements and corrections in some .pro file according to
aspell and idldoc log file

Location:
trunk/SRC/Colors
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Colors/color24.pro

    r134 r136  
    77; @categories Graphics, Color Specification. 
    88; 
    9 ; @param RGB_TRIPLE {in}{required} A three-element column or row array representing  
    10 ;       a color triple. The values of the elements must be between  
    11 ;       0 and 255. 
     9; @param rgb_triple {in}{required}  
     10; A three-element column or row array representing  
     11; a color triple. The values of the elements must be between 0 and 255. 
    1212; 
    13 ; @returns a 24-bit long integer that is equivalent the input color.  
    14 ; The color is 
    15 ; described in terms of a hexidecimal number (e.g., FF206A) 
     13; @returns  
     14; a 24-bit long integer that is equivalent the input color.  
     15; The color is described in terms of a hexadecimal number (e.g., FF206A) 
    1616; where the left two digits represent the blue color, the  
    1717; middle two digits represent the green color, and the right  
    1818; two digits represent the red color. 
    1919; 
    20 ; @examples To convert the color triple for the color YELLOW,  
    21 ;       (255, 255, 0), to the hexadecimal value '00FFFF'x  
    22 ;       or the decimal number 65535, type: 
     20; @examples  
     21; To convert the color triple for the color YELLOW,  
     22; (255, 255, 0), to the hexadecimal value '00FFFF'x  
     23; or the decimal number 65535, type: 
    2324; 
    24 ;       color = COLOR24([255, 255, 0]) 
     25; IDL> color = COLOR24([255, 255, 0]) 
    2526;        
    26 ;       This routine was written to be used with routines like  
    27 ;       COLORS or GETCOLOR 
     27; This routine was written to be used with routines like COLORS or GETCOLOR 
    2828; 
    2929; @history 
     
    3333; 
    3434;- 
    35 FUNCTION COLOR24, number 
     35FUNCTION COLOR24, rgb_triple 
    3636; 
    3737  compile_opt idl2, strictarrsubs 
     
    3939ON_ERROR, 1 
    4040 
    41 IF N_ELEMENTS(number) NE 3 THEN $ 
    42    MESSAGE, 'Augument must be a three-element vector.' 
     41IF N_ELEMENTS(rgb_triple) NE 3 THEN $ 
     42   MESSAGE, 'Argument must be a three-element vector.' 
    4343 
    44 IF MAX(number) GT 255 OR MIN(number) LT 0 THEN $ 
     44IF MAX(rgb_triple) GT 255 OR MIN(rgb_triple) LT 0 THEN $ 
    4545   MESSAGE, 'Argument values must be in range of 0-255' 
    4646 
     
    4949num24bit = 0L 
    5050 
    51 FOR j=0,2 DO num24bit = num24bit + ((number[j] MOD 16) * base16[0,j]) + $ 
    52    (Fix(number[j]/16) * base16[1,j]) 
     51FOR j=0,2 DO num24bit = num24bit + ((rgb_triple[j] MOD 16) * base16[0,j]) + $ 
     52   (Fix(rgb_triple[j]/16) * base16[1,j]) 
    5353    
    5454RETURN, num24bit 
  • trunk/SRC/Colors/colorbar.pro

    r134 r136  
    11;+ 
    22; 
    3 ; @file_comments  
     3; @file_comments 
    44; The purpose of this routine is to add a color bar to the current 
    55; graphics window. 
     
    77; @categories Graphics, Widgets. 
    88; 
    9 ; @keyword BOTTOM The lowest color index of the colors to be loaded in 
    10 ;                 the bar. 
    11 ; 
    12 ; @keyword CB_CHARSIZE The character size of the color bar annotations. Default is 1.0. 
    13 ; 
    14 ; @keyword CB_CHARTICK The character thick of the color bar annotations. Default is 1.0. 
    15 ; 
    16 ; @keyword CB_COLOR The color index of the bar outline and characters. Default 
    17 ;                 is ncolors - 1 + bottom. 
    18 ; 
    19 ; @keyword CB_LOG to get logarithmic scale for the colorbar 
    20 ; 
    21 ; @keyword CB_TITLE This is title for the color bar. The default is to have 
    22 ;                 no title. 
    23 ; 
    24 ; @keyword DISCRETE Vector which contain color's indexes to trace in a color bar. Therefore 
    25 ;               we obtain a discreet color bar which only contains specified colors in  
    26 ;               order where they appear in the vector 
    27 ; 
    28 ; @keyword DIVISIONS The number of divisions to divide the bar into. There will 
    29 ;                 be (divisions + 1) annotations. The default is 2. 
    30 ; 
    31 ; @keyword FORMAT The format of the bar annotations. Default is '(F6.2)'. 
    32 ; 
    33 ; @keyword CB_LABEL It is a vector who specifie sticks's value attend in the color bar. 
    34 ;                It allowes, when we use DISCREET, to have colors which don't increase  
    35 ;                by increments in a regular way. 
    36 ; 
    37 ; @keyword MAX The maximum data value for the bar annotation. Default is 
    38 ;                 NCOLORS-1. 
    39 ; 
    40 ; @keyword MIN The minimum data value for the bar annotation. Default is 0. 
    41 ; 
    42 ; @keyword NCOLOR This is the number of colors in the color bar. 
    43 ; 
    44 ; @keyword NOTITLE Force to don't writte title even if CB_TITLE is declarerd. 
    45 ; 
    46 ; @keyword POSITION A four-element array of normalized coordinates in the same 
    47 ;                 form as the POSITION keyword on a plot. Default is 
    48 ;                 [0.88, 0.15, 0.95, 0.95] for a vertical bar and 
    49 ;                 [0.15, 0.88, 0.95, 0.95] for a horizontal bar. 
    50 ; 
    51 ; @keyword PSCOLOR This keyword is only applied if the output is being sent to 
    52 ;                 a PostScript file. It indicates that the PostScript device 
    53 ;                 is configured for color output. If this keyword is set, then 
    54 ;                 the annotation is drawn in the color specified by the COLOR 
    55 ;                 keyword. If the keyword is not set, the annotation is drawn 
    56 ;                 in the color specified by the !P.COLOR system variable 
    57 ;                 (usually this will be the color black). In general, this 
    58 ;                 gives better looking output on non-color or gray-scale 
    59 ;                 printers. If you are not specifically setting the annotation 
    60 ;                 color (with the COLOR keyword), it will probably 
    61 ;                 be better NOT to set this keyword either, even if you 
    62 ;                 are outputting to a color PostScript printer. 
    63 ; 
    64 ; @keyword RIGHT This puts the labels on the right-hand side of a vertical 
    65 ;                 color bar. It applies only to vertical color bars. 
    66 ; 
    67 ; @keyword TOP This puts the labels on top of the bar rather than under it. 
    68 ;                 The keyword only applies if a horizontal color bar is rendered. 
    69 ; 
    70 ; @keyword VERTICAL Setting this keyword give a vertical color bar. The default 
    71 ;                 is a horizontal color bar. 
    72 ; 
    73 ; @restrictions Color bar is drawn in the current graphics window. 
    74 ; 
    75 ; @restrictions The number of colors available on the display device (not the 
    76 ;       PostScript device) is used unless the NCOLORS keyword is used. 
    77 ; 
    78 ; @examples To display a horizontal color bar above a contour plot, type: 
    79 ; 
    80 ;       IDL> LOADCT, 5, NCOLORS=100 
    81 ;       IDL> CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $ 
    82 ;       IDL> C_COLORS=INDGEN(25)*4, NLEVELS=25 
    83 ;       IDL> COLORBAR, NCOLORS=100 
     9; @keyword BOTTOM 
     10; The lowest color index of the colors to be loaded in the bar. 
     11; 
     12; @keyword CB_CHARSIZE {default=1.0} 
     13; The character size of the color bar annotations. 
     14; 
     15; @keyword CB_CHARTHICK {default=1.0} 
     16; The character thick of the color bar annotations. 
     17; 
     18; @keyword CB_COLOR {default=ncolors - 1 + bottom} 
     19; The color index of the bar outline and characters. 
     20; 
     21; @keyword CB_LOG 
     22; to get logarithmic scale for the colorbar 
     23; 
     24; @keyword CB_TITLE 
     25; This is title for the color bar. The default is to have no title. 
     26; 
     27; @keyword DISCRETE 
     28; Vector which contain color's indexes to trace in a color bar. Therefore 
     29; we obtain a discreet color bar which only contains specified colors in 
     30; order where they appear in the vector 
     31; 
     32; @keyword DIVISIONS {default=2} 
     33; The number of divisions to divide the bar into. 
     34; There will be (divisions + 1) annotations. 
     35; 
     36; @keyword FORMAT {default='(F6.2)'} 
     37; The format of the bar annotations. 
     38; 
     39; @keyword CB_LABEL 
     40; It is a vector who specifies sticks's value attend in the color bar. 
     41; It allowes, when we use DISCREET, to have colors which don't increase 
     42; by increments in a regular way. 
     43; 
     44; @keyword MAX {default=NCOLORS - 1} 
     45; The maximum data value for the bar annotation. 
     46; 
     47; @keyword MIN {default=0} 
     48; The minimum data value for the bar annotation. 
     49; 
     50; @keyword NCOLORS 
     51; This is the number of colors in the color bar. 
     52; 
     53; @keyword NOTITLE 
     54; Force to don't write title even if CB_TITLE is declared. 
     55; 
     56; @keyword POSITION 
     57; A four-element array of normalized coordinates in the same 
     58; form as the POSITION keyword on a plot. Default is 
     59; [0.88, 0.15, 0.95, 0.95] for a vertical bar and 
     60; [0.15, 0.88, 0.95, 0.95] for a horizontal bar. 
     61; 
     62; @keyword PSCOLOR 
     63; This keyword is only applied if the output is being sent to 
     64; a Postscript file. It indicates that the Postscript device 
     65; is configured for color output. If this keyword is set, then 
     66; the annotation is drawn in the color specified by the COLOR 
     67; keyword. If the keyword is not set, the annotation is drawn 
     68; in the color specified by the !P.COLOR system variable 
     69; (usually this will be the color black). In general, this 
     70; gives better looking output on non-color or gray-scale 
     71; printers. If you are not specifically setting the annotation 
     72; color (with the COLOR keyword), it will probably 
     73; be better NOT to set this keyword either, even if you 
     74; are outputting to a color Postscript printer. 
     75; 
     76; @keyword RIGHT 
     77; This puts the labels on the right-hand side of a vertical 
     78; color bar. It applies only to vertical color bars. 
     79; 
     80; @keyword TOP 
     81; This puts the labels on top of the bar rather than under it. 
     82; The keyword only applies if a horizontal color bar is rendered. 
     83; 
     84; @keyword VERTICAL 
     85; Setting this keyword give a vertical color bar. 
     86; The default is a horizontal color bar. 
     87; 
     88; @restrictions 
     89; Color bar is drawn in the current graphics window. 
     90; 
     91; @restrictions 
     92; The number of colors available on the display device (not the 
     93; Postscript device) is used unless the NCOLORS keyword is used. 
     94; 
     95; @examples 
     96; To display a horizontal color bar above a contour plot, type: 
     97; 
     98; IDL> LOADCT, 5, NCOLORS=100 
     99; IDL> CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $ 
     100; IDL> C_COLORS=INDGEN(25)*4, NLEVELS=25 
     101; IDL> COLORBAR, NCOLORS=100 
    84102; 
    85103; @history Written by: David Fanning, 10 JUNE 96. 
    86 ;       10/27/96: Added the ability to send output to PostScript. DWF 
    87 ;       11/4/96: Substantially rewritten to go to screen or PostScript 
    88 ;           file without having to know much about the PostScript device 
     104;       10/27/96: Added the ability to send output to Postscript. DWF 
     105;       11/4/96: Substantially rewritten to go to screen or Postscript 
     106;           file without having to know much about the Postscript device 
    89107;           or even what the current graphics device is. DWF 
    90108;       1/27/97: Added the RIGHT and TOP keywords. Also modified the 
     
    93111;            no valid data range in them. DWF 
    94112;       3/3/98:  ajout du keyword discret par 
    95 ;                sebastien (smasson@lodyc.jussieu.fr) 
     113;            sebastien (smasson\@lodyc.jussieu.fr) 
    96114; 
    97115; @version $Id$ 
    98116; 
    99117;- 
    100  
    101 PRO COLORBAR, BOTTOM=bottom, CB_CHARSIZE=cb_charsize, CB_CHARTHICK=cb_charthick $ 
     118PRO COLORBAR, BOTTOM=bottom, CB_CHARSIZE=cb_charsize, $ 
     119              CB_CHARTHICK=cb_charthick $ 
    102120              , CB_COLOR=cb_color, $ 
    103121              DIVISIONS=divisions, DISCRETE=discrete,CB_LABEL = cb_label, $ 
    104               FORMAT=format, POSITION=position, MAX=max, MIN=min, NCOLORS=ncolors, $ 
    105               PSCOLOR=pscolor, CB_TITLE=cb_title, VERTICAL=vertical, TOP=top, RIGHT=right, CB_LOG = CB_log, _extra = ex 
    106                                 ; Is the PostScript device selected? 
     122              FORMAT=format, POSITION=position, MAX=max, MIN=min, $ 
     123              NCOLORS=ncolors, $ 
     124              PSCOLOR=pscolor, CB_TITLE=cb_title, NOTITLE=notitle, $ 
     125              VERTICAL=vertical, $ 
     126              TOP=top, RIGHT=right, CB_LOG = CB_log, _extra = ex 
     127                                ; Is the Postscript device selected? 
    107128; 
    108129  compile_opt idl2, strictarrsubs 
     
    175196      IF KEYWORD_SET(discrete) THEN begin 
    176197         facteur=256/n_elements(discrete) 
    177          discrete=reform(replicate(1,facteur) # discrete,facteur*n_elements(discrete), /overwrite)  
     198         discrete=reform(replicate(1,facteur) # discrete,facteur*n_elements(discrete), /overwrite) 
    178199         bar = REPLICATE(1B,10) # discrete 
    179200      endif else  bar = REPLICATE(1B,10) # BINDGEN(256) 
     
    182203      IF KEYWORD_SET(discrete) THEN begin 
    183204         facteur=256/n_elements(discrete) 
    184          discrete=reform(replicate(1,facteur) # discrete,facteur*n_elements(discrete), /overwrite)  
     205         discrete=reform(replicate(1,facteur) # discrete,facteur*n_elements(discrete), /overwrite) 
    185206         bar =  discrete # REPLICATE(1B,10) 
    186207      endif else bar = BINDGEN(256) # REPLICATE(1B, 10) 
  • trunk/SRC/Colors/getcolor.pro

    r134 r136  
    1212; same where color decomposition is turned on or off. 
    1313; 
    14 ;       (The 16 supported colors in GETCOLOR come from the McIDAS color 
    15 ;       table offered on the IDL newsgroup by Liam Gumley.) 
     14; (The 16 supported colors in GETCOLOR come from the McIDAS color 
     15; table offered on the IDL newsgroup by Liam Gumley.) 
    1616; 
    1717; @categories Graphics, Color Specification. 
    1818; 
    19 ; @param thisColor {in}{optional} A string with the "name" of the color. Valid names are: 
     19; @param thisColor {in}{optional}  
     20; A string with the "name" of the color. Valid names are: 
    2021;           black 
    2122;           magenta 
     
    4647;           IDL 5.2 or higher. 
    4748; 
    48 ; @param index {in}{optional} The color table index where the specified color should be loaded. 
     49; @param index {in}{optional}  
     50; The color table index where the specified color should be loaded. 
    4951;           If this parameter is passed, then the return value of the function is the 
    5052;           index number and not the color triple. (If color decomposition is turned 
     
    6264;           TVLCT, colors, 100 
    6365; 
    64 ; @keyword NAMES If this keyword is set, the return value of the function is 
    65 ;              a 16-element string array containing the names of the colors. 
    66 ;              These names would be appropriate, for example, in building 
    67 ;              a list widget with the names of the colors. If the NAMES 
    68 ;              keyword is set, the COLOR and INDEX parameters are ignored. 
    69 ; 
    70 ;                 listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16) 
    71 ; 
    72 ; @keyword LOAD  If this keyword is set, all 16 colors are automatically loaded 
    73 ;              starting at the color index specified by the START keyword. 
    74 ;              Note that setting this keyword means that the return value of the 
    75 ;              function will be a structure, with each field of the structure 
    76 ;              corresponding to a color name. The value of each field will be 
    77 ;              an index number (set by the START keyword) corresponding to the 
    78 ;              associated color, or a 24-bit long integer value that creates the 
    79 ;              color on a true-color device. What you have as the field values is 
    80 ;              determined by the TRUE keyword or whether color decomposition is on 
    81 ;              or off in the absense of the TRUE keyword. It will either be a 1-by-3 
    82 ;              byte array or a long integer value. 
    83 ; 
    84 ; @keyword START The starting color index number if the LOAD keyword is set. This keyword 
    85 ;              value is ignored unless the LOAD keyword is also set. The keyword is also 
    86 ;              ignored if the TRUE keyword is set or if color decomposition in on in 
    87 ;              IDL 5.2 and higher. The default value for the START keyword is 
    88 ;              !D.TABLE_SIZE - 17. 
    89 ; 
    90 ; @keyword TRUE  If this keyword is set, the specified color triple is returned 
    91 ;              as a 24-bit integer equivalent. The lowest 8 bits correspond to 
    92 ;              the red value; the middle 8 bits to the green value; and the 
    93 ;              highest 8 bits correspond to the blue value. In IDL 5.2 and higher, 
    94 ;              if color decomposition is turned on, it is as though this keyword 
    95 ;              were set. 
    96 ; 
    97 ; @restrictions The TRUE keyword causes the START keyword to be ignored. 
    98 ;       The NAMES keyword causes the COLOR, INDEX, START, and TRUE parameters to be ignored. 
    99 ;       The COLOR parameter is ignored if the LOAD keyword is used. 
    100 ;       On systems where it is possible to tell the state of color decomposition 
    101 ;       (i.e., IDL 5.2 and higher), a 24-bit value (or values) is automatically 
    102 ;       returned if color decomposition is ON. 
    103 ; 
    104 ;  
    105 ; @examples To load a yellow color in color index 100 and plot in yellow, type: 
    106 ; 
    107 ;          IDL> yellow = GETCOLOR('yellow', 100) 
    108 ;          IDL> PLOT, data, COLOR=yellow 
     66; @keyword NAMES  
     67; If this keyword is set, the return value of the function is 
     68; a 16-element string array containing the names of the colors. 
     69; These names would be appropriate, for example, in building 
     70; a list widget with the names of the colors. If the NAMES 
     71; keyword is set, the COLOR and INDEX parameters are ignored. 
     72; 
     73; listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16) 
     74; 
     75; @keyword LOAD   
     76; If this keyword is set, all 16 colors are automatically loaded 
     77; starting at the color index specified by the START keyword. 
     78; Note that setting this keyword means that the return value of the 
     79; function will be a structure, with each field of the structure 
     80; corresponding to a color name. The value of each field will be 
     81; an index number (set by the START keyword) corresponding to the 
     82; associated color, or a 24-bit long integer value that creates the 
     83; color on a true-color device. What you have as the field values is 
     84; determined by the TRUE keyword or whether color decomposition is on 
     85; or off in the absence of the TRUE keyword. It will either be a 1-by-3 
     86; byte array or a long integer value. 
     87; 
     88; @keyword START {default=!D.TABLE_SIZE - 17} 
     89; The starting color index number if the LOAD keyword is set. This keyword 
     90; value is ignored unless the LOAD keyword is also set. The keyword is also 
     91; ignored if the TRUE keyword is set or if color decomposition in on in 
     92; IDL 5.2 and higher. The default value for the START keyword is 
     93; 
     94; @keyword TRUE   
     95; If this keyword is set, the specified color triple is returned 
     96; as a 24-bit integer equivalent. The lowest 8 bits correspond to 
     97; the red value; the middle 8 bits to the green value; and the 
     98; highest 8 bits correspond to the blue value. In IDL 5.2 and higher, 
     99; if color decomposition is turned on, it is as though this keyword 
     100; were set. 
     101; 
     102; @restrictions  
     103; The TRUE keyword causes the START keyword to be ignored. 
     104; The NAMES keyword causes the COLOR, INDEX, START, and TRUE parameters to be  
     105; ignored. 
     106; The COLOR parameter is ignored if the LOAD keyword is used. 
     107; On systems where it is possible to tell the state of color decomposition 
     108; (i.e., IDL 5.2 and higher), a 24-bit value (or values) is automatically 
     109; returned if color decomposition is ON. 
     110; 
     111; @examples  
     112; To load a yellow color in color index 100 and plot in yellow, type: 
     113; 
     114; IDL> yellow = GETCOLOR('yellow', 100) 
     115; IDL> PLOT, data, COLOR=yellow 
    109116; 
    110117;       or, 
    111118; 
    112 ;          IDL> PLOT, data, COLOR=GETCOLOR('yellow', 100) 
    113 ; 
    114 ;       To do the same thing on a 24-bit color system with decomposed color on, type: 
    115 ; 
    116 ;          IDL> PLOT, data, COLOR=GETCOLOR('yellow', /TRUE) 
     119; IDL> PLOT, data, COLOR=GETCOLOR('yellow', 100) 
     120; 
     121; To do the same thing on a 24-bit color system with decomposed color on, type: 
     122; 
     123; IDL> PLOT, data, COLOR=GETCOLOR('yellow', /TRUE) 
    117124; 
    118125;       or in IDL 5.2 and higher, 
    119126; 
    120 ;          IDL> DEVICE, Decomposed=1 
    121 ;          IDL> PLOT, data, COLOR=GETCOLOR('yellow') 
    122 ; 
    123 ;       To load all 16 colors into the current color table, starting at 
    124 ;       color index 200, type: 
    125 ; 
    126 ;          IDL> TVLCT, GETCOLOR(), 200 
    127 ; 
    128 ;       To add the color names to a list widget: 
    129 ; 
    130 ;           IDL> listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16) 
    131 ; 
    132 ;       To load all 16 colors and have the color indices returned in a structure: 
    133 ; 
    134 ;           IDL> DEVICE, Decomposed=0 
    135 ;           IDL> colors = GetColor(/Load, Start=1) 
    136 ;           IDL> HELP, colors, /Structure 
    137 ;           PLOT, data, COLOR=colors.yellow 
    138 ; 
    139 ;       To get the direct color values as 24-bit integers in color structure fields: 
    140 ; 
    141 ;           IDL> DEVICE, Decomposed=1 
    142 ;           IDL> colors = GetColor(/Load) 
    143 ;           IDL> PLOT, data, COLOR=colors.yellow 
    144 ; 
    145 ;       Note that the START keyword value is ignored if on a 24-bit device, 
    146 ;       so it is possible to write completely device-independent code by 
    147 ;       writing code like this: 
    148 ; 
    149 ;           IDL> colors = GetColor(/Load) 
    150 ;           IDL> PLOT, data, Color=colors.yellow;           IDL> DEVICE, Decomposed=0 
    151 ;           IDL> colors = GetColor(/Load, Start=1) 
    152 ;           IDL> HELP, colors, /Structure 
    153 ;           PLOT, data, COLOR=colors.yellow 
    154 ; 
    155 ;       To get the direct color values as 24-bit integers in color structure fields: 
    156 ; 
    157 ;           IDL> DEVICE, Decomposed=1 
    158 ;           IDL> colors = GetColor(/Load) 
    159 ;           IDL> PLOT, data, COLOR=colors.yellow 
    160 ; 
    161 ;       Note that the START keyword value is ignored if on a 24-bit device, 
    162 ;       so it is possible to write completely device-independent code by 
    163 ;       writing code like this: 
    164 ; 
    165 ;           IDL> colors = GetColor(/Load) 
    166 ;           IDL> PLOT, data, Color=colors.yellow 
     127; IDL> DEVICE, Decomposed=1 
     128; IDL> PLOT, data, COLOR=GETCOLOR('yellow') 
     129; 
     130; To load all 16 colors into the current color table, starting at 
     131; color index 200, type: 
     132; 
     133; IDL> TVLCT, GETCOLOR(), 200 
     134; 
     135; To add the color names to a list widget: 
     136; 
     137; IDL> listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16) 
     138; 
     139; To load all 16 colors and have the color indexes returned in a structure: 
     140; 
     141; IDL> DEVICE, Decomposed=0 
     142; IDL> colors = GetColor(/Load, Start=1) 
     143; IDL> HELP, colors, /Structure 
     144; PLOT, data, COLOR=colors.yellow 
     145; 
     146; To get the direct color values as 24-bit integers in color structure fields: 
     147; 
     148; IDL> DEVICE, Decomposed=1 
     149; IDL> colors = GetColor(/Load) 
     150; IDL> PLOT, data, COLOR=colors.yellow 
     151; 
     152; Note that the START keyword value is ignored if on a 24-bit device, 
     153; so it is possible to write completely device-independent code by 
     154; writing code like this: 
     155; 
     156; IDL> colors = GetColor(/Load) 
     157; IDL> PLOT, data, Color=colors.yellow;           IDL> DEVICE, Decomposed=0 
     158; IDL> colors = GetColor(/Load, Start=1) 
     159; IDL> HELP, colors, /Structure 
     160; IDL> PLOT, data, COLOR=colors.yellow 
     161; 
     162; To get the direct color values as 24-bit integers in color structure fields: 
     163; 
     164; IDL> DEVICE, Decomposed=1 
     165; IDL> colors = GetColor(/Load) 
     166; IDL> PLOT, data, COLOR=colors.yellow 
     167; 
     168; Note that the START keyword value is ignored if on a 24-bit device, 
     169; so it is possible to write completely device-independent code by 
     170; writing code like this: 
     171; 
     172; IDL> colors = GetColor(/Load) 
     173; IDL> PLOT, data, Color=colors.yellow 
    167174; 
    168175; @history Written by: David Fanning, 10 February 96. 
     
    171178;       Added the INDEX parameter to the program 8 Mar 99. DWF 
    172179;       Added the NAMES keyword at insistence of Martin Schultz. 10 Mar 99. DWF 
    173 ;       Reorderd the colors so black is first and white is last. 7 June 99. DWF 
     180;       Reordered the colors so black is first and white is last. 7 June 99. DWF 
    174181;       Added automatic recognition of DECOMPOSED=1 state. 7 June 99. DWF 
    175182;       Added LOAD AND START keywords. 7 June 99. DWF. 
     
    292299colorIndex = WHERE(names EQ thisColor) 
    293300 
    294    ; If you can't find it. Issue an infomational message, 
     301   ; If you can't find it. Issue an informational message, 
    295302   ; set the index to a YELLOW color, and continue. 
    296303 
  • trunk/SRC/Colors/lct.pro

    r134 r136  
    1212; 
    1313; @keyword LIGHTNESS a scalar used to change the Lightness of the color 
    14 ;            palette to be abble to adjust according to the printer we use, 
     14;            palette to be able to adjust according to the printer we use, 
    1515;            the media (paper or slide)...  
    1616;               lightness < 1 to get lighter colors 
     
    2222; 
    2323; @keyword GET_NAME Set this keyword to a named variable in which the names of the color tables 
    24 ;          are reurned as a string array. No changes are made to the color table. 
     24;          are returned as a string array. No changes are made to the color table. 
    2525; 
    2626; @keyword _EXTRA Used to pass your keywords 
     
    2828; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 
    2929;          30/3/1999: add extra 
    30 ;          6/7/1999: mac/windows comptibility 
     30;          6/7/1999: mac/windows compatibility 
    3131; 
    3232; @version $Id$ 
     
    4343; definition of the name of the file containing colors palettes. 
    4444   if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl' 
    45 ; What is the full adress of nametbl? 
     45; What is the full address of nametbl? 
    4646   thisOS = strupcase(strmid(!version.os_family, 0, 3)) 
    4747   CASE thisOS of 
  • trunk/SRC/Colors/newpalette.pro

    r134 r136  
    1111; @categories graphic, color specification 
    1212; 
    13 ; @param namepal {in}{required} It is a string containing the name of the new palettte we want to write. 
     13; @param namepal {in}{required}  
     14; It is a string containing the name of the new palette we want to write. 
    1415; 
    15 ; @keyword  OVER It is a whole number which designate the number of the palette 
    16 ;               we want to replace the palette on the screen  
     16; @keyword OVER  
     17; It is a whole number which designate the number of the palette 
     18; we want to replace the palette on the screen  
    1719; 
    18 ; @keyword FILE {default=palette.tbl} is not specified, we are looking  a file containing  
    19 ;             palettes named palette.tbl. 
    20 ;              This file can be in any directory of the !path 
    21 ;              On the other hand it must be writable 
     20; @keyword FILE {default=palette.tbl}  
     21; if not specified, we are looking a file containing palettes named palette.tbl. 
     22; This file can be in any directory of the !path 
     23; On the other hand it must be writable 
    2224; 
    23 ; @keyword _extra Used to pass your keywords 
     25; @keyword _extra  
     26; Used to pass your keywords 
    2427; 
    2528; @history Guillaume Roulet (gr@lodyc.jussieu.fr) 
    26 ;                       30/3/1999 s.masson, add _extra, research of the full name, OVER 
     29; 30/3/1999 s.masson, add _extra, research of the full name, OVER 
    2730;                       5/5/1999 s.masson 
    2831; 
  • trunk/SRC/Colors/xlct.pro

    r134 r136  
    383383;               this ID is specified, a death of the caller results in a  
    384384;               death of Xlct 
    385 ; @keyword NCOLORS = number of colors to use.  Use color indices from BOTTOM 
     385; @keyword NCOLORS = number of colors to use.  Use color indexes from BOTTOM 
    386386;               to the smaller of !D.TABLE_SIZE-1 and NCOLORS-1. 
    387387;               Default = !D.TABLE_SIZE = all available colors. 
    388 ; @keyword BOTTOM = first color index to use. Use color indices from BOTTOM to 
     388; @keyword BOTTOM = first color index to use. Use color indexes from BOTTOM to 
    389389;               BOTTOM+NCOLORS-1.  Default = 0. 
    390390; @keyword SILENT - Normally, no informational message is printed when 
  • trunk/SRC/Colors/xpal.pro

    r134 r136  
    11;+ 
    22; 
    3 ; @file_comments  
    4 ; like xpalette but shorter to write and ,moreover, 
     3; @file_comments 
     4; like xpalette but shorter to write and, moreover, 
    55; possess a hotkey save which (thanks to the newpalette routine) 
    66; allows to save the routine that we have just done. Comment: when we 
    7 ; press the predefined hotkey, it calls xlct instead of xloadct  
     7; press the predefined hotkey, it calls xlct instead of xloadct 
    88; No explicit inputs.  The current color table is used as a starting point. 
    99; 
    1010; @categories Color tables, widgets. 
    1111; 
    12 ; @keyword BLOCK Set this keyword to have XMANAGER block when this 
    13 ;               application is registered.  By default the Xmanager 
    14 ;               keyword NO_BLOCK is set to 1 to provide access to the 
    15 ;               command line if active command  line processing is available. 
    16 ;               Note that setting BLOCK for this application will cause 
    17 ;               all widget applications to block, not only this 
    18 ;               application.  For more information see the NO_BLOCK keyword 
    19 ;               to XMANAGER. 
    20 ; @keyword UPDATECALLBACK Set this keyword to a string containing the name of 
    21 ;               a user-supplied procedure that will be called when the color 
    22 ;               table is updated by XLOADCT.  The procedure may optionally 
    23 ;               accept a keyword called DATA, which will be automatically 
    24 ;               set to the value specified by the optional UPDATECBDATA 
    25 ;               keyword. 
    26 ; @keyword UPDATECBDATA Set this keyword to a value of any type. It will be 
    27 ;               passed via the DATA keyword to the user-supplied procedure 
    28 ;               specified via the UPDATECALLBACK keyword, if any. If the 
    29 ;               UPDATECBDATA keyword is not set the value accepted by the 
    30 ;               DATA keyword to the procedure specified by UPDATECALLBACK 
    31 ;               will be undefined. 
    32 ; 
    33 ; @uses COLORS: Contains the current RGB color tables. 
    3412; @uses XP_COM: Private to this module. 
    3513; 
    36 ; @restrictions XPAL uses two colors from the current color table as 
    37 ;       drawing foreground and background colors. These are used 
    38 ;       for the RGB plots on the left, and the current index marker on 
    39 ;       the right. This means that if the user set these two colors 
    40 ;       to the same value, the XPAL display could become unreadable 
    41 ;       (like writing on black paper with black ink). XPAL minimizes 
    42 ;       this possibility by noting changes to the color map and always 
    43 ;       using the brightest available color for the foreground color 
    44 ;       and the darkest for the background. Thus, the only way 
    45 ;       to make XPAL's display unreadable is to set the entire color 
    46 ;       map to a single color, which is highly unlikely. The only side 
    47 ;       effect of this policy is that you may notice XPAL redrawing 
    48 ;       the entire display after you've modified the current color. 
    49 ;       This simply means that the change has made XPAL pick new 
    50 ;       drawing colors. 
    51 ; 
    52 ;       The new color tables are saved in the COLORS common and loaded 
    53 ;       to the display. 
    54 ; 
    55 ; @examples The XPAL widget has the following controls: 
     14; @restrictions 
     15; XPAL uses two colors from the current color table as 
     16; drawing foreground and background colors. These are used 
     17; for the RGB plots on the left, and the current index marker on 
     18; the right. This means that if the user set these two colors 
     19; to the same value, the XPAL display could become unreadable 
     20; (like writing on black paper with black ink). XPAL minimizes 
     21; this possibility by noting changes to the color map and always 
     22; using the brightest available color for the foreground color 
     23; and the darkest for the background. Thus, the only way 
     24; to make XPAL's display unreadable is to set the entire color 
     25; map to a single color, which is highly unlikely. The only side 
     26; effect of this policy is that you may notice XPAL redrawing 
     27; the entire display after you've modified the current color. 
     28; This simply means that the change has made XPAL pick new 
     29; drawing colors. 
     30; 
     31; The new color tables are saved in the COLORS common and loaded 
     32; to the display. 
     33; 
     34; @examples 
     35; The XPAL widget has the following controls: 
    5636; 
    5737;       Left:   Three plots showing the current Red, Green, and Blue vectors. 
     
    10686;                        3) The name of the file containing palettes. 
    10787;                        Comment: May follow instructions gave by the prompter. 
    108 ;                 
     88; 
    10989; 
    11090;       Three sliders (R, G, and B) that allow the user to modify the 
     
    125105;                          horizontally. 
    126106; 
    127 ; @history addaptation de xpalette pour ajouter un bouton save par 
    128 ;          Gima Nicolas (nglod@ipsl.jussieu.fr) et par Masson 
    129 ;          Sebastien (smlod@ipsl.jussieu.fr) 
     107; @history adaptation de xpalette pour ajouter un bouton save par 
     108;          Grima Nicolas (nglod\@ipsl.jussieu.fr) et par Masson 
     109;          Sebastien (smlod\@ipsl.jussieu.fr) 
    130110; 
    131111; $Id$ 
     
    134114; 
    135115;+ 
    136 ; @file_comments XP_NEW_COLORS: Choose the best foreground and background colors for the current 
    137 ;                color maps and set !P appropriately. Returns 1 if the colors changed, 
    138 ;                0 otherwise. 
    139 ; 
    140 ; @returns 1 or 0 
    141 ;-  
     116; @file_comments 
     117; XP_NEW_COLORS: Choose the best foreground and background colors for 
     118; the current color maps and set !P appropriately. 
     119; 
     120; @returns 
     121; 1 if the colors changed, 0 otherwise. 
     122;- 
    142123function XP_NEW_COLORS 
    143124; 
     
    162143end 
    163144 
     145;+ 
     146; @hidden 
     147;- 
    164148pro XP_ALERT_CALLER 
    165149; 
     
    187171end 
    188172;+ 
    189 ; @file_comments XP_XLCTCALLBACK:  For visuals with static colormaps, update the graphics 
    190 ;                after a change by XLOADCT. 
     173; @file_comments 
     174; XP_XLCTCALLBACK:  For visuals with static colormaps, update the graphics 
     175; after a change by XLOADCT. 
    191176;- 
    192177pro XP_XLCTCALLBACK 
     
    201186end 
    202187 
     188;+ 
     189; @hidden 
     190;- 
    203191pro XP_REDRAW 
    204192; 
     
    216204 
    217205;+ 
    218 ; @file_comments XP_REPLOT: Re-draw the RGB plots. Type has the following possible values. 
     206; @file_comments 
     207; XP_REPLOT: Re-draw the RGB plots. Type has the following possible values. 
    219208;       - 'D': Draw the data part of all three plots 
    220209;       - 'F': draw all three plots 
     
    222211;       - 'G': Draw the data part of the Green plot 
    223212;       - 'B': Draw the data part of the Blue plot 
    224 ;-  
     213;- 
    225214pro XP_REPLOT, color_index, type 
    226215; 
     
    240229  save_x_s = !x.s 
    241230  save_y_s = !y.s 
    242   save_x_type = !x.type  
    243   save_y_type = !y.type  
     231  save_x_type = !x.type 
     232  save_y_type = !y.type 
    244233 
    245234  !y.margin= [2, 2] 
     
    435424 
    436425      7: goto, do_copy 
    437       8: BEGIN  
     426      8: BEGIN 
    438427         COMMON basecommon,  bas212, bas222,  bas232 
    439428         base = WIDGET_BASE(/COLUMN, /FRAME) 
     
    476465  THEN BEGIN 
    477466    CASE uval OF 
    478      'ok' :BEGIN  
     467     'ok' :BEGIN 
    479468        WIDGET_CONTROL, bas212, GET_VALUE = palname 
    480469        WIDGET_CONTROL, bas222, GET_VALUE = over 
     
    541530;+ 
    542531; 
    543 ; @keyword group  
    544 ; 
    545 ; @keyword BLOCK Set this keyword to have XMANAGER block when this 
    546 ;               application is registered.  By default the Xmanager 
    547 ;               keyword NO_BLOCK is set to 1 to provide access to the 
    548 ;               command line if active command  line processing is available. 
    549 ;               Note that setting BLOCK for this application will cause 
    550 ;               all widget applications to block, not only this 
    551 ;               application.  For more information see the NO_BLOCK keyword 
    552 ;               to XMANAGER. 
    553 ; @keyword UPDATECALLBACK Set this keyword to a string containing the name of 
    554 ;               a user-supplied procedure that will be called when the color 
    555 ;               table is updated by XLOADCT.  The procedure may optionally 
    556 ;               accept a keyword called DATA, which will be automatically 
    557 ;               set to the value specified by the optional UPDATECBDATA 
    558 ;               keyword. 
    559 ; @keyword UPDATECBDATA Set this keyword to a value of any type. It will be 
    560 ;               passed via the DATA keyword to the user-supplied procedure 
    561 ;               specified via the UPDATECALLBACK keyword, if any. If the 
    562 ;               UPDATECBDATA keyword is not set the value accepted by the 
    563 ;               DATA keyword to the procedure specified by UPDATECALLBACK 
    564 ;               will be undefined. 
    565 ; 
    566 ;- 
    567  
    568  
    569  
     532; @keyword group 
     533; 
     534; @keyword BLOCK 
     535; Set this keyword to have XMANAGER block when this 
     536; application is registered.  By default the Xmanager 
     537; keyword NO_BLOCK is set to 1 to provide access to the 
     538; command line if active command line processing is available. 
     539; Note that setting BLOCK for this application will cause 
     540; all widget applications to block, not only this 
     541; application.  For more information see the NO_BLOCK keyword 
     542; to XMANAGER. 
     543; 
     544; @keyword UPDATECALLBACK 
     545; Set this keyword to a string containing the name of 
     546; a user-supplied procedure that will be called when the color 
     547; table is updated by XLOADCT.  The procedure may optionally 
     548; accept a keyword called DATA, which will be automatically 
     549; set to the value specified by the optional UPDATECBDATA 
     550; keyword. 
     551; 
     552; @keyword UPDATECBDATA 
     553; Set this keyword to a value of any type. It will be 
     554; passed via the DATA keyword to the user-supplied procedure 
     555; specified via the UPDATECALLBACK keyword, if any. If the 
     556; UPDATECBDATA keyword is not set the value accepted by the 
     557; DATA keyword to the procedure specified by UPDATECALLBACK 
     558; will be undefined. 
     559; 
     560;- 
    570561pro XPAL, group=group, BLOCK=block, UPDATECALLBACK=updt_cb_name, $ 
    571562        UPDATECBDATA=updt_cb_data 
     
    584575 
    585576  xpw = { xp_widgets, base:0L, $ 
    586         colorsel:0L, mark_label:0L, idx_label:0L, button_base:0L, rgb_base:0L} 
     577  colorsel:0L, mark_label:0L, idx_label:0L, button_base:0L, rgb_base:0L} 
    587578 
    588579  state = {old_p:!p, $                     ; Original value of !P 
    589            mark_idx:0, $                   ; Current mark index 
    590            cur_idx:0, $                    ; Current index 
    591            cur_color_win:0, $              ; Current Color draw window index 
    592            plot_win:0, $                   ; RGB plot draw window index 
    593            updt_callback: updt_callback, $ ; user-defined callback (optional) 
    594            p_updt_cb_data:p_updt_cb_data}  ; data for callback (optional) 
     580   mark_idx:0, $                   ; Current mark index 
     581   cur_idx:0, $                    ; Current index 
     582   cur_color_win:0, $              ; Current Color draw window index 
     583   plot_win:0, $                   ; RGB plot draw window index 
     584   updt_callback: updt_callback, $ ; user-defined callback (optional) 
     585   p_updt_cb_data:p_updt_cb_data}  ; data for callback (optional) 
    595586 
    596587  if (XREGISTERED('XPAL')) then return      ; Only one copy at a time 
     
    610601  save_win = !d.window          ;Previous window 
    611602 
    612   IF N_ELEMENTS(r_orig) LE 0 THEN BEGIN ;If no common, use current colors 
    613         TVLCT, r_orig, g_orig, b_orig, /GET 
    614         r_curr = r_orig 
    615         b_curr = b_orig 
    616         g_curr = g_orig 
    617         ENDIF 
     603  IF N_ELEMENTS(r_orig) LE 0 THEN BEGIN ;If no common, use current colors 
     604   TVLCT, r_orig, g_orig, b_orig, /GET 
     605   r_curr = r_orig 
     606   b_curr = b_orig 
     607   g_curr = g_orig 
     608  ENDIF 
    618609 
    619610  ; Create widgets 
     
    631622 
    632623  c1 = WIDGET_BASE(xpw.base, /COLUMN, space=20) 
    633     status = WIDGET_BASE(c1, /COLUMN, /FRAME) 
    634       ncw = WIDGET_LABEL(WIDGET_BASE(status), /DYNAMIC_RESIZE) 
    635       xpw.idx_label = CW_FIELD(status, title='Current Index: ', value='0', $ 
    636                                xsize=20, /STRING) 
    637       xpw.mark_label = CW_FIELD(status, title='Mark Index:    ', value='0', $ 
    638                                 xsize=20, /STRING) 
    639       c1_1 = widget_base(status, /ROW) 
    640         junk = WIDGET_LABEL(c1_1, value="Current Color: ") 
    641           cur_color = WIDGET_DRAW(c1_1, xsize = 125, ysize=50, /frame) 
    642     names = [ 'Done', 'Predefined', 'Help', 'Redraw', 'Set Mark', $ 
    643                 'Switch Mark', 'Copy Current', 'Interpolate', 'save'] 
    644     xpw.button_base = CW_BGROUP(c1, names, COLUMN=3, /FRAME) 
    645     xpw.rgb_base = CW_RGBSLIDER(c1, /FRAME, /DRAG) 
    646  
    647     junk = WIDGET_BASE(xpw.base)        ; Responds to YOFFSET 
     624  status = WIDGET_BASE(c1, /COLUMN, /FRAME) 
     625  ncw = WIDGET_LABEL(WIDGET_BASE(status), /DYNAMIC_RESIZE) 
     626  xpw.idx_label = CW_FIELD(status, title='Current Index: ', value='0', $ 
     627  xsize=20, /STRING) 
     628  xpw.mark_label = CW_FIELD(status, title='Mark Index:    ', value='0', $ 
     629  xsize=20, /STRING) 
     630  c1_1 = widget_base(status, /ROW) 
     631  junk = WIDGET_LABEL(c1_1, value="Current Color: ") 
     632  cur_color = WIDGET_DRAW(c1_1, xsize = 125, ysize=50, /frame) 
     633  names = [ 'Done', 'Predefined', 'Help', 'Redraw', 'Set Mark', $ 
     634  'Switch Mark', 'Copy Current', 'Interpolate', 'save'] 
     635  xpw.button_base = CW_BGROUP(c1, names, COLUMN=3, /FRAME) 
     636  xpw.rgb_base = CW_RGBSLIDER(c1, /FRAME, /DRAG) 
     637 
     638  junk = WIDGET_BASE(xpw.base)        ; Responds to YOFFSET 
    648639    if (version.style='Motif') then junk2=30 else junk2 = 50 
    649640    xpw.colorsel = CW_COLORSEL(junk, yoffset=junk2) 
    650  
    651641 
    652642  state.cur_idx = 0 
     
    658648 
    659649  WIDGET_CONTROL, ncw, $ 
    660         set_value='Number Of Colors: ' + strcompress(!d.n_colors, /REMOVE_ALL) 
     650 set_value='Number Of Colors: ' + strcompress(!d.n_colors, /REMOVE_ALL) 
    661651  WIDGET_CONTROL, get_value=tmp, cur_color 
    662652  state.cur_color_win = tmp 
     
    672662 
    673663  XMANAGER, 'Xpal', xpw.base, event_handler='XP_EVENT', group=group, $ 
    674         NO_BLOCK=(NOT(FLOAT(block))) 
    675 end 
    676  
     664  NO_BLOCK=(NOT(FLOAT(block))) 
     665end 
     666 
Note: See TracChangeset for help on using the changeset viewer.