MCPcopy Create free account
hub / github.com/PageBot/PageBot / polygon

Method polygon

Lib/pagebot/contexts/flatcontext/flatcontext.py:1132–1144  ·  view source on GitHub ↗

Answers a BezierPath representation, in the data-format of self.context, translated to optional position p.

(self, *points, **kwargs)

Source from the content-addressed store, hash-verified

1130
1131
1132 def polygon(self, *points, **kwargs):
1133 """Answers a BezierPath representation, in the data-format of
1134 self.context, translated to optional position p."""
1135 path = self.newPath()
1136
1137 for pIndex, point in enumerate(points):
1138 px, py = self.getTransformed(*point)
1139 if pIndex == 0:
1140 path.moveTo((px, py))
1141 else:
1142 path.lineTo((px, py))
1143 path.closePath()
1144 self.drawShapePath()
1145
1146 # P A T H
1147

Callers 2

rectMethod · 0.45
buildMethod · 0.45

Calls 6

newPathMethod · 0.95
getTransformedMethod · 0.95
drawShapePathMethod · 0.95
moveToMethod · 0.45
lineToMethod · 0.45
closePathMethod · 0.45

Tested by

no test coverage detected