color_byg.c

Go to the documentation of this file.
00001 #include <grass/gis.h>
00002 
00003 static int add_byg_colors (struct Colors *, DCELL, DCELL);
00004 
00005 int G_make_byg_colors (struct Colors *colors, CELL min, CELL max)
00006 {
00007     G_init_colors (colors);
00008     return add_byg_colors (colors, (DCELL) min, (DCELL) max);
00009 }
00010 
00011 int 
00012 G_make_byg_fp_colors (struct Colors *colors, DCELL min, DCELL max)
00013 {
00014     G_init_colors (colors);
00015     return add_byg_colors (colors, min, max);
00016 }
00017 
00018 int 
00019 G_make_blue_yel_grn ( /* for 3.0 compatibility */
00020     struct Colors *colors,
00021     CELL min,
00022     CELL max
00023 )
00024 {
00025     return G_make_byg_colors(colors,min,max);
00026 }
00027 
00028 int 
00029 G_add_byg_colors (struct Colors *colors, CELL min, CELL max)
00030 {
00031     return add_byg_colors (colors, (DCELL) min, (DCELL) max);
00032 }
00033 
00034 static int add_byg_colors (struct Colors *colors, DCELL min, DCELL max)
00035 {
00036     DCELL mid;
00037 
00038     if (max < min) return -1;
00039     if (min == 1.) min = 0.;
00040     if (max == -1.) max = 0.;
00041 
00042     mid = (min+max)/2.;
00043 
00044     G_add_d_raster_color_rule (&min, 0, 0, 255, &mid, 255, 255, 0, colors);
00045     G_add_d_raster_color_rule (&mid, 255, 255, 0, &max, 0, 255, 0, colors);
00046 
00047     return 1;
00048 }

Generated on Wed Dec 19 14:59:05 2007 for GRASS by  doxygen 1.5.4