color_compat.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /*!
  2. * \file 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. #include <grass/gis.h>
  14. #include <grass/raster.h>
  15. /*!
  16. * \brief Make color wave (integer)
  17. *
  18. * Generates a color table with 3 sections: red only, green only, and
  19. * blue only, each increasing from none to full intensity and back
  20. * down to none. This table is good for continuous data like
  21. * elevation.
  22. *
  23. * \param colors pointer to Colors structure which holds color info
  24. * \param min minimum value
  25. * \param max maximum value
  26. */
  27. void Rast_make_wave_colors(struct Colors *colors, CELL min, CELL max)
  28. {
  29. Rast_make_colors(colors, "wave", min, max);
  30. }
  31. /*!
  32. * \brief Make color wave (floating-point)
  33. *
  34. * Generates a color table with 3 sections: red only, green only, and
  35. * blue only, each increasing from none to full intensity and back
  36. * down to none. This table is good for continuous data like
  37. * elevation.
  38. *
  39. * \param colors pointer to Colors structure which holds color info
  40. * \param min minimum value
  41. * \param max maximum value
  42. */
  43. void Rast_make_wave_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  44. {
  45. Rast_make_fp_colors(colors, "wave", min, max);
  46. }
  47. /*!
  48. * \brief Create RYG color table (integer)
  49. *
  50. * Generates a color table red-yellow-green.
  51. *
  52. * \param colors pointer to Colors structure which holds color info
  53. * \param min minimum value
  54. * \param max maximum value
  55. */
  56. void Rast_make_ryg_colors(struct Colors *colors, CELL min, CELL max)
  57. {
  58. Rast_make_colors(colors, "ryg", min, max);
  59. }
  60. /*!
  61. * \brief Create RYG color table (floating-point)
  62. *
  63. * Generates a color table red-yellow-green.
  64. *
  65. * \param colors pointer to Colors structure which holds color info
  66. * \param min minimum value
  67. * \param max maximum value
  68. */
  69. void Rast_make_ryg_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  70. {
  71. Rast_make_fp_colors(colors, "ryg", min, max);
  72. }
  73. /*!
  74. * \brief Make color ramp (integer)
  75. *
  76. * Generates a color table with 3 sections: red only, green only, and
  77. * blue only, each increasing from none to full intensity. This table
  78. * is good for continuous data, such as elevation.
  79. *
  80. * \param colors pointer to Colors structure which holds color info
  81. * \param min minimum value
  82. * \param max maximum value
  83. */
  84. void Rast_make_ramp_colors(struct Colors *colors, CELL min, CELL max)
  85. {
  86. Rast_make_colors(colors, "ramp", min, max);
  87. }
  88. /*!
  89. * \brief Make color ramp (floating-point)
  90. *
  91. * Generates a color table with 3 sections: red only, green only, and
  92. * blue only, each increasing from none to full intensity. This table
  93. * is good for continuous data, such as elevation.
  94. *
  95. * \param colors pointer to Colors structure which holds color info
  96. * \param min minimum value
  97. * \param max maximum value
  98. */
  99. void Rast_make_ramp_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  100. {
  101. Rast_make_fp_colors(colors, "ramp", min, max);
  102. }
  103. /*!
  104. * \brief Make rainbow colors (integer)
  105. *
  106. * Generates a "shifted" rainbow color table - yellow to green to cyan
  107. * to blue to magenta to red. The color table is based on rainbow
  108. * colors. (Normal rainbow colors are red, orange, yellow, green,
  109. * blue, indigo, and violet.) This table is good for continuous data,
  110. * such as elevation.
  111. *
  112. * \param colors pointer to Colors structure which holds color info
  113. * \param min minimum value
  114. * \param max maximum value
  115. */
  116. void Rast_make_rainbow_colors(struct Colors *colors, CELL min, CELL max)
  117. {
  118. Rast_make_colors(colors, "rainbow", min, max);
  119. }
  120. /*!
  121. * \brief Make rainbow colors (floating-point)
  122. *
  123. * Generates a "shifted" rainbow color table - yellow to green to cyan
  124. * to blue to magenta to red. The color table is based on rainbow
  125. * colors. (Normal rainbow colors are red, orange, yellow, green,
  126. * blue, indigo, and violet.) This table is good for continuous data,
  127. * such as elevation.
  128. *
  129. * \param colors pointer to Colors structure which holds color info
  130. * \param min minimum value
  131. * \param max maximum value
  132. */
  133. void Rast_make_rainbow_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  134. {
  135. Rast_make_fp_colors(colors, "rainbow", min, max);
  136. }
  137. /*!
  138. * \brief Create GYR color table (integer)
  139. *
  140. * Generates a color table green-yellow-red.
  141. *
  142. * \param colors pointer to Colors structure which holds color info
  143. * \param min minimum value
  144. * \param max maximum value
  145. */
  146. void Rast_make_gyr_colors(struct Colors *colors, CELL min, CELL max)
  147. {
  148. Rast_make_colors(colors, "gyr", min, max);
  149. }
  150. /*!
  151. * \brief Create GYR color table (floating-point)
  152. *
  153. * Generates a color table green-yellow-red.
  154. *
  155. * \param colors pointer to Colors structure which holds color info
  156. * \param min minimum value
  157. * \param max maximum value
  158. */
  159. void Rast_make_gyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  160. {
  161. Rast_make_fp_colors(colors, "gyr", min, max);
  162. }
  163. /*!
  164. * \brief Make linear grey scale (integer)
  165. *
  166. * Generates a grey scale color table. Each color is a level of grey,
  167. * increasing from black to white.
  168. *
  169. * \param colors pointer to Colors structure which holds color info
  170. * \param min minimum value
  171. * \param max maximum value
  172. */
  173. void Rast_make_grey_scale_colors(struct Colors *colors, CELL min, CELL max)
  174. {
  175. Rast_make_colors(colors, "grey", min, max);
  176. }
  177. /*!
  178. * \brief Make linear grey scale (floating-point)
  179. *
  180. * Generates a grey scale color table. Each color is a level of grey,
  181. * increasing from black to white.
  182. *
  183. * \param colors pointer to Colors structure which holds color info
  184. * \param min minimum value
  185. * \param max maximum value
  186. */
  187. void Rast_make_grey_scale_fp_colors(struct Colors *colors, DCELL min,
  188. DCELL max)
  189. {
  190. Rast_make_fp_colors(colors, "grey", min, max);
  191. }
  192. /*!
  193. * \brief Create BYR color table (integer)
  194. *
  195. * Generates a color table blue-yellow-red.
  196. *
  197. * \param colors pointer to Colors structure which holds color info
  198. * \param min minimum value
  199. * \param max maximum value
  200. */
  201. void Rast_make_byr_colors(struct Colors *colors, CELL min, CELL max)
  202. {
  203. Rast_make_colors(colors, "byr", min, max);
  204. }
  205. /*!
  206. * \brief Create BYR color table (floating-point)
  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_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  215. {
  216. Rast_make_fp_colors(colors, "byr", min, max);
  217. }
  218. /*!
  219. * \brief Create BGYR color table (integer)
  220. *
  221. * Generates a color table blue-green-yellow-red.
  222. *
  223. * \param colors pointer to Colors structure which holds color info
  224. * \param min minimum value
  225. * \param max maximum value
  226. */
  227. void Rast_make_bgyr_colors(struct Colors *colors, CELL min, CELL max)
  228. {
  229. Rast_make_colors(colors, "bgyr", min, max);
  230. }
  231. /*!
  232. * \brief Create BGYR color table (floating-point)
  233. *
  234. * Generates a color table blue-green-yellow-red.
  235. *
  236. * \param colors pointer to Colors structure which holds color info
  237. * \param min minimum value
  238. * \param max maximum value
  239. */
  240. void Rast_make_bgyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  241. {
  242. Rast_make_fp_colors(colors, "bgyr", min, max);
  243. }
  244. /*!
  245. * \brief Create BYG color table (integer)
  246. *
  247. * Generates a color table blue-yellow-green.
  248. *
  249. * \param colors pointer to Colors structure which holds color info
  250. * \param min minimum value
  251. * \param max maximum value
  252. */
  253. void Rast_make_byg_colors(struct Colors *colors, CELL min, CELL max)
  254. {
  255. Rast_make_colors(colors, "byg", min, max);
  256. }
  257. /*!
  258. * \brief Create BYG color table (floating-point)
  259. *
  260. * Generates a color table blue-yellow-green.
  261. *
  262. * \param colors pointer to Colors structure which holds color info
  263. * \param min minimum value
  264. * \param max maximum value
  265. */
  266. void Rast_make_byg_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  267. {
  268. Rast_make_fp_colors(colors, "byg", min, max);
  269. }
  270. /*!
  271. * \brief Make aspect colors (integer)
  272. *
  273. * Generates a color table for aspect data.
  274. *
  275. * \param colors pointer to Colors structure which holds color info
  276. * \param min minimum value
  277. * \param max maximum value
  278. */
  279. void Rast_make_aspect_colors(struct Colors *colors, CELL min, CELL max)
  280. {
  281. Rast_make_colors(colors, "aspect", min, max);
  282. }
  283. /*!
  284. * \brief Make aspect colors (floating-point)
  285. *
  286. * Generates a color table for aspect data.
  287. *
  288. * \param colors pointer to Colors structure which holds color info
  289. * \param min minimum value
  290. * \param max maximum value
  291. */
  292. void Rast_make_aspect_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  293. {
  294. Rast_make_fp_colors(colors, "aspect", min, max);
  295. }