def stroke_path(path, pen): """Create a QPainterPath stroke from the `path` drawn with `pen`. """ stroker = QPainterPathStroker() stroker.setCapStyle(pen.capStyle()) stroker.setJoinStyle(pen.joinStyle()) stroker.setMiterLimit(pen.miterLimit()) stroker.setWidth(max(pen.widthF(), 1e-9)) return stroker.createStroke(path)
def path_stroke(path, width=1, join_style=Qt.MiterJoin): stroke = QPainterPathStroker() stroke.setWidth(width) stroke.setJoinStyle(join_style) stroke.setMiterLimit(1.0) return stroke.createStroke(path)