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

Function drawRegistrationMark

Lib/pagebot/toolbox/markers.py:20–46  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

18from pagebot.toolbox.color import color, noColor
19
20def 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
48def drawRegistrationMarks(context, origin, w, h, cmSize, cmStrokeWidth):
49 """Draw standard registration mark, to show registration of CMYK colors.

Callers 1

drawRegistrationMarksFunction · 0.85

Calls 8

colorFunction · 0.90
fillMethod · 0.45
strokeMethod · 0.45
newPathMethod · 0.45
ovalMethod · 0.45
moveToMethod · 0.45
lineToMethod · 0.45
drawPathMethod · 0.45

Tested by

no test coverage detected