1 | |
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
3 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
4 | |
---|
5 | <!-- Generated by IDLdoc 2.0 --> |
---|
6 | |
---|
7 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
8 | <head> |
---|
9 | <title>getcolor.pro (SAXO Documentation)</title> |
---|
10 | |
---|
11 | |
---|
12 | <link rel="stylesheet" type="text/css" media="all" href="./../main_files.css" /> |
---|
13 | <link rel="stylesheet" type="text/css" media="print" href="./../main_files_print.css" /> |
---|
14 | |
---|
15 | |
---|
16 | <script type="text/javascript"> |
---|
17 | function setTitle() { |
---|
18 | parent.document.title="getcolor.pro (SAXO Documentation)"; |
---|
19 | } |
---|
20 | </script> |
---|
21 | </head> |
---|
22 | |
---|
23 | <body onload="setTitle();"> |
---|
24 | |
---|
25 | <div id="navbar_title"> |
---|
26 | <h1>SAXO Documentation</h1> |
---|
27 | </div> |
---|
28 | |
---|
29 | |
---|
30 | <div id="main_navbar"> |
---|
31 | |
---|
32 | <table cellspacing="0"> |
---|
33 | <tr> |
---|
34 | |
---|
35 | <td><a href="./../overview.html" title="Overview of library">Overview</a></td> |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | <td >Directory</td> |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | <td><a href="./../idldoc-categories.html" title="Browse library by category">Categories</a></td> |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | <td><a href="./../idldoc-index.html" title="Index of files, routines, and parameters">Index</a></td> |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | <td><a href="./../search-page.html" title="Search library">Search</a></td> |
---|
52 | |
---|
53 | |
---|
54 | <td id="selected">File</td> |
---|
55 | |
---|
56 | |
---|
57 | <td><a href="../../../Colors//getcolor.pro" title="Source code of a file">Source</a></td> |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | <td><a href="./../idldoc-help.html" title="Help on IDLdoc">Help</a></td> |
---|
62 | |
---|
63 | |
---|
64 | <td >Etc</td> |
---|
65 | |
---|
66 | <td id="flexible">Developer documentation</td> |
---|
67 | </tr> |
---|
68 | </table> |
---|
69 | |
---|
70 | </div> |
---|
71 | |
---|
72 | <div id="secondary_navbar"> |
---|
73 | |
---|
74 | <a href="colorbar.html"><<prev file</a> | <a href="lct.html">next file >></a> <a href="getcolor.html" target="_TOP">view single page</a> | <a href="./../index.html" target="_TOP">view frames</a> summary: fields | routine details: <a href="#routine_details">routine</a> |
---|
75 | |
---|
76 | </div> |
---|
77 | |
---|
78 | |
---|
79 | <div id="container"> |
---|
80 | |
---|
81 | <h1 class="directory"><a href="directory-overview.html">Colors/</a></h1> |
---|
82 | <h2 class="pro_file">getcolor.pro</h2> |
---|
83 | |
---|
84 | <div id="file_attr"> |
---|
85 | <dl> |
---|
86 | </dl> |
---|
87 | </div> |
---|
88 | |
---|
89 | <div id="file_comments"> |
---|
90 | The original purpose of this function was to enable the |
---|
91 | user to specify one of the 16 colors supported by the |
---|
92 | McIDAS color map by name. Over time, however, the function |
---|
93 | has become a general purpose function for handling and |
---|
94 | supporting drawing colors in a device-independent way. |
---|
95 | In particular, I have been looking for ways to write color |
---|
96 | handling code that will work transparently on both 8-bit and |
---|
97 | 24-bit machines. On 24-bit machines, the code should work the |
---|
98 | same where color decomposition is turned on or off. |
---|
99 | |
---|
100 | (The 16 supported colors in GETCOLOR come from the McIDAS color |
---|
101 | table offered on the IDL newsgroup by Liam Gumley.) |
---|
102 | </div> |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | |
---|
112 | <div id="routine_details"> |
---|
113 | |
---|
114 | |
---|
115 | <div class="routine_details" id="_getcolor"> |
---|
116 | |
---|
117 | <h2><a class="top" href="#container">top</a>getcolor <span class="categories"> Graphics, Color |
---|
118 | </span></h2> |
---|
119 | |
---|
120 | <p class="header"> |
---|
121 | <span class="result">result = </span>getcolor(<span class="result">[<a href="#_getcolor_param_thisColor">thisColor</a>][, <a href="#_getcolor_param_index">index</a>]</span>, <a href="#_getcolor_keyword_TRUE">TRUE</a>=<span class="result">TRUE</span>, <a href="#_getcolor_keyword_NAMES">NAMES</a>=<span class="result">NAMES</span>, <a href="#_getcolor_keyword_LOAD">LOAD</a>=<span class="result">LOAD</span>, <a href="#_getcolor_keyword_START">START</a>=<span class="result">START</span>)</p> |
---|
122 | |
---|
123 | <div class="comments"> |
---|
124 | </div> |
---|
125 | |
---|
126 | <h3>Return value</h3><div class="preformat"> |
---|
127 | If no positional parameter is present, then the return value is either a 16-by-3 |
---|
128 | byte array containing the RGB values of all 16 colors or it is a 16-element |
---|
129 | long integer array containing color values that can be decomposed into colors. |
---|
130 | The 16-by-3 array is appropriate for loading color tables with the TVLCT command: |
---|
131 | |
---|
132 | Device, Decomposed=0 |
---|
133 | colors = GetColor() |
---|
134 | TVLCT, colors, 100 |
---|
135 | |
---|
136 | If function is called with just this single input parameter, |
---|
137 | the return value is either a 1-by-3 array containing the RGB values of |
---|
138 | that particular color, or a 24-bit integer that can be "decomposed" into |
---|
139 | that particular color, depending upon the state of the TRUE keyword and |
---|
140 | upon whether color decomposition is turned on or off. The state of color |
---|
141 | decomposition can ONLY be determined if the program is being run in |
---|
142 | IDL 5.2 or higher. |
---|
143 | |
---|
144 | If index parameter is passed, then the return value of the function is the |
---|
145 | index number and not the color triple. (If color decomposition is turned |
---|
146 | on AND the user specifies an index parameter, the color is loaded in the |
---|
147 | color table at the proper index, but a 24-bit value is returned to the |
---|
148 | user in IDL 5.2 and higher.) |
---|
149 | |
---|
150 | </div> |
---|
151 | |
---|
152 | |
---|
153 | <h3>Parameters</h3> |
---|
154 | |
---|
155 | |
---|
156 | <h4 id="_getcolor_param_thisColor">thisColor |
---|
157 | <span class="attr">in</span> |
---|
158 | |
---|
159 | <span class="attr">optional</span> |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | |
---|
164 | |
---|
165 | </h4> |
---|
166 | |
---|
167 | <div class="comments"> |
---|
168 | A string with the "name" of the color. Valid names are: |
---|
169 | black |
---|
170 | magenta |
---|
171 | cyan |
---|
172 | yellow |
---|
173 | green |
---|
174 | red |
---|
175 | blue |
---|
176 | navy |
---|
177 | gold |
---|
178 | pink |
---|
179 | aqua |
---|
180 | orchid |
---|
181 | gray |
---|
182 | sky |
---|
183 | beige |
---|
184 | white |
---|
185 | |
---|
186 | The color YELLOW is returned if the color name can't be resolved. |
---|
187 | Case is unimportant. |
---|
188 | |
---|
189 | </div> |
---|
190 | |
---|
191 | <h4 id="_getcolor_param_index">index |
---|
192 | <span class="attr">in</span> |
---|
193 | |
---|
194 | <span class="attr">optional</span> |
---|
195 | |
---|
196 | |
---|
197 | |
---|
198 | |
---|
199 | |
---|
200 | </h4> |
---|
201 | |
---|
202 | <div class="comments"> |
---|
203 | The color table index where the specified color should be loaded. |
---|
204 | </div> |
---|
205 | |
---|
206 | |
---|
207 | |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | <h3>Keywords</h3> |
---|
212 | |
---|
213 | <h4 id="_getcolor_keyword_TRUE">TRUE |
---|
214 | |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | |
---|
219 | |
---|
220 | |
---|
221 | |
---|
222 | </h4> |
---|
223 | |
---|
224 | <div class="comments"> |
---|
225 | If this keyword is set, the specified color triple is returned |
---|
226 | as a 24-bit integer equivalent. The lowest 8 bits correspond to |
---|
227 | the red value; the middle 8 bits to the green value; and the |
---|
228 | highest 8 bits correspond to the blue value. In IDL 5.2 and higher, |
---|
229 | if color decomposition is turned on, it is as though this keyword |
---|
230 | were set. |
---|
231 | </div> |
---|
232 | |
---|
233 | <h4 id="_getcolor_keyword_NAMES">NAMES |
---|
234 | |
---|
235 | |
---|
236 | |
---|
237 | |
---|
238 | |
---|
239 | |
---|
240 | |
---|
241 | |
---|
242 | </h4> |
---|
243 | |
---|
244 | <div class="comments"> |
---|
245 | If this keyword is set, the return value of the function is |
---|
246 | a 16-element string array containing the names of the colors. |
---|
247 | These names would be appropriate, for example, in building |
---|
248 | a list widget with the names of the colors. If the NAMES |
---|
249 | keyword is set, the COLOR and INDEX parameters are ignored. |
---|
250 | |
---|
251 | listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16) |
---|
252 | </div> |
---|
253 | |
---|
254 | <h4 id="_getcolor_keyword_LOAD">LOAD |
---|
255 | |
---|
256 | |
---|
257 | |
---|
258 | |
---|
259 | |
---|
260 | |
---|
261 | |
---|
262 | |
---|
263 | </h4> |
---|
264 | |
---|
265 | <div class="comments"> |
---|
266 | If this keyword is set, all 16 colors are automatically loaded |
---|
267 | starting at the color index specified by the START keyword. |
---|
268 | Note that setting this keyword means that the return value of the |
---|
269 | function will be a structure, with each field of the structure |
---|
270 | corresponding to a color name. The value of each field will be |
---|
271 | an index number (set by the START keyword) corresponding to the |
---|
272 | associated color, or a 24-bit long integer value that creates the |
---|
273 | color on a true-color device. What you have as the field values is |
---|
274 | determined by the TRUE keyword or whether color decomposition is on |
---|
275 | or off in the absence of the TRUE keyword. It will either be a 1-by-3 |
---|
276 | byte array or a long integer value. |
---|
277 | </div> |
---|
278 | |
---|
279 | <h4 id="_getcolor_keyword_START">START |
---|
280 | |
---|
281 | |
---|
282 | |
---|
283 | |
---|
284 | |
---|
285 | |
---|
286 | <span class="attr">default:</span> <span class="value">!D.TABLE_SIZE - 17</span> |
---|
287 | |
---|
288 | </h4> |
---|
289 | |
---|
290 | <div class="comments"> |
---|
291 | The starting color index number if the LOAD keyword is set. This keyword |
---|
292 | value is ignored unless the LOAD keyword is also set. The keyword is also |
---|
293 | ignored if the TRUE keyword is set or if color decomposition in on in |
---|
294 | IDL 5.2 and higher. |
---|
295 | </div> |
---|
296 | |
---|
297 | |
---|
298 | |
---|
299 | <h3>Examples</h3><div class="preformat"> |
---|
300 | To load a yellow color in color index 100 and plot in yellow, type: |
---|
301 | |
---|
302 | IDL> yellow = GETCOLOR('yellow', 100) |
---|
303 | IDL> PLOT, data, COLOR=yellow |
---|
304 | |
---|
305 | or, |
---|
306 | |
---|
307 | IDL> PLOT, data, COLOR=GETCOLOR('yellow', 100) |
---|
308 | |
---|
309 | To do the same thing on a 24-bit color system with decomposed color on, type: |
---|
310 | |
---|
311 | IDL> PLOT, data, COLOR=GETCOLOR('yellow', /TRUE) |
---|
312 | |
---|
313 | or in IDL 5.2 and higher, |
---|
314 | |
---|
315 | IDL> DEVICE, Decomposed=1 |
---|
316 | IDL> PLOT, data, COLOR=GETCOLOR('yellow') |
---|
317 | |
---|
318 | To load all 16 colors into the current color table, starting at |
---|
319 | color index 200, type: |
---|
320 | |
---|
321 | IDL> TVLCT, GETCOLOR(), 200 |
---|
322 | |
---|
323 | To add the color names to a list widget: |
---|
324 | |
---|
325 | IDL> listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16) |
---|
326 | |
---|
327 | To load all 16 colors and have the color indices returned in a structure: |
---|
328 | |
---|
329 | IDL> DEVICE, Decomposed=0 |
---|
330 | IDL> colors = GetColor(/Load, Start=1) |
---|
331 | IDL> HELP, colors, /Structure |
---|
332 | PLOT, data, COLOR=colors.yellow |
---|
333 | |
---|
334 | To get the direct color values as 24-bit integers in color structure fields: |
---|
335 | |
---|
336 | IDL> DEVICE, Decomposed=1 |
---|
337 | IDL> colors = GetColor(/Load) |
---|
338 | IDL> PLOT, data, COLOR=colors.yellow |
---|
339 | |
---|
340 | Note that the START keyword value is ignored if on a 24-bit device, |
---|
341 | so it is possible to write completely device-independent code by |
---|
342 | writing code like this: |
---|
343 | |
---|
344 | IDL> colors = GetColor(/Load) |
---|
345 | IDL> PLOT, data, Color=colors.yellow; IDL> DEVICE, Decomposed=0 |
---|
346 | IDL> colors = GetColor(/Load, Start=1) |
---|
347 | IDL> HELP, colors, /Structure |
---|
348 | PLOT, data, COLOR=colors.yellow |
---|
349 | |
---|
350 | To get the direct color values as 24-bit integers in color structure fields: |
---|
351 | |
---|
352 | IDL> DEVICE, Decomposed=1 |
---|
353 | IDL> colors = GetColor(/Load) |
---|
354 | IDL> PLOT, data, COLOR=colors.yellow |
---|
355 | |
---|
356 | Note that the START keyword value is ignored if on a 24-bit device, |
---|
357 | so it is possible to write completely device-independent code by |
---|
358 | writing code like this: |
---|
359 | |
---|
360 | IDL> colors = GetColor(/Load) |
---|
361 | IDL> PLOT, data, Color=colors.yellow |
---|
362 | </div> |
---|
363 | <h3>Version history</h3> |
---|
364 | |
---|
365 | <h4>Version</h4><div class="preformat"> $Id: getcolor.pro 163 2006-08-29 12:59:46Z navarro $</div> |
---|
366 | <h4>History</h4><div class="preformat"> |
---|
367 | Written by: David Fanning, 10 February 96. |
---|
368 | Fixed a bug in which N_ELEMENTS was spelled wrong. 7 Dec 96. DWF |
---|
369 | Added the McIDAS colors to the program. 24 Feb 99. DWF |
---|
370 | Added the INDEX parameter to the program 8 Mar 99. DWF |
---|
371 | Added the NAMES keyword at insistence of Martin Schultz. 10 Mar 99. DWF |
---|
372 | Reordered the colors so black is first and white is last. 7 June 99. DWF |
---|
373 | Added automatic recognition of DECOMPOSED=1 state. 7 June 99. DWF |
---|
374 | Added LOAD AND START keywords. 7 June 99. DWF. |
---|
375 | </div> |
---|
376 | |
---|
377 | |
---|
378 | <h3>Known issues</h3> |
---|
379 | |
---|
380 | |
---|
381 | |
---|
382 | <h4>Restrictions</h4><div class="preformat"> |
---|
383 | The TRUE keyword causes the START keyword to be ignored. |
---|
384 | The NAMES keyword causes the COLOR, INDEX, START, and TRUE parameters to be |
---|
385 | ignored. |
---|
386 | The COLOR parameter is ignored if the LOAD keyword is used. |
---|
387 | On systems where it is possible to tell the state of color decomposition |
---|
388 | (i.e., IDL 5.2 and higher), a 24-bit value (or values) is automatically |
---|
389 | returned if color decomposition is ON. |
---|
390 | </div> |
---|
391 | |
---|
392 | |
---|
393 | |
---|
394 | |
---|
395 | |
---|
396 | |
---|
397 | |
---|
398 | |
---|
399 | |
---|
400 | <h3>Statistics</h3> |
---|
401 | <table class="statistics"> |
---|
402 | <tr><td>McCabe cyclic</td><td> 30</td></tr> |
---|
403 | <tr><td>McCabe essential</td><td> 1</td></tr> |
---|
404 | <tr><td>McCabe modular design</td><td> 1</td></tr> |
---|
405 | </table> |
---|
406 | |
---|
407 | |
---|
408 | </div> |
---|
409 | |
---|
410 | </div> |
---|
411 | |
---|
412 | |
---|
413 | |
---|
414 | <div id="tagline">Produced by IDLdoc 2.0.</div> |
---|
415 | |
---|
416 | </div> |
---|
417 | |
---|
418 | </body> |
---|
419 | </html> |
---|