GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
color_look.c File Reference
#include <math.h>
#include <grass/gis.h>
Include dependency graph for color_look.c:

Go to the source code of this file.

Functions

int G_lookup_colors (const CELL *cell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
 lookup an array of colors More...
 
int G_lookup_c_raster_colors (const CELL *cell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
 The same as G_lookup_colors(cell, r, g, b, set, n, colors). More...
 
int G_lookup_raster_colors (const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, RASTER_MAP_TYPE map_type)
 If the cell_type is CELL_TYPE, calls G_lookup_colors((CELL *)cell, r, g, b, set, n, colors); If the cell_type is FCELL_TYPE, calls G_lookup_f_raster_colors(FCELL *)cell, r, g, b, set, n, colors); If the cell_type is DCELL_TYPE, calls G_lookup_d_raster_colors(DCELL *)cell, r, g, b, set, n, colors);. More...
 
int G_lookup_f_raster_colors (const FCELL *fcell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
 Converts the n floating-point values in the fcell array to their r,g,b color components. Embedded NULL-values are handled properly as well. More...
 
int G_lookup_d_raster_colors (const DCELL *dcell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
 Converts the n floating-point values in the dcell array to their r,g,b color components. Embedded NULL-values are handled properly as well. More...
 
int G__lookup_colors (const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, int mod, int rules_only, RASTER_MAP_TYPE data_type)
 
int G__interpolate_color_rule (DCELL val, unsigned char *red, unsigned char *grn, unsigned char *blu, const struct _Color_Rule_ *rule)
 

Function Documentation

int G__interpolate_color_rule ( DCELL  val,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
const struct _Color_Rule_ *  rule 
)

Definition at line 446 of file color_look.c.

References int.

Referenced by G__lookup_colors().

int G__lookup_colors ( const void *  raster,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors *  colors,
int  mod,
int  rules_only,
RASTER_MAP_TYPE  data_type 
)
int G_lookup_c_raster_colors ( const CELL *  cell,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors *  colors 
)

The same as G_lookup_colors(cell, r, g, b, set, n, colors).

Parameters
cell
r
g
b
set
n
colors
Returns
int

Definition at line 76 of file color_look.c.

References G__lookup_colors(), G__organize_colors(), and G_zero().

Referenced by G_lookup_colors().

int G_lookup_colors ( const CELL *  cell,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors *  colors 
)

lookup an array of colors

Extracts colors for an array of raster values. The colors for the n values in the raster array are stored in the red, green, and blue arrays. The values in the set array will indicate if the corresponding raster value has a color or not (1 means it does, 0 means it does not). The programmer must allocate the red, green, blue, and set arrays to be at least dimension n. Note. The red, green, and blue intensities will be in the range 0 -­ 255.

Parameters
raster
red
green
blue
set
n
colors
Returns
int

Modified to return a color for NULL-values.

Returns
int

Definition at line 38 of file color_look.c.

References G_lookup_c_raster_colors().

Referenced by G_get_color(), Gs_build_256lookup(), and Gs_pack_colors().

int G_lookup_d_raster_colors ( const DCELL *  dcell,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors *  colors 
)

Converts the n floating-point values in the dcell array to their r,g,b color components. Embedded NULL-values are handled properly as well.

Parameters
dcell
r
g
b
set
n
colors
Returns
int

Definition at line 193 of file color_look.c.

References G__lookup_colors(), G__organize_colors(), and G_zero().

int G_lookup_f_raster_colors ( const FCELL *  fcell,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors *  colors 
)

Converts the n floating-point values in the fcell array to their r,g,b color components. Embedded NULL-values are handled properly as well.

Parameters
fcell
r
g
b
set
n
colors
Returns
int

Definition at line 155 of file color_look.c.

References G__lookup_colors(), G__organize_colors(), and G_zero().

Referenced by Gs_pack_colors_float().

int G_lookup_raster_colors ( const void *  raster,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors *  colors,
RASTER_MAP_TYPE  map_type 
)

If the cell_type is CELL_TYPE, calls G_lookup_colors((CELL *)cell, r, g, b, set, n, colors); If the cell_type is FCELL_TYPE, calls G_lookup_f_raster_colors(FCELL *)cell, r, g, b, set, n, colors); If the cell_type is DCELL_TYPE, calls G_lookup_d_raster_colors(DCELL *)cell, r, g, b, set, n, colors);.

Parameters
rast
r
g
b
set
n
colors
cell_type
Returns
int

Definition at line 118 of file color_look.c.

References G__lookup_colors(), G__organize_colors(), and G_zero().

Referenced by D_draw_raster_RGB(), G_get_raster_color(), and G_get_raster_row_colors().