Draw registration mark as position x, y. >>> from pagebot.toolbox.units import pt >>> from pagebot import getContext >>> context = getContext('Flat') >>> context.newPage(pt(100), pt(100)) >>> drawRegistrationMark(context, pt(0,0), pt(20), pt(1), True)
(context, origin, cmSize, cmStrokeWidth, vertical)
| 18 | from pagebot.toolbox.color import color, noColor |
| 19 | |
| 20 | def drawRegistrationMark(context, origin, cmSize, cmStrokeWidth, vertical): |
| 21 | """Draw registration mark as position x, y. |
| 22 | |
| 23 | >>> from pagebot.toolbox.units import pt |
| 24 | >>> from pagebot import getContext |
| 25 | >>> context = getContext('Flat') |
| 26 | >>> context.newPage(pt(100), pt(100)) |
| 27 | >>> drawRegistrationMark(context, pt(0,0), pt(20), pt(1), True) |
| 28 | """ |
| 29 | x, y = origin |
| 30 | if vertical: |
| 31 | dx = cmSize/2 |
| 32 | dy = cmSize |
| 33 | else: |
| 34 | dx = cmSize |
| 35 | dy = cmSize/2 |
| 36 | context.fill(noColor) |
| 37 | context.stroke(color(c=1, m=1, y=1, k=1), w=cmStrokeWidth) |
| 38 | context.newPath() |
| 39 | # Registration circle |
| 40 | context.oval(x - cmSize/4, y - cmSize/4, cmSize/2, cmSize/2) |
| 41 | # Registration cross, in length of direction. |
| 42 | context.moveTo((x - dx, y)) # Horizontal line. |
| 43 | context.lineTo((x + dx, y)) |
| 44 | context.moveTo((x, y + dy)) # Vertical line. |
| 45 | context.lineTo((x, y - dy)) |
| 46 | context.drawPath() |
| 47 | |
| 48 | def drawRegistrationMarks(context, origin, w, h, cmSize, cmStrokeWidth): |
| 49 | """Draw standard registration mark, to show registration of CMYK colors. |