GRASS 8 Programmer's Manual 8.6.0dev(2026)-18d31b9522
Loading...
Searching...
No Matches
color_rule_get.c File Reference

Raster Library - Get color rules. More...

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

Go to the source code of this file.

Functions

int Rast_colors_count (const struct Colors *colors)
 Get both modular and fixed rules count.
 
int Rast_get_fp_color_rule (DCELL *val1, unsigned char *r1, unsigned char *g1, unsigned char *b1, DCELL *val2, unsigned char *r2, unsigned char *g2, unsigned char *b2, const struct Colors *colors, int rule)
 Get color rule from both modular and fixed rules.
 

Detailed Description

Raster Library - Get color rules.

SPDX-FileCopyrightText: 2001-2009 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later

Author
Original author CERL

Definition in file color_rule_get.c.

Function Documentation

◆ Rast_colors_count()

int Rast_colors_count ( const struct Colors *  colors)

Get both modular and fixed rules count.

Parameters
colorspointer to color table structure
Returns
number of rules in color table

Definition at line 22 of file color_rule_get.c.

References count, Colors::fixed, Colors::modular, and _Color_Rule_::next.

Referenced by Rast_print_colors(), and Rast_print_json_colors().

◆ Rast_get_fp_color_rule()

int Rast_get_fp_color_rule ( DCELL *  val1,
unsigned char *  r1,
unsigned char *  g1,
unsigned char *  b1,
DCELL *  val2,
unsigned char *  r2,
unsigned char *  g2,
unsigned char *  b2,
const struct Colors *  colors,
int  rule 
)

Get color rule from both modular and fixed rules.

Rules are returned in the order as stored in the table (i.e. unexpected, high values first)

Parameters
val1color value
[out]r1,g1,b1color value
val2color value
[out]r2,g2,b2color value
colorspointer to color table structure
rulerule index from 0 to G_color_count()-1
Returns
0 success
1 index out of range

Definition at line 64 of file color_rule_get.c.

References Colors::fixed, and Colors::modular.

Referenced by Rast_print_colors(), and Rast_print_json_colors().