GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-835afb4352
color_compat.c
Go to the documentation of this file.
1 /*!
2  * \file lib/raster/color_compat.c
3  *
4  * \brief Raster Library - Predefined color tables
5  *
6  * (C) 2007-2009 Glynn Clements and the GRASS Development Team
7  *
8  * This program is free software under the GNU General Public License
9  * (>=v2). Read the file COPYING that comes with GRASS for details.
10  *
11  * \author Glynn Clements <glynn@gclements.plus.com>
12  */
13 
14 #include <grass/gis.h>
15 #include <grass/raster.h>
16 
17 /*!
18  * \brief Make color wave (integer)
19  *
20  * Generates a color table with 3 sections: red only, green only, and
21  * blue only, each increasing from none to full intensity and back
22  * down to none. This table is good for continuous data like
23  * elevation.
24  *
25  * \param colors pointer to Colors structure which holds color info
26  * \param min minimum value
27  * \param max maximum value
28  */
29 void Rast_make_wave_colors(struct Colors *colors, CELL min, CELL max)
30 {
31  Rast_make_colors(colors, "wave", min, max);
32 }
33 
34 /*!
35  * \brief Make color wave (floating-point)
36  *
37  * Generates a color table with 3 sections: red only, green only, and
38  * blue only, each increasing from none to full intensity and back
39  * down to none. This table is good for continuous data like
40  * elevation.
41  *
42  * \param colors pointer to Colors structure which holds color info
43  * \param min minimum value
44  * \param max maximum value
45  */
47 {
48  Rast_make_fp_colors(colors, "wave", min, max);
49 }
50 
51 /*!
52  * \brief Create RYG color table (integer)
53  *
54  * Generates a color table red-yellow-green.
55  *
56  * \param colors pointer to Colors structure which holds color info
57  * \param min minimum value
58  * \param max maximum value
59  */
60 void Rast_make_ryg_colors(struct Colors *colors, CELL min, CELL max)
61 {
62  Rast_make_colors(colors, "ryg", min, max);
63 }
64 
65 /*!
66  * \brief Create RYG color table (floating-point)
67  *
68  * Generates a color table red-yellow-green.
69  *
70  * \param colors pointer to Colors structure which holds color info
71  * \param min minimum value
72  * \param max maximum value
73  */
75 {
76  Rast_make_fp_colors(colors, "ryg", min, max);
77 }
78 
79 /*!
80  * \brief Make color ramp (integer)
81  *
82  * Generates a color table with 3 sections: red only, green only, and
83  * blue only, each increasing from none to full intensity. This table
84  * is good for continuous data, such as elevation.
85  *
86  * \param colors pointer to Colors structure which holds color info
87  * \param min minimum value
88  * \param max maximum value
89  */
90 void Rast_make_ramp_colors(struct Colors *colors, CELL min, CELL max)
91 {
92  Rast_make_colors(colors, "ramp", min, max);
93 }
94 
95 /*!
96  * \brief Make color ramp (floating-point)
97  *
98  * Generates a color table with 3 sections: red only, green only, and
99  * blue only, each increasing from none to full intensity. This table
100  * is good for continuous data, such as elevation.
101  *
102  * \param colors pointer to Colors structure which holds color info
103  * \param min minimum value
104  * \param max maximum value
105  */
107 {
108  Rast_make_fp_colors(colors, "ramp", min, max);
109 }
110 
111 /*!
112  * \brief Make rainbow colors (integer)
113  *
114  * Generates a "shifted" rainbow color table - yellow to green to cyan
115  * to blue to magenta to red. The color table is based on rainbow
116  * colors. (Normal rainbow colors are red, orange, yellow, green,
117  * blue, indigo, and violet.) This table is good for continuous data,
118  * such as elevation.
119  *
120  * \param colors pointer to Colors structure which holds color info
121  * \param min minimum value
122  * \param max maximum value
123  */
125 {
126  Rast_make_colors(colors, "rainbow", min, max);
127 }
128 
129 /*!
130  * \brief Make rainbow colors (floating-point)
131  *
132  * Generates a "shifted" rainbow color table - yellow to green to cyan
133  * to blue to magenta to red. The color table is based on rainbow
134  * colors. (Normal rainbow colors are red, orange, yellow, green,
135  * blue, indigo, and violet.) This table is good for continuous data,
136  * such as elevation.
137  *
138  * \param colors pointer to Colors structure which holds color info
139  * \param min minimum value
140  * \param max maximum value
141  */
143 {
144  Rast_make_fp_colors(colors, "rainbow", min, max);
145 }
146 
147 /*!
148  * \brief Create GYR color table (integer)
149  *
150  * Generates a color table green-yellow-red.
151  *
152  * \param colors pointer to Colors structure which holds color info
153  * \param min minimum value
154  * \param max maximum value
155  */
156 void Rast_make_gyr_colors(struct Colors *colors, CELL min, CELL max)
157 {
158  Rast_make_colors(colors, "gyr", min, max);
159 }
160 
161 /*!
162  * \brief Create GYR color table (floating-point)
163  *
164  * Generates a color table green-yellow-red.
165  *
166  * \param colors pointer to Colors structure which holds color info
167  * \param min minimum value
168  * \param max maximum value
169  */
171 {
172  Rast_make_fp_colors(colors, "gyr", min, max);
173 }
174 
175 /*!
176  * \brief Make linear grey scale (integer)
177  *
178  * Generates a grey scale color table. Each color is a level of grey,
179  * increasing from black to white.
180  *
181  * \param colors pointer to Colors structure which holds color info
182  * \param min minimum value
183  * \param max maximum value
184  */
186 {
187  Rast_make_colors(colors, "grey", min, max);
188 }
189 
190 /*!
191  * \brief Make linear grey scale (floating-point)
192  *
193  * Generates a grey scale color table. Each color is a level of grey,
194  * increasing from black to white.
195  *
196  * \param colors pointer to Colors structure which holds color info
197  * \param min minimum value
198  * \param max maximum value
199  */
201 {
202  Rast_make_fp_colors(colors, "grey", min, max);
203 }
204 
205 /*!
206  * \brief Create BYR color table (integer)
207  *
208  * Generates a color table blue-yellow-red.
209  *
210  * \param colors pointer to Colors structure which holds color info
211  * \param min minimum value
212  * \param max maximum value
213  */
214 void Rast_make_byr_colors(struct Colors *colors, CELL min, CELL max)
215 {
216  Rast_make_colors(colors, "byr", min, max);
217 }
218 
219 /*!
220  * \brief Create BYR color table (floating-point)
221  *
222  * Generates a color table blue-yellow-red.
223  *
224  * \param colors pointer to Colors structure which holds color info
225  * \param min minimum value
226  * \param max maximum value
227  */
229 {
230  Rast_make_fp_colors(colors, "byr", min, max);
231 }
232 
233 /*!
234  * \brief Create BGYR color table (integer)
235  *
236  * Generates a color table blue-green-yellow-red.
237  *
238  * \param colors pointer to Colors structure which holds color info
239  * \param min minimum value
240  * \param max maximum value
241  */
242 void Rast_make_bgyr_colors(struct Colors *colors, CELL min, CELL max)
243 {
244  Rast_make_colors(colors, "bgyr", min, max);
245 }
246 
247 /*!
248  * \brief Create BGYR color table (floating-point)
249  *
250  * Generates a color table blue-green-yellow-red.
251  *
252  * \param colors pointer to Colors structure which holds color info
253  * \param min minimum value
254  * \param max maximum value
255  */
257 {
258  Rast_make_fp_colors(colors, "bgyr", min, max);
259 }
260 
261 /*!
262  * \brief Create BYG color table (integer)
263  *
264  * Generates a color table blue-yellow-green.
265  *
266  * \param colors pointer to Colors structure which holds color info
267  * \param min minimum value
268  * \param max maximum value
269  */
270 void Rast_make_byg_colors(struct Colors *colors, CELL min, CELL max)
271 {
272  Rast_make_colors(colors, "byg", min, max);
273 }
274 
275 /*!
276  * \brief Create BYG color table (floating-point)
277  *
278  * Generates a color table blue-yellow-green.
279  *
280  * \param colors pointer to Colors structure which holds color info
281  * \param min minimum value
282  * \param max maximum value
283  */
285 {
286  Rast_make_fp_colors(colors, "byg", min, max);
287 }
288 
289 /*!
290  * \brief Make aspect colors (integer)
291  *
292  * Generates a color table for aspect data.
293  *
294  * \param colors pointer to Colors structure which holds color info
295  * \param min minimum value
296  * \param max maximum value
297  */
299 {
300  Rast_make_colors(colors, "aspect", min, max);
301 }
302 
303 /*!
304  * \brief Make aspect colors (floating-point)
305  *
306  * Generates a color table for aspect data.
307  *
308  * \param colors pointer to Colors structure which holds color info
309  * \param min minimum value
310  * \param max maximum value
311  */
313 {
314  Rast_make_fp_colors(colors, "aspect", min, max);
315 }
void Rast_make_bgyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create BGYR color table (floating-point)
Definition: color_compat.c:256
void Rast_make_aspect_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Make aspect colors (floating-point)
Definition: color_compat.c:312
void Rast_make_byg_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create BYG color table (floating-point)
Definition: color_compat.c:284
void Rast_make_bgyr_colors(struct Colors *colors, CELL min, CELL max)
Create BGYR color table (integer)
Definition: color_compat.c:242
void Rast_make_ryg_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create RYG color table (floating-point)
Definition: color_compat.c:74
void Rast_make_ramp_colors(struct Colors *colors, CELL min, CELL max)
Make color ramp (integer)
Definition: color_compat.c:90
void Rast_make_grey_scale_colors(struct Colors *colors, CELL min, CELL max)
Make linear grey scale (integer)
Definition: color_compat.c:185
void Rast_make_gyr_colors(struct Colors *colors, CELL min, CELL max)
Create GYR color table (integer)
Definition: color_compat.c:156
void Rast_make_rainbow_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Make rainbow colors (floating-point)
Definition: color_compat.c:142
void Rast_make_byg_colors(struct Colors *colors, CELL min, CELL max)
Create BYG color table (integer)
Definition: color_compat.c:270
void Rast_make_byr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create BYR color table (floating-point)
Definition: color_compat.c:228
void Rast_make_wave_colors(struct Colors *colors, CELL min, CELL max)
Make color wave (integer)
Definition: color_compat.c:29
void Rast_make_byr_colors(struct Colors *colors, CELL min, CELL max)
Create BYR color table (integer)
Definition: color_compat.c:214
void Rast_make_aspect_colors(struct Colors *colors, CELL min, CELL max)
Make aspect colors (integer)
Definition: color_compat.c:298
void Rast_make_rainbow_colors(struct Colors *colors, CELL min, CELL max)
Make rainbow colors (integer)
Definition: color_compat.c:124
void Rast_make_grey_scale_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Make linear grey scale (floating-point)
Definition: color_compat.c:200
void Rast_make_ramp_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Make color ramp (floating-point)
Definition: color_compat.c:106
void Rast_make_gyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create GYR color table (floating-point)
Definition: color_compat.c:170
void Rast_make_wave_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Make color wave (floating-point)
Definition: color_compat.c:46
void Rast_make_ryg_colors(struct Colors *colors, CELL min, CELL max)
Create RYG color table (integer)
Definition: color_compat.c:60
void Rast_make_fp_colors(struct Colors *, const char *, DCELL, DCELL)
Load color rules from predefined floating-point color table.
void Rast_make_colors(struct Colors *, const char *, CELL, CELL)
Load color rules from predefined color table.
#define min(x, y)
Definition: draw2.c:29
#define max(x, y)
Definition: draw2.c:30
double DCELL
Definition: gis.h:626
int CELL
Definition: gis.h:625
Definition: gis.h:683