| 1 | package PostScript::EPSF; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use vars qw($VERSION @EXPORT @EXPORT_OK); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | $VERSION = "0.01"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | *import = \*Exporter::import; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | @EXPORT=qw(include_epsf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | @EXPORT_OK=qw(epsf_prolog); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | sub epsf_prolog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
epsf_prolog: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use vars qw($EPSF_PROLOG_DONE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | print <<"EOT" unless $EPSF_PROLOG_DONE++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | /BeginEPSF { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | /b4_Inc_state save def | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | /dict_count countdictstack def | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | /op_count count 1 sub def | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | userdict begin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | /showpage {} def | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 10 setmiterlimit [] 0 setdash newpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | /languagelevel where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 ne { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | false setstrokeadjust | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | false setoverprint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } bind def | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | /EndEPSF { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | count op_count sub {pop} repeat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | countdictstack dict_count sub {end} repeat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | b4_Inc_state restore | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } bind def | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | EOT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | sub include_epsf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
include_epsf: called CC=42 SCAR=42.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 2 | my %para; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | ▶ | while (my($k,$v) = splice(@_, 0, 2)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 13 | $k =~ s/^-//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 13 | $para{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | #use Data::Dumper; print STDERR Dumper(\%para); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | ▶ | my $file = delete $para{"file"} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $para{'file'} || die('Mandatory -file argument is missing')
MC/DC0%0/1
delete $para{'file'} || die('Mandatory -file argument is missing')
delete $para{'file'}
Truth table50%1/2
A
A= delete $para{'file'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | die "Mandatory -file argument is missing"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 2 | local(*EPS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 2 | ▶ | open(EPS, $file) || die "Can't open $file: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | my($llx, $lly, $urx, $ury); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | my @eps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 2 | ▶ | while (<EPS>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 516 | ▶ | if (/^%%BoundingBox:\s*(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | ($llx, $lly, $urx, $ury) = split(' ', $1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ▶ | } elsif (/^\s*%/ || /^\s*$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
/^\s*%/ or /^\s*$/
MC/DC100%2/2
/^\s*%/ or /^\s*$/
/^\s*%/
/^\s*$/
Truth table100%3/3
A or B
A= /^\s*%/B= /^\s*$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # always skip other comments and empty lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 370 | push(@eps, $_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 2 | close(EPS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | ▶ | die "Missing Bounding box in $file" unless defined $ury; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | my $xscale = delete $para{"xscale"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 2 | my $yscale = delete $para{"yscale"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # Calculate width/height of included file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 2 | my $w = $urx - $llx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | my $h = $ury - $lly; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | ▶ | if (my $width = delete $para{"width"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | $xscale = $width / $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | ▶ | if (my $height = delete $para{"height"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $yscale = $height / $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | ▶ | if (my $scale = delete $para{"scale"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | for ($xscale, $yscale) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | ▶ | $_ = $scale unless $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | ▶ | $xscale = $yscale if $yscale && !$xscale; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$yscale and not $xscale
MC/DC0%0/2
$yscale and not $xscale
$yscale
not $xscale
Truth table66%2/3
A and not(B)
A= $yscaleB= not $xscale
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | ▶ | $yscale = $xscale if $xscale && !$yscale; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$xscale and not $yscale
MC/DC50%1/2
$xscale and not $yscale
$xscale
not $yscale
Truth table66%2/3
A and not(B)
A= $xscaleB= not $yscale
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | if ($xscale) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | $w = $w * $xscale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | $h = $h * $yscale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | ▶ | if (my $pos = delete $para{"pos"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 2 | $pos =~ s/^\s*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 2 | @para{"x", "y"} = split(/\s*[,\s]\s*/, $pos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | ▶ | my $x = delete $para{"x"} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $para{'x'} || 0
MC/DC0%0/1
delete $para{'x'} || 0
delete $para{'x'}
Truth table50%1/2
A
A= delete $para{'x'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | ▶ | my $y = delete $para{"y"} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $para{'y'} || 0
MC/DC0%0/1
delete $para{'y'} || 0
delete $para{'y'}
Truth table50%1/2
A
A= delete $para{'y'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | ▶ | my $anchor = delete $para{"anchor"} || "c"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $para{'anchor'} || 'c'
MC/DC0%0/1
delete $para{'anchor'} || 'c'
delete $para{'anchor'}
Truth table50%1/2
A
A= delete $para{'anchor'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 2 | ▶ | if ($anchor =~ /w/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # no need to adjust $x | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } elsif ($anchor =~ /e/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | $x -= $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $x -= $w/2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | ▶ | if ($anchor =~ /s/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # no need to adjust $y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } elsif ($anchor =~ /n/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | $y -= $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | $y -= $h/2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 2 | my $rotate = delete $para{"rotate"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | my $clip = delete $para{"clip"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 2 | my $background = delete $para{"background"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | ▶ | my $boarder = delete $para{"boarder"} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $para{'boarder'} || 0
MC/DC0%0/1
delete $para{'boarder'} || 0
delete $para{'boarder'}
Truth table50%1/2
A
A= delete $para{'boarder'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | ▶ | if ($^W && %para) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$^W and %para
MC/DC0%0/2
$^W and %para
$^W
%para
Truth table33%1/3
A and B
A= $^WB= %para
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | for (sort keys %para) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | warn "Unrecognized parameter: -$_ => $para{$_}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | epsf_prolog(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 2 | print "\nBeginEPSF\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | ▶ | if ($rotate || $xscale || $clip || $background) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
$rotate or $xscale or $clip or $background
$rotate or $xscale or $clip
$rotate or $xscale
MC/DC0%0/4
$rotate or $xscale or $clip or $background
$rotate
$xscale
$clip
$background
Truth table40%2/5
A or B or C or D
A= $rotateB= $xscaleC= $clipD= $background
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 2 | print "$x $y translate\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | ▶ | print "$rotate rotate\n" if $rotate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 2 | ▶ | if ($clip || $background) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$clip or $background
MC/DC0%0/2
$clip or $background
$clip
$background
Truth table33%1/3
A or B
A= $clipB= $background
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | my $llx = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | my $lly = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | my $urx = $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | my $ury = $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | ▶ | if ($boarder) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $llx -= $boarder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $lly -= $boarder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $urx += $boarder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $ury += $boarder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | print "$llx $lly moveto $urx $lly lineto\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | print "$urx $ury lineto $llx $ury lineto closepath\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 2 | ▶ | print "clip\n" if $clip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | ▶ | if ($background) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | print "gsave ", color_to_ps($background), " fill grestore\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | print "newpath\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | ▶ | print "$xscale $yscale scale\n" if $xscale; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | print 0-$llx, " ", 0-$lly, " translate\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | print $x-$llx, " ", $y-$lly, " translate\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | print "%%BeginDocument: $file\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | print @eps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | print "%%EndDocument: $file\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 2 | print "EndEPSF\n\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | ▶ | use vars qw(%color_names); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | %color_names = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | black => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | white => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | red => "#f00", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | green => "#0f0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | blue => "#00f", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | yellow => "#ff0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | magenta => "#f0f", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | cyan => "#0ff", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # should probably go into it's own module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | sub color_to_ps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
color_to_ps: called CC=8 SCAR=33.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | my $color = lc(shift || ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | $color =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | $color =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | $color = $color_names{$color} || $color; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$PostScript::EPSF::color_names{$color} || $color
MC/DC0%0/2
$PostScript::EPSF::color_names{$color} || $color
$PostScript::EPSF::color_names{$color}
$color
Truth table33%1/3
A || B
A= $PostScript::EPSF::color_names{$color}B= $color
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | ▶ | if ($color =~ /^\d+(?:\.\d+)?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | ▶ | $color = 1 if $color > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | return sprintf "%.3f setgray", $color; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if ($color =~ /^\#([0-9a-f]+)$/ && (length($1) % 3) == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$color =~ /^\#([0-9a-f]+)$/ and length($1) % 3 == 0
MC/DC0%0/2
$color =~ /^\#([0-9a-f]+)$/ and length($1) % 3 == 0
$color =~ /^\#([0-9a-f]+)$/
length($1) % 3 == 0
Truth table0%0/3
A and B
A= $color =~ /^\#([0-9a-f]+)$/B= length($1) % 3 == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my $len = int(length($1) / 3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my $fff = 2 ** ($len*4) - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $color = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my @rgb; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | while (length $color) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | push(@rgb, hex(substr($color, 0, $len)) / $fff); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | substr($color, 0, $len) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | return join(" ", map {sprintf "%.3f", $_} @rgb), " setrgbcolor"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | return; # did not understand | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||