(self, view, origin=ORIGIN, **kwargs)
| 37 | Polygon.__init__(self, points=points, w=w, h=h, **kwargs) |
| 38 | |
| 39 | def build(self, view, origin=ORIGIN, **kwargs): |
| 40 | context = self.context # Get current context and builder. |
| 41 | b = context.b # This is a bit more efficient than self.b once we got context |
| 42 | p = pointOffset(self.origin, origin) |
| 43 | p = self._applyScale(view, p) |
| 44 | px, py, _ = p = self._applyAlignment(p) # Ignore z-axis for now. |
| 45 | self._applyRotation(view, p) |
| 46 | |
| 47 | doDraw = False |
| 48 | if self.fill not in (None, noColor): |
| 49 | context.fill(self.fill) |
| 50 | doDraw = True |
| 51 | |
| 52 | if self.stroke not in (None, noColor) and self.strokeWidth: |
| 53 | context.stroke(self.stroke) |
| 54 | context.strokeWidth(self.strokeWidth) |
| 55 | doDraw = True |
| 56 | |
| 57 | if doDraw: |
| 58 | context.rect(px, py, self.w, self.h) |
| 59 | |
| 60 | if self.drawAfter is not None: # Call if defined |
| 61 | self.drawAfter(self, view, p) |
| 62 | |
| 63 | # Let the view draw frame info for debugging, in case view.showFrame == |
| 64 | # True and self.isPage or if self.showFrame. Mark that we are drawing |
| 65 | # foreground here. |
| 66 | view.drawPageMetaInfo(self, p) |
| 67 | |
| 68 | # Supposedly drawing outside rotation/scaling mode, so the origin of |
| 69 | # the element is visible. |
| 70 | view.drawElementOrigin(self, origin) |
| 71 | |
| 72 | self._restoreRotation(view, p) |
| 73 | self._restoreScale(view) |
| 74 | view.drawElementInfo(self, origin) # Depends on flag 'view.showElementInfo' |
| 75 | |
| 76 | if __name__ == "__main__": |
| 77 | import doctest |
nothing calls this directly
no test coverage detected