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
cairodriver/Color.c
Go to the documentation of this file.
1
#include "
cairodriver.h
"
2
3
/* "cached" color (to avoid more color change calls than necessary) */
4
/* TODO: find a proper solution for initialization */
5
int
previous_color
= 0x7FFFFFFF;
6
7
void
Cairo_color
(
int
color)
8
{
9
G_debug
(3,
"Cairo_color: %d"
, color);
10
11
if
(color !=
previous_color
) {
12
int
r
= (color >> 16) & 0xFF;
13
int
g
= (color >> 8) & 0xFF;
14
int
b
= (color >> 0) & 0xFF;
15
16
cairo_set_source_rgba(
cairo
,
CAIROCOLOR
(r),
CAIROCOLOR
(g),
17
CAIROCOLOR
(b), 1.0);
18
previous_color
= color;
19
20
G_debug
(3,
"Set color to: %g %g %g"
,
CAIROCOLOR
(r),
CAIROCOLOR
(g),
21
CAIROCOLOR
(b));
22
}
23
}
24
25
int
Cairo_lookup_color
(
int
r
,
int
g
,
int
b
)
26
{
27
G_debug
(3,
"Cairo_lookup_color: %d %d %d"
, r, g, b);
28
29
return
(r << 16) + (g << 8) + (b << 0);
30
}
lib
cairodriver
Color.c
Generated on Wed Jun 6 2012 14:04:20 for GRASS Programmer's Manual by
1.8.1