00001 #include "gis.h"
00002
00003 static int add_gyr_colors (struct Colors *, DCELL, DCELL);
00004
00005 int
00006 G_make_gyr_colors (struct Colors *colors, CELL min, CELL max)
00007 {
00008 G_init_colors (colors);
00009 return add_gyr_colors (colors, (DCELL) min, (DCELL) max);
00010 }
00011
00012 int
00013 G_make_gyr_fp_colors (struct Colors *colors, DCELL min, DCELL max)
00014 {
00015 G_init_colors (colors);
00016 return add_gyr_colors (colors, min, max);
00017 }
00018
00019 int
00020 G_add_gyr_colors (struct Colors *colors, CELL min, CELL max)
00021 {
00022 return add_gyr_colors (colors, (DCELL) min, (DCELL) max);
00023 }
00024
00025 static int add_gyr_colors (struct Colors *colors, DCELL min, DCELL max)
00026 {
00027 DCELL half;
00028
00029 if (max < min) return -1;
00030 if (min == 1.) min = 0.;
00031 if (max == -1.) max = 0.;
00032
00033 half = (min+max)/2.;
00034
00035 G_add_d_raster_color_rule (&min, 0, 255, 0, &half, 255, 255, 0, colors);
00036 G_add_d_raster_color_rule (&half, 255, 255, 0, &max, 255, 0, 0, colors);
00037
00038 return 1;
00039 }