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
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
}
b
float b
Definition:
named_colr.c:8
CAIROCOLOR
#define CAIROCOLOR(a)
Definition:
cairodriver.h:21
r
float r
Definition:
named_colr.c:8
Cairo_lookup_color
int Cairo_lookup_color(int, int, int)
Definition:
cairodriver/Color.c:25
tools.color
tuple color
Definition:
tools.py:1703
cairo
cairo_t * cairo
Definition:
cairodriver/Graph.c:60
g
float g
Definition:
named_colr.c:8
cairodriver.h
Cairo_color
void Cairo_color(int)
Definition:
cairodriver/Color.c:7
G_debug
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition:
gis/debug.c:51
previous_color
int previous_color
Definition:
cairodriver/Color.c:5
lib
cairodriver
Color.c
Generated on Sat Jan 2 2016 01:46:47 for GRASS Programmer's Manual by
1.8.5