24static const struct color_rgb standard_colors_rgb[] = {
43static const struct color_name standard_color_names[] = {
58 return sizeof(standard_colors_rgb) /
sizeof(standard_colors_rgb[0]);
68 return standard_colors_rgb[n];
78 return sizeof(standard_color_names) /
sizeof(standard_color_names[0]);
88 return &standard_color_names[n];
112 G_debug(3,
"G_str_to_color(): str = '%s'", buf);
117 if (
sscanf(buf,
"%d%*[,:; ]%d%*[,:; ]%d", red, grn, blu) == 3) {
128 *red = (
hex >> 16) & 0xFF;
129 *grn = (
hex >> 8) & 0xFF;
176 float diff = cmax - cmin;
181 else if (cmax ==
r_norm) {
184 else if (cmax ==
g_norm) {
195 *s = (
diff / cmax) * 100.0f;
AMI_err name(char **stream_name)
ColorFormat G_option_to_color_format(const struct Option *option)
Get color format from the option.
void G_rgb_to_hsv(int r, int g, int b, float *h, float *s, float *v)
Converts RGB color values to HSV format.
int G_num_standard_colors(void)
Get number of named colors (RGB triplets)
void G_color_to_str(int r, int g, int b, ColorFormat clr_frmt, char *str)
Parse red,green,blue and set color string.
int G_str_to_color(const char *str, int *red, int *grn, int *blu)
Parse color string and set red,green,blue.
int G_num_standard_color_names(void)
Get number of named colors (color names)
struct color_rgb G_standard_color_rgb(int n)
Get RGB triplet of given color.
const struct color_name * G_standard_color_name(int n)
Get color name.
ColorFormat
Color format identifiers (enum)
#define COLOR_STRING_LENGTH
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_chop(char *)
Chop leading and trailing white spaces.
int G_debug(int, const char *,...) __attribute__((format(printf
size_t G_strlcpy(char *, const char *, size_t)
Safe string copy function.
Structure that stores option information.