chiark / gitweb /
make book() sub
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Dec 2020 14:58:47 +0000 (14:58 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Dec 2020 14:58:47 +0000 (14:58 +0000)
pumpkin-books.ps.pl

index afe1986896d2dc788b62ef6e9443e786520a3ee7..e8f3cefcd7d4dc8bd3562fc9fd96dbd4ee9f6f7b 100755 (executable)
@@ -2,23 +2,24 @@
 
 use strict;
 
-my $thiscolour = "1 0 1 0";
-my $spotcolour = "0 0 0 0";
-
 sub chip ($$) {
   my ($this, $spot) = @_; # put in a gsave
   <<END;
-  $thiscolour setcmykcolor
+  $this setcmykcolor
   newpath
   0 0 chip 0.5 mul 0 360 arc fill
 
-  $spotcolour setcmykcolor
+  $spot setcmykcolor
   newpath
   0 0 spot 0.5 mul 0 360 arc fill
 END
 }
 
-print <<END or die $!;
+sub book () {
+  my $thiscolour = "1 0 1 0";
+  my $spotcolour = "0 0 0 0";
+
+  <<END;
 %!
 
 72 25.4 div dup scale
@@ -82,4 +83,6 @@ gsave
   ${\ chip($thiscolour, $spotcolour) }
 grestore
 END
+}
 
+print book() or die $!;