GRASS Programmer's Manual
6.5.svn(2014)-r66266
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
}
b
float b
Definition:
named_colr.c:8
r
float r
Definition:
named_colr.c:8
psdriver.h
true_color
int true_color
Definition:
pngdriver/Graph_set.c:28
init_color_table
void init_color_table(void)
Definition:
pngdriver/Color_table.c:77
NCOLORS
int NCOLORS
Definition:
driver/init.c:30
g
float g
Definition:
named_colr.c:8
PS_lookup_color
int PS_lookup_color(int r, int g, int b)
Definition:
psdriver/Color_table.c:24
lib
psdriver
Color_table.c
Generated on Sat Jan 2 2016 01:46:47 for GRASS Programmer's Manual by
1.8.5