... | ... |
@@ -263,10 +263,11 @@ class LineShape(Shape): |
263 | 263 |
|
264 | 264 |
class BezierShape(Shape): |
265 | 265 |
|
266 |
- def __init__(self, pen, points): |
|
266 |
+ def __init__(self, pen, points, filled=False): |
|
267 | 267 |
Shape.__init__(self) |
268 | 268 |
self.pen = pen.copy() |
269 | 269 |
self.points = points |
270 |
+ self.filled = filled |
|
270 | 271 |
|
271 | 272 |
def draw(self, cr, highlight=False): |
272 | 273 |
x0, y0 = self.points[0] |
... | ... |
@@ -277,10 +278,15 @@ class BezierShape(Shape): |
277 | 278 |
x3, y3 = self.points[i + 2] |
278 | 279 |
cr.curve_to(x1, y1, x2, y2, x3, y3) |
279 | 280 |
pen = self.select_pen(highlight) |
280 |
- cr.set_dash(pen.dash) |
|
281 |
- cr.set_line_width(pen.linewidth) |
|
282 |
- cr.set_source_rgba(*pen.color) |
|
283 |
- cr.stroke() |
|
281 |
+ if self.filled: |
|
282 |
+ cr.set_source_rgba(*pen.fillcolor) |
|
283 |
+ cr.fill_preserve() |
|
284 |
+ cr.fill() |
|
285 |
+ else: |
|
286 |
+ cr.set_dash(pen.dash) |
|
287 |
+ cr.set_line_width(pen.linewidth) |
|
288 |
+ cr.set_source_rgba(*pen.color) |
|
289 |
+ cr.stroke() |
|
284 | 290 |
|
285 | 291 |
|
286 | 292 |
class CompoundShape(Shape): |
... | ... |
@@ -564,6 +570,11 @@ class XDotAttrParser: |
564 | 570 |
elif op == "B": |
565 | 571 |
p = self.read_polygon() |
566 | 572 |
shapes.append(BezierShape(pen, p)) |
573 |
+ elif op == "b": |
|
574 |
+ p = self.read_polygon() |
|
575 |
+ # xdot uses this to mean "draw a filled shape with an outline" |
|
576 |
+ shapes.append(BezierShape(pen, p, filled=True)) |
|
577 |
+ shapes.append(BezierShape(pen, p)) |
|
567 | 578 |
elif op == "P": |
568 | 579 |
p = self.read_polygon() |
569 | 580 |
# xdot uses this to mean "draw a filled shape with an outline" |