GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
driver/Color.c
Go to the documentation of this file.
1 #include <grass/colors.h>
2 #include "driver.h"
3 #include "driverlib.h"
4 
5 int DRV_lookup_color(int r, int g, int b)
6 {
7  if (driver->lookup_color)
8  return (*driver->lookup_color) (r, g, b);
9  return 0;
10 }
11 
12 void DRV_color(int number)
13 {
14  if (driver->color)
15  (*driver->color) (number);
16 }
17 
18 
19 void COM_Color_RGB(unsigned char r, unsigned char g, unsigned char b)
20 {
21  DRV_color(DRV_lookup_color(r, g, b));
22 }
23 
24 void COM_Standard_color(int number)
25 {
26  struct color_rgb rgb;
27 
28  if (number < 0 || number >= G_num_standard_colors())
29  return;
30 
31  rgb = G_standard_color_rgb(number);
32  COM_Color_RGB(rgb.r, rgb.g, rgb.b);
33 }
int G_num_standard_colors(void)
Get number of named colors (RGB triplets)
Definition: color_str.c:65
float b
Definition: named_colr.c:8
float r
Definition: named_colr.c:8
void COM_Standard_color(int number)
Definition: driver/Color.c:24
int DRV_lookup_color(int r, int g, int b)
Definition: driver/Color.c:5
void(* color)(int)
Definition: driver.h:59
float g
Definition: named_colr.c:8
void DRV_color(int number)
Definition: driver/Color.c:12
Definition: driver.h:25
int(* lookup_color)(int, int, int)
Definition: driver.h:58
void COM_Color_RGB(unsigned char r, unsigned char g, unsigned char b)
Definition: driver/Color.c:19
struct color_rgb G_standard_color_rgb(int n)
Get RGB triplet of given color.
Definition: color_str.c:75