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
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 () {