color_compat.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /****************************************************************************
  2. *
  3. * MODULE: gis library
  4. * AUTHOR(S): Glynn Clements <glynn@gclements.plus.com>
  5. * COPYRIGHT: (C) 2007 Glynn Clements and the GRASS Development Team
  6. *
  7. * NOTE: Compatibility wrappers for G_make_*[_fp]_colors()
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. *****************************************************************************/
  20. #include <grass/gis.h>
  21. /*!
  22. * \brief make color wave
  23. *
  24. * Generates a color table with 3 sections: red only,
  25. * green only, and blue only, each increasing from none to full intensity and
  26. * back down to none. This table is good for continuous data like elevation.
  27. *
  28. * \param colors
  29. * \param min
  30. * \param max
  31. * \return
  32. */
  33. void G_make_wave_colors(struct Colors *colors, CELL min, CELL max)
  34. {
  35. G_make_colors(colors, "wave", min, max);
  36. }
  37. void G_make_wave_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  38. {
  39. G_make_fp_colors(colors, "wave", min, max);
  40. }
  41. void G_make_ryg_colors(struct Colors *colors, CELL min, CELL max)
  42. {
  43. G_make_colors(colors, "ryg", min, max);
  44. }
  45. void G_make_ryg_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  46. {
  47. G_make_fp_colors(colors, "ryg", min, max);
  48. }
  49. /*!
  50. * \brief make color ramp
  51. *
  52. * Generates a color table with 3 sections: red only,
  53. * green only, and blue only, each increasing from none to full intensity. This
  54. * table is good for continuous data, such as elevation.
  55. *
  56. * \param colors
  57. * \param min
  58. * \param max
  59. * \return
  60. */
  61. void G_make_ramp_colors(struct Colors *colors, CELL min, CELL max)
  62. {
  63. G_make_colors(colors, "ramp", min, max);
  64. }
  65. void G_make_ramp_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  66. {
  67. G_make_fp_colors(colors, "ramp", min, max);
  68. }
  69. /*!
  70. * \brief make rainbow colors
  71. *
  72. * Generates a "shifted" rainbow color table - yellow
  73. * to green to cyan to blue to magenta to red. The color table is based on
  74. * rainbow colors. (Normal rainbow colors are red, orange, yellow, green, blue,
  75. * indigo, and violet.) This table is good for continuous data, such as
  76. * elevation.
  77. *
  78. * \param colors
  79. * \param min
  80. * \param max
  81. * \return
  82. */
  83. void G_make_rainbow_colors(struct Colors *colors, CELL min, CELL max)
  84. {
  85. G_make_colors(colors, "rainbow", min, max);
  86. }
  87. void G_make_rainbow_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  88. {
  89. G_make_fp_colors(colors, "rainbow", min, max);
  90. }
  91. void G_make_gyr_colors(struct Colors *colors, CELL min, CELL max)
  92. {
  93. G_make_colors(colors, "gyr", min, max);
  94. }
  95. void G_make_gyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  96. {
  97. G_make_fp_colors(colors, "gyr", min, max);
  98. }
  99. /*!
  100. * \brief make linear grey scale
  101. *
  102. * Generates a grey scale color table. Each color
  103. * is a level of grey, increasing from black to white.
  104. *
  105. * \param colors
  106. * \param min
  107. * \param max
  108. * \return
  109. */
  110. void G_make_grey_scale_colors(struct Colors *colors, CELL min, CELL max)
  111. {
  112. G_make_colors(colors, "grey", min, max);
  113. }
  114. void G_make_grey_scale_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  115. {
  116. G_make_fp_colors(colors, "grey", min, max);
  117. }
  118. void G_make_byr_colors(struct Colors *colors, CELL min, CELL max)
  119. {
  120. G_make_colors(colors, "byr", min, max);
  121. }
  122. void G_make_byr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  123. {
  124. G_make_fp_colors(colors, "byr", min, max);
  125. }
  126. void G_make_bgyr_colors(struct Colors *colors, CELL min, CELL max)
  127. {
  128. G_make_colors(colors, "bgyr", min, max);
  129. }
  130. void G_make_bgyr_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  131. {
  132. G_make_fp_colors(colors, "bgyr", min, max);
  133. }
  134. void G_make_byg_colors(struct Colors *colors, CELL min, CELL max)
  135. {
  136. G_make_colors(colors, "byg", min, max);
  137. }
  138. void G_make_byg_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  139. {
  140. G_make_fp_colors(colors, "byg", min, max);
  141. }
  142. /*!
  143. * \brief make aspect colors
  144. *
  145. * Generates a color table for aspect data.
  146. *
  147. * \param colors
  148. * \param min
  149. * \param max
  150. * \return
  151. */
  152. void G_make_aspect_colors(struct Colors *colors, CELL min, CELL max)
  153. {
  154. G_make_colors(colors, "aspect", min, max);
  155. }
  156. void G_make_aspect_fp_colors(struct Colors *colors, DCELL min, DCELL max)
  157. {
  158. G_make_fp_colors(colors, "aspect", min, max);
  159. }