chiark / gitweb /
prep multispot
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Dec 2020 15:18:34 +0000 (15:18 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Dec 2020 15:18:34 +0000 (15:18 +0000)
pumpkin-books.ps.pl

index 552ef8273846d13795e4e46492602e87a2175193..4b40a1ca17e956309c69d53859a0d23871ad1220 100755 (executable)
@@ -4,22 +4,34 @@ use strict;
 
 my $green = ["1 0 1 0", "0 0 0 0"];
 
-sub chip ($) {
-  my ($cary) = @_; # put in a gsave
-  <<END;
+sub chip ($$) {
+  my ($cary, $pips) = @_; # put in a gsave
+  my $o = <<END;
   $cary->[0] setcmykcolor
   newpath
   0 0 chip 0.5 mul 0 360 arc fill
-
   $cary->[1] setcmykcolor
-  newpath
-  0 0 spot 0.5 mul 0 360 arc fill
 END
+  my $spot = sub {
+    my ($x,$y) = @_;
+    $o .= <<END;
+    newpath
+    spot 1.1 mul dup
+    $x mul exch $y mul
+    spot 0.5 mul
+    0 360 arc fill
+END
+  };
+
+  if ($pips & 1) {
+    $spot->(0,0);
+  }
+  $o;
 }
 
 sub general_book ($) {
   my ($this) = @_;
-  <<END;
+  my $o = <<END;
 %!
 
 72 25.4 div dup scale
@@ -75,17 +87,19 @@ newpath
 newpath
 -1 thirdlineh dc moveto
 0 thirdlineh dc lineto stroke
+END
 
-/token {
-    % 
-}
-
+  foreach my $costi (0..2) {
+    my $pips = qw(1 2 4)[$costi];
+    $o .= <<END
 gsave
-  -1 6 div costcirch dc translate
-
-  ${\ chip($this) }
+  -2.5 $costi add 3 div costcirch dc translate
+  ${\ chip($this,$pips) }
 grestore
 END
+  }
+
+  $o;
 }
   
 sub green_book () {