color_asp.c

Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  *  G_make_aspect_colors (colors, min, max)
00004  *
00005  *   struct Colors *colors    struct to hold colors
00006  *   CELL min,max             min,max color numbers
00007  *
00008  *  Generates aspect colors that are stored in the colors structure. 
00009  *
00010  **********************************************************************/
00011 
00012 #include "gis.h"
00013 static int add_aspect_colors (struct Colors *, DCELL, DCELL);
00014 
00015 
00027 int G_make_aspect_colors (struct Colors *colors, CELL min, CELL max)
00028 {
00029     G_init_colors (colors);
00030     return add_aspect_colors (colors,(DCELL) min,(DCELL) max) ;
00031 }
00032 
00033 int G_make_aspect_fp_colors (struct Colors *colors, DCELL min, DCELL max)
00034 {
00035     G_init_colors (colors);
00036     return add_aspect_colors (colors,min,max) ;
00037 }
00038 
00039 int G_add_aspect_colors (struct Colors *colors, CELL min, CELL max)
00040 {
00041     return add_aspect_colors (colors,(DCELL) min,(DCELL) max) ;
00042 }
00043 
00044 static int add_aspect_colors (struct Colors *colors, DCELL min, DCELL max)
00045 {
00046     DCELL half;
00047 
00048     if (max < min)
00049         return -1;
00050 
00051     if (min == 1.) min = 0.;
00052     if (max == -1.) max = 0.;
00053     half = (min+max)/2.;
00054  
00055     G_add_d_raster_color_rule (&min, 0,0,0, &half, 255, 255, 255, colors);
00056     G_add_d_raster_color_rule (&half, 255, 255, 255, &max, 0,0,0, colors);
00057 
00058     return 1;
00059 }

Generated on Sat Jul 22 22:06:14 2006 for GRASS by  doxygen 1.4.7