GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
psdriver/Color_table.c
Go to the documentation of this file.
1
2
#include <stdio.h>
3
#include <stdlib.h>
4
5
#include <grass/gis.h>
6
#include <grass/colors.h>
7
#include "
psdriver.h
"
8
9
void
init_color_table
(
void
)
10
{
11
NCOLORS
=
true_color
? (1 << 24) : (1 << 8);
12
}
13
14
static
int
get_color_rgb(
int
r
,
int
g
,
int
b
)
15
{
16
return
(r << 16) + (g << 8) + b;
17
}
18
19
static
int
get_color_gray(
int
r,
int
g,
int
b)
20
{
21
return
(
int
)(r * 0.299 + g * 0.587 + b * 0.114);
22
}
23
24
int
PS_lookup_color
(
int
r,
int
g,
int
b)
25
{
26
return
true_color
? get_color_rgb(r, g, b)
27
: get_color_gray(r, g, b);
28
}
lib
psdriver
Color_table.c
Generated on Sun Mar 16 2014 05:07:43 for GRASS Programmer's Manual by
1.8.1.2