From: Ian Jackson Date: Sat, 2 Jul 2022 10:54:10 +0000 (+0100) Subject: wip export X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4952809ec8caf1cf452b38a4e445be22f0f8e8e2;p=quacks.git wip export Signed-off-by: Ian Jackson --- diff --git a/Quacks.pm b/Quacks.pm index cc80f70..7980d03 100644 --- a/Quacks.pm +++ b/Quacks.pm @@ -11,6 +11,13 @@ use Exporter qw(import); our @EXPORT = qw( $pumpkin $green $red $blue $yellow $moth $purple $lotus $white + $anychip $black colour + + $ps_framing + + $page_pre ps_head + + arrow_any ); @@ -23,3 +30,85 @@ our $moth = [" 0 0 0", "1 1 1"]; our $purple = ["145/44/238", "0 0 0"]; our $lotus = [("0/245/255",) x 2]; our $white = ["1 1 1", "0 0 0"]; + +our $anychip = ['0.8', '0']; +our $black = colour('0'); + +sub colour ($) { + my ($c) = @_; + if ($c =~ m{^(\d+)/(\d+)/(\d+)$}) { + return (join ' ', map { $_ / 255.0 } ($1,$2,$3)).' setrgbcolor'; + } elsif ($c =~ m/[^ 0-9.]/) { + return $c; + } elsif ($c =~ m/^\s*\S+\s*$/) { + return "$c setgray"; + } elsif ($c =~ m/./) { + return "$c setrgbcolor"; + } else { + return ''; + } +} + +our $page_pre = <