Draw standard registration mark, to show registration of CMYK colors. https://en.wikipedia.org/wiki/Printing_registration. >>> from pagebot import getContext >>> from pagebot.elements.views.pageview import PageView >>> context = getContext() >>> from pagebot
(self, e, origin)
| 833 | e.context.line((x, y + dy), (x, y - dy)) # Vertical line. |
| 834 | |
| 835 | def drawRegistrationMarks(self, e, origin): |
| 836 | """Draw standard registration mark, to show registration of CMYK colors. |
| 837 | |
| 838 | https://en.wikipedia.org/wiki/Printing_registration. |
| 839 | |
| 840 | >>> from pagebot import getContext |
| 841 | >>> from pagebot.elements.views.pageview import PageView |
| 842 | >>> context = getContext() |
| 843 | >>> from pagebot.elements.element import Element |
| 844 | >>> from pagebot.style import getRootStyle |
| 845 | >>> style = getRootStyle() # Get default values |
| 846 | >>> e = Element() # Works on generic elements as well as pages. |
| 847 | >>> view = PageView(context=context, style=style) |
| 848 | >>> view.showRegistrationMarks = True |
| 849 | >>> view.drawRegistrationMarks(e, pt(0, 0)) |
| 850 | """ |
| 851 | if (self.showRegistrationMarks and e.isPage) or e.showRegistrationMarks: |
| 852 | # TODO: Make cropmark go closer to page edge and disappear if too small. |
| 853 | cmSize = min(self.pl/2, self.css('viewCropMarkSize')) |
| 854 | cmStrokeWidth = self.css('viewCropMarkStrokeWidth') |
| 855 | x, y = point2D(origin) |
| 856 | w, h = e.size |
| 857 | # Bottom registration mark. |
| 858 | self._drawRegistrationMark(e, (x + w/2, y - cmSize), cmSize, cmStrokeWidth, False) |
| 859 | # Left registration mark. |
| 860 | self._drawRegistrationMark(e, (x - cmSize, y + h/2), cmSize, cmStrokeWidth, True) |
| 861 | # Right registration mark. |
| 862 | self._drawRegistrationMark(e, (x + w + cmSize, y + h/2), cmSize, cmStrokeWidth, True) |
| 863 | # Top registration mark. |
| 864 | self._drawRegistrationMark(e, (x + w/2, y + h + cmSize), cmSize, cmStrokeWidth, False) |
| 865 | |
| 866 | def drawCropMarks(self, e, origin): |
| 867 | """If the show flag is set, then draw the cropmarks or page frame. |
no test coverage detected