|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
|
#include <string.h>#include <grass/colors.h>#include <grass/display.h>#include <grass/gis.h>#include <grass/glocale.h>#include <grass/raster.h>#include "driver.h"
Go to the source code of this file.
Functions | |
| int | D_parse_color (const char *str, int none_acceptable) |
| color option text to usable color number | |
| int | D_translate_color (const char *str) |
| color name to number | |
| int | D_use_color (int color) |
| draw with a color from D_parse_color | |
| int | D_color_number_to_RGB (int color, int *r, int *g, int *b) |
| get RGB values from color number | |
| void | D_RGB_color (int red, int grn, int blu) |
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.
| color | The color number provided by D_parse_color to convert into 0-255 RGB values. |
| r | Pointer to an integer where the red component will be stored. |
| g | Pointer to an integer where the green component will be stored. |
| b | Pointer to an integer where the blue component will be stored. |
Definition at line 179 of file tran_colr.c.
References color_rgb::b, b, color_rgb::g, g, G_num_standard_colors(), G_standard_color_rgb(), color_rgb::r, and r.
color option text to usable color number
Converts or looks up the color provided in the string. Returns a color number usable by D_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.
| str | Color name or color code, as a string |
| none_acceptable |
Definition at line 103 of file tran_colr.c.
References _, and G_fatal_error().
Referenced by D_erase(), and D_translate_color().
Definition at line 213 of file tran_colr.c.
References COM_Color_RGB().
Referenced by D_color_of_type(), and D_use_color().
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.
| str | Color name as an ASCII string |
Definition at line 126 of file tran_colr.c.
References D_parse_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.
| color |
Definition at line 141 of file tran_colr.c.
References color_rgb::b, COM_Standard_color(), D_RGB_color(), color_rgb::g, G_num_standard_colors(), and color_rgb::r.
Referenced by D_erase().