Changeset 136 for trunk/SRC/Colors
- Timestamp:
- 07/10/06 17:20:19 (18 years ago)
- Location:
- trunk/SRC/Colors
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Colors/color24.pro
r134 r136 7 7 ; @categories Graphics, Color Specification. 8 8 ; 9 ; @param RGB_TRIPLE {in}{required} A three-element column or row array representing10 ; a color triple. The values of the elements must be between11 ; 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. 12 12 ; 13 ; @returns a 24-bit long integer that is equivalent the input color.14 ; The color is15 ; 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) 16 16 ; where the left two digits represent the blue color, the 17 17 ; middle two digits represent the green color, and the right 18 18 ; two digits represent the red color. 19 19 ; 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: 23 24 ; 24 ; 25 ; IDL> color = COLOR24([255, 255, 0]) 25 26 ; 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 28 28 ; 29 29 ; @history … … 33 33 ; 34 34 ;- 35 FUNCTION COLOR24, number35 FUNCTION COLOR24, rgb_triple 36 36 ; 37 37 compile_opt idl2, strictarrsubs … … 39 39 ON_ERROR, 1 40 40 41 IF N_ELEMENTS( number) NE 3 THEN $42 MESSAGE, 'A ugument must be a three-element vector.'41 IF N_ELEMENTS(rgb_triple) NE 3 THEN $ 42 MESSAGE, 'Argument must be a three-element vector.' 43 43 44 IF MAX( number) GT 255 OR MIN(number) LT 0 THEN $44 IF MAX(rgb_triple) GT 255 OR MIN(rgb_triple) LT 0 THEN $ 45 45 MESSAGE, 'Argument values must be in range of 0-255' 46 46 … … 49 49 num24bit = 0L 50 50 51 FOR j=0,2 DO num24bit = num24bit + (( number[j] MOD 16) * base16[0,j]) + $52 (Fix( number[j]/16) * base16[1,j])51 FOR j=0,2 DO num24bit = num24bit + ((rgb_triple[j] MOD 16) * base16[0,j]) + $ 52 (Fix(rgb_triple[j]/16) * base16[1,j]) 53 53 54 54 RETURN, num24bit -
trunk/SRC/Colors/colorbar.pro
r134 r136 1 1 ;+ 2 2 ; 3 ; @file_comments 3 ; @file_comments 4 4 ; The purpose of this routine is to add a color bar to the current 5 5 ; graphics window. … … 7 7 ; @categories Graphics, Widgets. 8 8 ; 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 84 102 ; 85 103 ; @history Written by: David Fanning, 10 JUNE 96. 86 ; 10/27/96: Added the ability to send output to Post Script. DWF87 ; 11/4/96: Substantially rewritten to go to screen or Post Script88 ; file without having to know much about the Post Script device104 ; 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 89 107 ; or even what the current graphics device is. DWF 90 108 ; 1/27/97: Added the RIGHT and TOP keywords. Also modified the … … 93 111 ; no valid data range in them. DWF 94 112 ; 3/3/98: ajout du keyword discret par 95 ; sebastien (smasson@lodyc.jussieu.fr)113 ; sebastien (smasson\@lodyc.jussieu.fr) 96 114 ; 97 115 ; @version $Id$ 98 116 ; 99 117 ;- 100 101 PRO COLORBAR, BOTTOM=bottom, CB_CHARSIZE=cb_charsize,CB_CHARTHICK=cb_charthick $118 PRO COLORBAR, BOTTOM=bottom, CB_CHARSIZE=cb_charsize, $ 119 CB_CHARTHICK=cb_charthick $ 102 120 , CB_COLOR=cb_color, $ 103 121 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? 107 128 ; 108 129 compile_opt idl2, strictarrsubs … … 175 196 IF KEYWORD_SET(discrete) THEN begin 176 197 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) 178 199 bar = REPLICATE(1B,10) # discrete 179 200 endif else bar = REPLICATE(1B,10) # BINDGEN(256) … … 182 203 IF KEYWORD_SET(discrete) THEN begin 183 204 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) 185 206 bar = discrete # REPLICATE(1B,10) 186 207 endif else bar = BINDGEN(256) # REPLICATE(1B, 10) -
trunk/SRC/Colors/getcolor.pro
r134 r136 12 12 ; same where color decomposition is turned on or off. 13 13 ; 14 ; 15 ; 14 ; (The 16 supported colors in GETCOLOR come from the McIDAS color 15 ; table offered on the IDL newsgroup by Liam Gumley.) 16 16 ; 17 17 ; @categories Graphics, Color Specification. 18 18 ; 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: 20 21 ; black 21 22 ; magenta … … 46 47 ; IDL 5.2 or higher. 47 48 ; 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. 49 51 ; If this parameter is passed, then the return value of the function is the 50 52 ; index number and not the color triple. (If color decomposition is turned … … 62 64 ; TVLCT, colors, 100 63 65 ; 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 109 116 ; 110 117 ; or, 111 118 ; 112 ; 113 ; 114 ; 115 ; 116 ; 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) 117 124 ; 118 125 ; or in IDL 5.2 and higher, 119 126 ; 120 ; 121 ; 122 ; 123 ; 124 ; 125 ; 126 ; 127 ; 128 ; 129 ; 130 ; 131 ; 132 ; To load all 16 colors and have the color indices returned in a structure:133 ; 134 ; 135 ; 136 ; 137 ; 138 ; 139 ; 140 ; 141 ; 142 ; 143 ; 144 ; 145 ; 146 ; 147 ; 148 ; 149 ; 150 ; 151 ; 152 ; 153 ; 154 ; 155 ; 156 ; 157 ; 158 ; 159 ; 160 ; 161 ; 162 ; 163 ; 164 ; 165 ; 166 ; 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 167 174 ; 168 175 ; @history Written by: David Fanning, 10 February 96. … … 171 178 ; Added the INDEX parameter to the program 8 Mar 99. DWF 172 179 ; Added the NAMES keyword at insistence of Martin Schultz. 10 Mar 99. DWF 173 ; Reorder d the colors so black is first and white is last. 7 June 99. DWF180 ; Reordered the colors so black is first and white is last. 7 June 99. DWF 174 181 ; Added automatic recognition of DECOMPOSED=1 state. 7 June 99. DWF 175 182 ; Added LOAD AND START keywords. 7 June 99. DWF. … … 292 299 colorIndex = WHERE(names EQ thisColor) 293 300 294 ; If you can't find it. Issue an info mational message,301 ; If you can't find it. Issue an informational message, 295 302 ; set the index to a YELLOW color, and continue. 296 303 -
trunk/SRC/Colors/lct.pro
r134 r136 12 12 ; 13 13 ; @keyword LIGHTNESS a scalar used to change the Lightness of the color 14 ; palette to be ab ble to adjust according to the printer we use,14 ; palette to be able to adjust according to the printer we use, 15 15 ; the media (paper or slide)... 16 16 ; lightness < 1 to get lighter colors … … 22 22 ; 23 23 ; @keyword GET_NAME Set this keyword to a named variable in which the names of the color tables 24 ; are re urned 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. 25 25 ; 26 26 ; @keyword _EXTRA Used to pass your keywords … … 28 28 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 29 29 ; 30/3/1999: add extra 30 ; 6/7/1999: mac/windows comp tibility30 ; 6/7/1999: mac/windows compatibility 31 31 ; 32 32 ; @version $Id$ … … 43 43 ; definition of the name of the file containing colors palettes. 44 44 if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl' 45 ; What is the full ad ress of nametbl?45 ; What is the full address of nametbl? 46 46 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 47 47 CASE thisOS of -
trunk/SRC/Colors/newpalette.pro
r134 r136 11 11 ; @categories graphic, color specification 12 12 ; 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. 14 15 ; 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 17 19 ; 18 ; @keyword FILE {default=palette.tbl} is not specified, we are looking a file containing19 ; 20 ; 21 ; 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 22 24 ; 23 ; @keyword _extra Used to pass your keywords 25 ; @keyword _extra 26 ; Used to pass your keywords 24 27 ; 25 28 ; @history Guillaume Roulet (gr@lodyc.jussieu.fr) 26 ; 29 ; 30/3/1999 s.masson, add _extra, research of the full name, OVER 27 30 ; 5/5/1999 s.masson 28 31 ; -
trunk/SRC/Colors/xlct.pro
r134 r136 383 383 ; this ID is specified, a death of the caller results in a 384 384 ; death of Xlct 385 ; @keyword NCOLORS = number of colors to use. Use color ind ices from BOTTOM385 ; @keyword NCOLORS = number of colors to use. Use color indexes from BOTTOM 386 386 ; to the smaller of !D.TABLE_SIZE-1 and NCOLORS-1. 387 387 ; Default = !D.TABLE_SIZE = all available colors. 388 ; @keyword BOTTOM = first color index to use. Use color ind ices from BOTTOM to388 ; @keyword BOTTOM = first color index to use. Use color indexes from BOTTOM to 389 389 ; BOTTOM+NCOLORS-1. Default = 0. 390 390 ; @keyword SILENT - Normally, no informational message is printed when -
trunk/SRC/Colors/xpal.pro
r134 r136 1 1 ;+ 2 2 ; 3 ; @file_comments 4 ; like xpalette but shorter to write and ,moreover,3 ; @file_comments 4 ; like xpalette but shorter to write and, moreover, 5 5 ; possess a hotkey save which (thanks to the newpalette routine) 6 6 ; 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 8 8 ; No explicit inputs. The current color table is used as a starting point. 9 9 ; 10 10 ; @categories Color tables, widgets. 11 11 ; 12 ; @keyword BLOCK Set this keyword to have XMANAGER block when this13 ; application is registered. By default the Xmanager14 ; keyword NO_BLOCK is set to 1 to provide access to the15 ; command line if active command line processing is available.16 ; Note that setting BLOCK for this application will cause17 ; all widget applications to block, not only this18 ; application. For more information see the NO_BLOCK keyword19 ; to XMANAGER.20 ; @keyword UPDATECALLBACK Set this keyword to a string containing the name of21 ; a user-supplied procedure that will be called when the color22 ; table is updated by XLOADCT. The procedure may optionally23 ; accept a keyword called DATA, which will be automatically24 ; set to the value specified by the optional UPDATECBDATA25 ; keyword.26 ; @keyword UPDATECBDATA Set this keyword to a value of any type. It will be27 ; passed via the DATA keyword to the user-supplied procedure28 ; specified via the UPDATECALLBACK keyword, if any. If the29 ; UPDATECBDATA keyword is not set the value accepted by the30 ; DATA keyword to the procedure specified by UPDATECALLBACK31 ; will be undefined.32 ;33 ; @uses COLORS: Contains the current RGB color tables.34 12 ; @uses XP_COM: Private to this module. 35 13 ; 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: 56 36 ; 57 37 ; Left: Three plots showing the current Red, Green, and Blue vectors. … … 106 86 ; 3) The name of the file containing palettes. 107 87 ; Comment: May follow instructions gave by the prompter. 108 ; 88 ; 109 89 ; 110 90 ; Three sliders (R, G, and B) that allow the user to modify the … … 125 105 ; horizontally. 126 106 ; 127 ; @history ad daptation de xpalette pour ajouter un bouton save par128 ; G ima Nicolas (nglod@ipsl.jussieu.fr) et par Masson129 ; 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) 130 110 ; 131 111 ; $Id$ … … 134 114 ; 135 115 ;+ 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 ;- 142 123 function XP_NEW_COLORS 143 124 ; … … 162 143 end 163 144 145 ;+ 146 ; @hidden 147 ;- 164 148 pro XP_ALERT_CALLER 165 149 ; … … 187 171 end 188 172 ;+ 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. 191 176 ;- 192 177 pro XP_XLCTCALLBACK … … 201 186 end 202 187 188 ;+ 189 ; @hidden 190 ;- 203 191 pro XP_REDRAW 204 192 ; … … 216 204 217 205 ;+ 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. 219 208 ; - 'D': Draw the data part of all three plots 220 209 ; - 'F': draw all three plots … … 222 211 ; - 'G': Draw the data part of the Green plot 223 212 ; - 'B': Draw the data part of the Blue plot 224 ;- 213 ;- 225 214 pro XP_REPLOT, color_index, type 226 215 ; … … 240 229 save_x_s = !x.s 241 230 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 244 233 245 234 !y.margin= [2, 2] … … 435 424 436 425 7: goto, do_copy 437 8: BEGIN 426 8: BEGIN 438 427 COMMON basecommon, bas212, bas222, bas232 439 428 base = WIDGET_BASE(/COLUMN, /FRAME) … … 476 465 THEN BEGIN 477 466 CASE uval OF 478 'ok' :BEGIN 467 'ok' :BEGIN 479 468 WIDGET_CONTROL, bas212, GET_VALUE = palname 480 469 WIDGET_CONTROL, bas222, GET_VALUE = over … … 541 530 ;+ 542 531 ; 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 ;- 570 561 pro XPAL, group=group, BLOCK=block, UPDATECALLBACK=updt_cb_name, $ 571 562 UPDATECBDATA=updt_cb_data … … 584 575 585 576 xpw = { xp_widgets, base:0L, $ 586 577 colorsel:0L, mark_label:0L, idx_label:0L, button_base:0L, rgb_base:0L} 587 578 588 579 state = {old_p:!p, $ ; Original value of !P 589 590 591 592 593 594 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) 595 586 596 587 if (XREGISTERED('XPAL')) then return ; Only one copy at a time … … 610 601 save_win = !d.window ;Previous window 611 602 612 IF N_ELEMENTS(r_orig) LE 0 THEN BEGIN 613 614 615 616 617 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 618 609 619 610 ; Create widgets … … 631 622 632 623 c1 = WIDGET_BASE(xpw.base, /COLUMN, space=20) 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 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 648 639 if (version.style='Motif') then junk2=30 else junk2 = 50 649 640 xpw.colorsel = CW_COLORSEL(junk, yoffset=junk2) 650 651 641 652 642 state.cur_idx = 0 … … 658 648 659 649 WIDGET_CONTROL, ncw, $ 660 650 set_value='Number Of Colors: ' + strcompress(!d.n_colors, /REMOVE_ALL) 661 651 WIDGET_CONTROL, get_value=tmp, cur_color 662 652 state.cur_color_win = tmp … … 672 662 673 663 XMANAGER, 'Xpal', xpw.base, event_handler='XP_EVENT', group=group, $ 674 675 end 676 664 NO_BLOCK=(NOT(FLOAT(block))) 665 end 666
Note: See TracChangeset
for help on using the changeset viewer.