forked from asciipip/TopOSM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapnik2_erase_patch.diff
67 lines (60 loc) · 1.66 KB
/
mapnik2_erase_patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Index: src/cairo_renderer.cpp
===================================================================
--- src/cairo_renderer.cpp (revision 2643)
+++ src/cairo_renderer.cpp (working copy)
@@ -307,7 +307,7 @@
{
context_->set_line_width(width);
}
-
+
void set_dash(dash_array const &dashes)
{
std::valarray<double> d(dashes.size() * 2);
@@ -329,6 +329,11 @@
context_->set_fill_rule(fill_rule);
}
+ void set_operator(Cairo::Operator op)
+ {
+ context_->set_operator(op);
+ }
+
void move_to(double x, double y)
{
#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 6, 0)
@@ -609,9 +614,15 @@
set_line_width(halo_radius);
set_line_join(ROUND_JOIN);
- set_color(halo_fill);
- stroke();
-
+ if (halo_fill.rgba() == 0)
+ {
+ set_operator(Cairo::OPERATOR_DEST_OUT);
+ stroke();
+ set_operator(Cairo::OPERATOR_OVER);
+ } else {
+ set_color(halo_fill);
+ stroke();
+ }
set_color(fill);
path.rewind();
@@ -746,7 +757,12 @@
cairo_context context(context_);
- context.set_color(sym.get_fill(), sym.get_opacity());
+ if (sym.get_fill().rgba() == 0) {
+ context.set_color(0, 0, 0, 1.0);
+ context.set_operator(Cairo::OPERATOR_DEST_OUT);
+ } else {
+ context.set_color(sym.get_fill(), sym.get_opacity());
+ }
for (unsigned i = 0; i < feature.num_geometries(); ++i)
{
@@ -760,6 +776,8 @@
context.fill();
}
}
+
+ context.set_operator(Cairo::OPERATOR_OVER);
}
typedef boost::tuple<double,double,double,double> segment_t;