From 21ed1314aab3887604dc22326811b35bfe7b2abd Mon Sep 17 00:00:00 2001 From: Richard Bryan Date: Tue, 25 Aug 2015 17:32:15 -0400 Subject: [PATCH] support multiple polygon path in FillBetweenItem addresses issue #220 by supportng fills between finite-connected curves --- pyqtgraph/graphicsItems/FillBetweenItem.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pyqtgraph/graphicsItems/FillBetweenItem.py b/pyqtgraph/graphicsItems/FillBetweenItem.py index d297ee63..0efb11dd 100644 --- a/pyqtgraph/graphicsItems/FillBetweenItem.py +++ b/pyqtgraph/graphicsItems/FillBetweenItem.py @@ -70,11 +70,14 @@ class FillBetweenItem(QtGui.QGraphicsPathItem): path = QtGui.QPainterPath() transform = QtGui.QTransform() - p1 = paths[0].toSubpathPolygons(transform) - p2 = paths[1].toReversed().toSubpathPolygons(transform) - if len(p1) == 0 or len(p2) == 0: + ps1 = paths[0].toSubpathPolygons(transform) + ps2 = paths[1].toReversed().toSubpathPolygons(transform) + ps2.reverse() + if len(ps1) == 0 or len(ps2) == 0: self.setPath(QtGui.QPainterPath()) return - - path.addPolygon(p1[0] + p2[0]) + + + for p1, p2 in zip(ps1, ps2): + path.addPolygon(p1 + p2) self.setPath(path)