X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=pumpkin-books.ps.pl;h=2b3dbbe275ba637b3d2d9804fa3c79c5fa4390f4;hb=HEAD;hp=825d3f4c5f2b4ae74a5a59139998f55dcefc99f8;hpb=96e8cb6507e6d4d607dac3ab37150e82ea2b803a;p=quacks.git diff --git a/pumpkin-books.ps.pl b/pumpkin-books.ps.pl index 825d3f4..2b3dbbe 100755 --- a/pumpkin-books.ps.pl +++ b/pumpkin-books.ps.pl @@ -1,75 +1,12 @@ #!/usr/bin/perl -w +# Books of Pumpkins, etc. Extensions to Quacks of Quedlinburg +# SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0 +# Copyright 2020-2021 Ian Jackson use strict; -my $pumpkin = ["255/185/15", "0 0 0"]; -my $green = ["0/238/118", "1 1 1"]; -my $red = ["1 0 0", "0 0 0"]; -my $blue = ["0 .4 1 ", "1 1 1"]; -my $yellow = ["1 1 0", "0 0 0"]; -my $moth = [" 0 0 0", "1 1 1"]; -my $purple = ["145/44/238", "0 0 0"]; -my $lotus = [("0/245/255",) x 2]; -my $white = ["1 1 1", "0 0 0"]; - -my $anychip = ['0.8', '0']; - -our $page_pre = <[0]) } fill -END - if ($pips) { - $o .= <[1]) } -END - } - my $spot = sub { - my ($x,$y) = @_; - $o .= <( 0, 0) if $pips & 1; - $spot->(-1,-1) if $pips & 6; - $spot->(+1,+1) if $pips & 6; - $spot->(-1,+1) if $pips & 4; - $spot->(+1,-1) if $pips & 4; - - $o; -} +BEGIN { unshift @INC, '.'; } +use Quacks; sub veepsspot ($) { my ($chip) = @_; @@ -104,19 +41,6 @@ grestore END } -sub ruby () { # put in gsave translate - <(1, 2, <($moth,1) } ${\ $exslash->() } ${\ $exchip->($purple,1) } ${\ $exslash->() } - ${\ anychip(2) } + ${\ $exchip->($lotus,0) } ${\ $exslash->() } + ${\ $exchip->($anychip,2) } END $o .= $exchline->(0, 4, <= 5) { - $pos -= 5; - $showpage->(); - } - $o .= <(); - $o; -} - -sub yellow_book () { - my $o = general_book($yellow, [qw(7 12 19)]); +sub book_yellow () { + my $o = general_book($yellow, [qw(5 11 19)]); $o .= <(2, 1, <($white,1) } ${\ $exslash->() } - ${\ $exchip->($anychip,1) } ${\ $exslash->() } - ${\ $exchip->($lotus,0) } -END - - $o .= $exchline->(1, 2, <($white,2) } ${\ $exslash->() } - ${\ $exchip->($anychip,2) } -END - - $o .= $exchline->(0, 4, <($white,3) } ${\ $exslash->() } - ${\ $exchip->($anychip,4) } -END - $o .= exposition(<} $oper } def END } +sub tile { + my @tiles; + my $index = 1; + + foreach my $spec (@_) { + my @datas; + foreach my $stem (split m{/}, $spec) { + my $func = $stem; + $func =~ y/-/_/; + $func = ${*::}{"book_$func"} // die "$func ?"; + my $data = $func->(); + $data .= <book-$stem.ps" or die $!; + print F $ps_framing, $data, "\nshowpage\n" or die $!; + close F or die $!; + push @datas, $data; + } + foreach my $dd (@datas) { + push @tiles, $dd; + } + $index++; + } + + my $pos = 0; + my $o = ''; + my $showpage = sub { + $o .= <= 5) { + $pos -= 5; + $showpage->(); + } + $o .= <(); + $o; +} + def_image(1, "bag"); def_image(1, "pot"); def_image(3, "droplet"); +print $ps_framing or die $!; + print "gsave\n" or die $!; -print tile( - red_book(), - green_book(), - purple_book(), - blue_book(), - lotus_book(), - yellow_book(), - [black_book_pair(), black_book_more()], - ) or die $! if 1; +print tile(@ARGV) or die $! if 1;