1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
int set_color(cairo_t *c, char *str) {
if (strcmp("BLACK", str) == 0) {
cairo_set_source_rgb (c, 0.0, 0.0, 0.0);
}
if (strcmp("RED", str) == 0) {
cairo_set_source_rgb (c, 255.0, 0.0, 0.0);
}
if (strcmp("GREEN", str) == 0) {
cairo_set_source_rgb (c, 0.0, 255.0, 0.0);
}
if (strcmp("BLUE", str) == 0) {
cairo_set_source_rgb (c, 0.0, 0.0, 255.0);
}
if (strcmp("GREY", str) == 0) {
cairo_set_source_rgb (c, 128.0, 128.0, 128.0);
}
return(0);
}
|