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

Method _getShape

Lib/pagebot/contexts/flatcontext/flatcontext.py:1013–1030  ·  view source on GitHub ↗

Renders Pagebot FlatBuilder shape to a Flat shape.

(self)

Source from the content-addressed store, hash-verified

1011 return self.b.rgb(*to255(c.rgb))
1012
1013 def _getShape(self):
1014 """Renders Pagebot FlatBuilder shape to a Flat shape."""
1015 # TODO: Move inside FlatBezierpath.
1016 #if self._fill is noColor and self._stroke is noColor:
1017 # self._fill = whiteColor
1018 shape = self.b.shape()
1019
1020 if self._fill and self._fill != noColor:
1021 shape.fill(self.getFlatRGB(self._fill))
1022 else:
1023 shape.nofill()
1024
1025 if self._stroke and self._stroke != noColor:
1026 shape.stroke(self.getFlatRGB(self._stroke)).width(self._strokeWidth)
1027 else:
1028 shape.nostroke()
1029
1030 return shape
1031
1032 def rect(self, x, y, w, h):
1033 """Calculates rectangle points by combining (x, y) with width and

Callers 5

rectMethod · 0.95
ovalMethod · 0.95
circleMethod · 0.95
lineMethod · 0.95
drawShapePathMethod · 0.95

Calls 3

getFlatRGBMethod · 0.95
fillMethod · 0.45
strokeMethod · 0.45

Tested by

no test coverage detected