GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73378
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
color_str.c File Reference

GIS library - color management, named color to RGB triplet. More...

#include <string.h>
#include <grass/gis.h>
#include <grass/colors.h>
Include dependency graph for color_str.c:

Go to the source code of this file.

Functions

int G_num_standard_colors (void)
 Get number of named colors (RGB triplets) More...
 
struct color_rgb G_standard_color_rgb (int n)
 Get RGB triplet of given color. More...
 
int G_num_standard_color_names (void)
 Get number of named colors (color names) More...
 
struct color_nameG_standard_color_name (int n)
 Get color name. More...
 
int G_str_to_color (const char *str, int *red, int *grn, int *blu)
 Parse color string and set red,green,blue. More...
 

Detailed Description

GIS library - color management, named color to RGB triplet.

(C) 2001-2016 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_str.c.

Function Documentation

int G_num_standard_color_names ( void  )

Get number of named colors (color names)

Returns
number of colors

Definition at line 85 of file color_str.c.

Referenced by G_str_to_color().

int G_num_standard_colors ( void  )

Get number of named colors (RGB triplets)

Returns
number of colors

Definition at line 65 of file color_str.c.

Referenced by COM_Standard_color(), D_color_number_to_RGB(), and D_use_color().

struct color_name* G_standard_color_name ( int  n)

Get color name.

Parameters
ncolor index

Definition at line 95 of file color_str.c.

struct color_rgb G_standard_color_rgb ( int  n)

Get RGB triplet of given color.

Parameters
ncolor index

Definition at line 75 of file color_str.c.

Referenced by COM_Standard_color(), and D_color_number_to_RGB().

int G_str_to_color ( const char *  str,
int red,
int grn,
int blu 
)

Parse color string and set red,green,blue.

Parameters
strcolor string
[out]redred value
[out]grngreen value
[out]blublue value
Returns
1 OK
2 NONE
0 on error

Definition at line 112 of file color_str.c.

References color_rgb::b, color_rgb::g, G_chop(), G_debug(), G_num_standard_color_names(), G_strcasecmp(), int, name, color_name::name, color_name::number, and color_rgb::r.

Referenced by Cairo_Graph_set(), create_raster(), Gp_load_sites_thematic(), Gv_load_vect_thematic(), I_iclass_add_signature(), Nviz_color_from_str(), PNG_Graph_set(), Rast_make_histogram_eq_colors(), Rast_make_histogram_log_colors(), and Rast_parse_color_rule().