GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-602118adcc
color_set.c File Reference

Raster Library - Set colors for raster maps. More...

#include <grass/gis.h>
#include <grass/raster.h>
Include dependency graph for color_set.c:

Go to the source code of this file.

Functions

void Rast_set_c_color (CELL cat, int r, int g, int b, struct Colors *colors)
 Set a category color (CELL) More...
 
void Rast_set_d_color (DCELL val, int r, int g, int b, struct Colors *colors)
 Set a category color (DCELL) More...
 
void Rast_set_null_value_color (int red, int grn, int blu, struct Colors *colors)
 Set color for NULL-value. More...
 
void Rast_set_default_color (int red, int grn, int blu, struct Colors *colors)
 Set default color value. More...
 

Detailed Description

Raster Library - Set colors for raster maps.

(C) 2001-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Original author CERL

Definition in file color_set.c.

Function Documentation

◆ Rast_set_c_color()

void Rast_set_c_color ( CELL  cat,
int  r,
int  g,
int  b,
struct Colors colors 
)

Set a category color (CELL)

The red, green, and blue intensities for the color associated with category cat are set in the colors structure. The intensities must be in the range 0 - 255. Values below zero are set as zero, values above 255 are set as 255.

Warning: Use of this routine is discouraged because it defeats the new color logic.

It is provided only for backward compatibility. Overuse can create large color tables. Rast_add_c_color_rule() should be used whenever possible.

Note: The colors structure must have been initialized by G_init_color().

Parameters
catraster cell value
rred value
ggreen value
bblue value
colorspointer to Colors structure which holds color info

Definition at line 41 of file color_set.c.

◆ Rast_set_d_color()

void Rast_set_d_color ( DCELL  val,
int  r,
int  g,
int  b,
struct Colors colors 
)

Set a category color (DCELL)

See Rast_set_c_color() for detailed information.

Parameters
valraster cell value
rred value
ggreen value
bblue value
colorspointer to Colors structure which holds color info

Definition at line 60 of file color_set.c.

◆ Rast_set_default_color()

void Rast_set_default_color ( int  red,
int  grn,
int  blu,
struct Colors colors 
)

Set default color value.

Sets the default color (in colors) to red, green, blue. This is the color for values which do not have an explicit rule.

Parameters
redred value
grngreen value
blublue value
colorspointer to Colors structure which holds color info

Definition at line 99 of file color_set.c.

Referenced by Rast_abs_log_colors(), and Rast_log_colors().

◆ Rast_set_null_value_color()

void Rast_set_null_value_color ( int  red,
int  grn,
int  blu,
struct Colors colors 
)

Set color for NULL-value.

Sets the color (in colors) for the NULL-value to red, green, blue.

Parameters
redred value
grngreen value
blublue value
colorspointer to Colors structure which holds color info

Definition at line 79 of file color_set.c.

Referenced by Rast_abs_log_colors(), and Rast_log_colors().