GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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  DCELL max)
202 {
203  Rast_make_fp_colors(colors, "grey", min, max);
204 }
205 
206 /*!
207  * \brief Create BYR color table (integer)
208  *
209  * Generates a color table blue-yellow-red.
210  *
211  * \param colors pointer to Colors structure which holds color info
212  * \param min minimum value
213  * \param max maximum value
214  */
215 void Rast_make_byr_colors(struct Colors *colors, CELL min, CELL max)
216 {
217  Rast_make_colors(colors, "byr", min, max);
218 }
219 
220 /*!
221  * \brief Create BYR color table (floating-point)
222  *
223  * Generates a color table blue-yellow-red.
224  *
225  * \param colors pointer to Colors structure which holds color info
226  * \param min minimum value
227  * \param max maximum value
228  */
230 {
231  Rast_make_fp_colors(colors, "byr", min, max);
232 }
233 
234 /*!
235  * \brief Create BGYR color table (integer)
236  *
237  * Generates a color table blue-green-yellow-red.
238  *
239  * \param colors pointer to Colors structure which holds color info
240  * \param min minimum value
241  * \param max maximum value
242  */
243 void Rast_make_bgyr_colors(struct Colors *colors, CELL min, CELL max)
244 {
245  Rast_make_colors(colors, "bgyr", min, max);
246 }
247 
248 /*!
249  * \brief Create BGYR color table (floating-point)
250  *
251  * Generates a color table blue-green-yellow-red.
252  *
253  * \param colors pointer to Colors structure which holds color info
254  * \param min minimum value
255  * \param max maximum value
256  */
258 {
259  Rast_make_fp_colors(colors, "bgyr", min, max);
260 }
261 
262 /*!
263  * \brief Create BYG color table (integer)
264  *
265  * Generates a color table blue-yellow-green.
266  *
267  * \param colors pointer to Colors structure which holds color info
268  * \param min minimum value
269  * \param max maximum value
270  */
271 void Rast_make_byg_colors(struct Colors *colors, CELL min, CELL max)
272 {
273  Rast_make_colors(colors, "byg", min, max);
274 }
275 
276 /*!
277  * \brief Create BYG color table (floating-point)
278  *
279  * Generates a color table blue-yellow-green.
280  *
281  * \param colors pointer to Colors structure which holds color info
282  * \param min minimum value
283  * \param max maximum value
284  */
286 {
287  Rast_make_fp_colors(colors, "byg", min, max);
288 }
289 
290 /*!
291  * \brief Make aspect colors (integer)
292  *
293  * Generates a color table for aspect data.
294  *
295  * \param colors pointer to Colors structure which holds color info
296  * \param min minimum value
297  * \param max maximum value
298  */
300 {
301  Rast_make_colors(colors, "aspect", min, max);
302 }
303 
304 /*!
305  * \brief Make aspect colors (floating-point)
306  *
307  * Generates a color table for aspect data.
308  *
309  * \param colors pointer to Colors structure which holds color info
310  * \param min minimum value
311  * \param max maximum value
312  */
314 {
315  Rast_make_fp_colors(colors, "aspect", min, max);
316 }
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_rainbow_colors(struct Colors *colors, CELL min, CELL max)
Make rainbow colors (integer)
Definition: color_compat.c:124
void Rast_make_gyr_colors(struct Colors *colors, CELL min, CELL max)
Create GYR color table (integer)
Definition: color_compat.c:156
#define min(x, y)
Definition: draw2.c:31
double DCELL
Definition: gis.h:614
#define max(x, y)
Definition: draw2.c:32
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_gyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create GYR color table (floating-point)
Definition: color_compat.c:170
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_wave_colors(struct Colors *colors, CELL min, CELL max)
Make color wave (integer)
Definition: color_compat.c:29
void Rast_make_bgyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create BGYR color table (floating-point)
Definition: color_compat.c:257
void Rast_make_byr_colors(struct Colors *colors, CELL min, CELL max)
Create BYR color table (integer)
Definition: color_compat.c:215
void Rast_make_aspect_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Make aspect colors (floating-point)
Definition: color_compat.c:313
Definition: gis.h:676
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_rainbow_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Make rainbow colors (floating-point)
Definition: color_compat.c:142
int CELL
Definition: gis.h:613
void Rast_make_byg_colors(struct Colors *colors, CELL min, CELL max)
Create BYG color table (integer)
Definition: color_compat.c:271
void Rast_make_colors(struct Colors *, const char *, CELL, CELL)
Load color rules from predefined color table.
void Rast_make_bgyr_colors(struct Colors *colors, CELL min, CELL max)
Create BGYR color table (integer)
Definition: color_compat.c:243
void Rast_make_fp_colors(struct Colors *, const char *, DCELL, DCELL)
Load color rules from predefined floating-point color table.
void Rast_make_aspect_colors(struct Colors *colors, CELL min, CELL max)
Make aspect colors (integer)
Definition: color_compat.c:299
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_byr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create BYR color table (floating-point)
Definition: color_compat.c:229
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_byg_fp_colors(struct Colors *colors, DCELL min, DCELL max)
Create BYG color table (floating-point)
Definition: color_compat.c:285
void Rast_make_ramp_colors(struct Colors *colors, CELL min, CELL max)
Make color ramp (integer)
Definition: color_compat.c:90