color_grey.c

Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  *  G_make_grey_scale_colors (colors, min, max)
00004  *
00005  *   struct Colors *colors    struct to hold colors
00006  *   CELL min,max             min,max color numbers
00007  *
00008  *  Generates grey scale colors that are stored in the colors structure. 
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 ( /* for 3.0 compatibility */
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 }

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