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

Go to the source code of this file.

Functions

int D_translate_color (const char *str)
 color name to number More...
 
int D_parse_color (const char *str, int none_acceptable)
 color option text to usable color number More...
 
int D_raster_use_color (int color)
 draw with a color from D_parse_color More...
 
int D_color_number_to_RGB (int color, int *r, int *g, int *b)
 get RGB values from color number More...
 

Function Documentation

int D_color_number_to_RGB ( int  color,
int r,
int g,
int b 
)

get RGB values from color number

Translates the color number provided by D_parse_color into 0-255 RGB values.

Returns 1 if color can be used to draw (is good and isn't 'none'), 0 otherwise.

Parameters
color_number
red
green
blue
Returns
int

Definition at line 183 of file tran_colr.c.

References tools::color, G_num_standard_colors(), and G_standard_color_rgb().

int D_parse_color ( const char *  str,
int  none_acceptable 
)

color option text to usable color number

Converts or looks up the color provided in the string. Returns a color number usable by D_raster_use_color. If the color does not exist exits with a fatal error and message. If the color is none and none_acceptable is not true exits with a fatal error and message.

Parameters
name_or_code
none_acceptable
Returns
int

Definition at line 123 of file tran_colr.c.

References tools::color, and G_fatal_error().

Referenced by D_erase().

int D_raster_use_color ( int  color)

draw with a color from D_parse_color

Calls R_color or R_standard_color to use the color provided by D_parse_color. Returns 1 if color can be used to draw (is good and isn't none), 0 otherwise.

Parameters
color
Returns
int

Definition at line 146 of file tran_colr.c.

References tools::color, G_num_standard_colors(), R_RGB_color(), and R_standard_color().

Referenced by D_erase().

int D_translate_color ( const char *  str)

color name to number

Takes a color name in ascii and returns the color number for that color. Returns 0 if color is not known. The color number returned is for lines and text, not raster graphics.

Parameters
name
Returns
int

Definition at line 27 of file tran_colr.c.

References G_num_standard_color_names(), G_standard_color_name(), G_strcasecmp(), and render::name.

Referenced by D_full_screen(), D_reset_screen_window(), D_set_cur_wind(), and D_setup().