GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
psdriver/Color.c
Go to the documentation of this file.
1 
2 #include <grass/gis.h>
3 #include "psdriver.h"
4 
5 void PS_color(int number)
6 {
7  if (number >= NCOLORS || number < 0) {
8  G_warning("Color: can't set color %d\n", number);
9  return;
10  }
11 
12  if (true_color) {
13  int r = (number >> 16) & 0xFF;
14  int g = (number >> 8) & 0xFF;
15  int b = (number >> 0) & 0xFF;
16 
17  output("%d %d %d COLOR\n", r, g, b);
18  }
19  else
20  output("%d GRAY\n", number);
21 }