aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-05-22 13:35:13 +0000
committerSimon Tatham <anakin@pobox.com>2005-05-22 13:35:13 +0000
commit3266a0e7ba5071d0392d09f2aaa11ce5d2915f7a (patch)
tree454019917561de3aa4c0fa8c86d7edf028048aa5
parent466e9d21a7094e8987a51cb2ec2b236fd049754c (diff)
downloadpuzzles-3266a0e7ba5071d0392d09f2aaa11ce5d2915f7a.zip
puzzles-3266a0e7ba5071d0392d09f2aaa11ce5d2915f7a.tar.gz
puzzles-3266a0e7ba5071d0392d09f2aaa11ce5d2915f7a.tar.bz2
puzzles-3266a0e7ba5071d0392d09f2aaa11ce5d2915f7a.tar.xz
Aesthetic improvements, mostly suggested by Gareth.
[originally from svn r5833]
-rwxr-xr-xprint.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/print.py b/print.py
index 5078abe..92c9875 100755
--- a/print.py
+++ b/print.py
@@ -123,6 +123,7 @@ def net_format(s):
scale = 0.25
bigoffset = 0.25
smalloffset = 0.17
+ squaresize = 0.25
# Set up coordinate system.
pw = gridpitch * w
ph = gridpitch * h
@@ -185,16 +186,25 @@ def net_format(s):
psprint(ret, "0 0 moveto %d %d lineto" % (dx, dy))
psprint(ret, "stroke")
# Draw additional figures if desired.
- if v == 13:
- # T-pieces have a little circular blob where the lines join.
- psprint(ret, "newpath 0 0 0.15 0 360 arc fill")
- elif v == 1:
+ if v == 1:
# Endpoints have a little empty square at the centre.
- psprint(ret, "newpath 0.35 0.35 moveto 0 -0.7 rlineto")
- psprint(ret, "-0.7 0 rlineto 0 0.7 rlineto closepath")
- psprint(ret, "gsave 1 setgray fill grestore stroke")
- # Clean up.
+ psprint(ret, "newpath %g %g moveto 0 -%g rlineto" % \
+ (squaresize, squaresize, squaresize * 2))
+ psprint(ret, "-%g 0 rlineto 0 %g rlineto closepath fill" % \
+ (squaresize * 2, squaresize * 2))
+ # Get back out of the centre section.
psprint(ret, "grestore")
+ # Draw the endpoint square in large in the middle.
+ if v == 1:
+ psprint(ret, "gsave")
+ psprint(ret, "%g %g translate" % \
+ ((x + 0.5) * gridpitch, (h - y - 0.5) * gridpitch))
+ psprint(ret, "%g dup scale" % (float(gridpitch) / 2))
+ psprint(ret, "newpath %g %g moveto 0 -%g rlineto" % \
+ (squaresize, squaresize, squaresize * 2))
+ psprint(ret, "-%g 0 rlineto 0 %g rlineto closepath fill" % \
+ (squaresize * 2, squaresize * 2))
+ psprint(ret, "grestore")
return ret.coords, ret.s
def pattern_format(s):