GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pngdriver/Color.c
Go to the documentation of this file.
1 /*
2  * Identify a color that has been set in the reset_color() (found in Reset_clr.c
3  * file in this directory). Subsequent graphics calls will use this color.
4  *
5  * Called by:
6  * Color() in ../lib/Color.c
7  */
8 
9 #include <grass/gis.h>
10 #include "pngdriver.h"
11 
12 void PNG_color(int number)
13 {
14  if (number >= NCOLORS || number < 0) {
15  G_warning("Color: can't set color %d\n", number);
16  return;
17  }
18 
19  if (true_color) {
20  int r = (number >> 16) & 0xFF;
21  int g = (number >> 8) & 0xFF;
22  int b = (number >> 0) & 0xFF;
23 
24  currentColor = get_color(r, g, b, 0);
25  }
26  else
27  currentColor = number;
28 }
float b
Definition: named_colr.c:8
int currentColor
float r
Definition: named_colr.c:8
void PNG_color(int number)
int true_color
int NCOLORS
Definition: driver/init.c:30
float g
Definition: named_colr.c:8
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
unsigned int get_color(int r, int g, int b, int a)