00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <grass/gis.h>
00013
00014 static int add_grey_scale_colors (struct Colors *, DCELL, DCELL);
00015
00016
00029 int
00030 G_make_grey_scale_colors (struct Colors *colors, CELL min, CELL max)
00031 {
00032 G_init_colors (colors);
00033 return add_grey_scale_colors (colors,(DCELL)min,(DCELL)max);
00034 }
00035
00036 int
00037 G_make_grey_scale_fp_colors (struct Colors *colors, double min, double max)
00038 {
00039 G_init_colors (colors);
00040 return add_grey_scale_colors (colors,min,max);
00041 }
00042
00043 int
00044 G_make_grey_scale (
00045 struct Colors *colors,
00046 CELL min,
00047 CELL max
00048 )
00049 {
00050 return G_make_grey_scale_colors(colors,min,max);
00051 }
00052
00053 int
00054 G_add_grey_scale_colors (struct Colors *colors, CELL min, CELL max)
00055 {
00056 return add_grey_scale_colors (colors,(DCELL)min,(DCELL)max);
00057 }
00058
00059 static int add_grey_scale_colors (struct Colors *colors, DCELL min, DCELL max)
00060 {
00061 if(min > max) return -1;
00062 if (min == 1.) min = 0.;
00063 if (max == -1.) max = 0.;
00064 G_add_d_raster_color_rule (&min,0,0,0, &max,255,255,255, colors) ;
00065 return 1;
00066 }