« API3/Compat/API2/Basic/TTF/Mort/Subtable.pm
↑ Summary
API3/Compat/API2/Basic/TTF/Kern/Subtable.pm »
| 1 | #======================================================================= | ||||||||||||||||||||||||||
| 2 | # ____ ____ _____ _ ____ ___ ____ | ||||||||||||||||||||||||||
| 3 | # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \ | ||||||||||||||||||||||||||
| 4 | # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) | | ||||||||||||||||||||||||||
| 5 | # | __/| |_| | _| _ _ / ___ \| __/| | / __/ | ||||||||||||||||||||||||||
| 6 | # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____| | ||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||
| 8 | # A Perl Module Chain to faciliate the Creation and Modification | ||||||||||||||||||||||||||
| 9 | # of High-Quality "Portable Document Format (PDF)" Files. | ||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||
| 11 | # Copyright 1999-2005 Alfred Reibenschuh <areibens@cpan.org>. | ||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||
| 13 | #======================================================================= | ||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||
| 15 | # This library is free software; you can redistribute it and/or | ||||||||||||||||||||||||||
| 16 | # modify it under the terms of the GNU Lesser General Public | ||||||||||||||||||||||||||
| 17 | # License as published by the Free Software Foundation; either | ||||||||||||||||||||||||||
| 18 | # version 2 of the License, or (at your option) any later version. | ||||||||||||||||||||||||||
| 19 | # | ||||||||||||||||||||||||||
| 20 | # This library is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||
| 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||
| 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||||
| 23 | # Lesser General Public License for more details. | ||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||
| 25 | # You should have received a copy of the GNU Lesser General Public | ||||||||||||||||||||||||||
| 26 | # License along with this library; if not, write to the | ||||||||||||||||||||||||||
| 27 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||||||||||||||||||||||||||
| 28 | # Boston, MA 02111-1307, USA. | ||||||||||||||||||||||||||
| 29 | # | ||||||||||||||||||||||||||
| 30 | # $Id: Util.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $ | ||||||||||||||||||||||||||
| 31 | # | ||||||||||||||||||||||||||
| 32 | #======================================================================= | ||||||||||||||||||||||||||
| 33 | package PDF::API3::Compat::API2::Util; | ||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||
| 35 | 1 | ▶ | no warnings qw[ recursion uninitialized ]; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||
| 37 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=17 SCAR=28.3
| |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||
| 39 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 40 | 1 | ▶ | use Encode qw(:all); | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||
| 42 | 1 | ▶ | use vars qw( | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 43 | $VERSION | ||||||||||||||||||||||||||
| 44 | @ISA | ||||||||||||||||||||||||||
| 45 | @EXPORT | ||||||||||||||||||||||||||
| 46 | @EXPORT_OK | ||||||||||||||||||||||||||
| 47 | %colors | ||||||||||||||||||||||||||
| 48 | $key_var | ||||||||||||||||||||||||||
| 49 | $key_var2 | ||||||||||||||||||||||||||
| 50 | %u2n | ||||||||||||||||||||||||||
| 51 | %n2u | ||||||||||||||||||||||||||
| 52 | %u2n_o | ||||||||||||||||||||||||||
| 53 | %n2u_o | ||||||||||||||||||||||||||
| 54 | $pua | ||||||||||||||||||||||||||
| 55 | $uuu | ||||||||||||||||||||||||||
| 56 | %PaperSizes | ||||||||||||||||||||||||||
| 57 | 1 | ); | |||||||||||||||||||||||||
| 58 | 1 | ▶ | use Math::Trig; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 59 | 1 | ▶ | use List::Util qw(min max); | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 60 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Utils; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 61 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Filter; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||
| 63 | 1 | ▶ | use POSIX qw( HUGE_VAL floor ); | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||
| 65 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 66 | 1 | @ISA = qw(Exporter); | |||||||||||||||||||||||||
| 67 | 1 | @EXPORT = qw( | |||||||||||||||||||||||||
| 68 | pdfkey | ||||||||||||||||||||||||||
| 69 | pdfkey2 | ||||||||||||||||||||||||||
| 70 | float floats floats5 intg intgs | ||||||||||||||||||||||||||
| 71 | mMin mMax | ||||||||||||||||||||||||||
| 72 | HSVtoRGB RGBtoHSV HSLtoRGB RGBtoHSL RGBtoLUM | ||||||||||||||||||||||||||
| 73 | namecolor namecolor_cmyk namecolor_lab optInvColor defineColor | ||||||||||||||||||||||||||
| 74 | dofilter unfilter | ||||||||||||||||||||||||||
| 75 | nameByUni uniByName initNameTable defineName | ||||||||||||||||||||||||||
| 76 | page_size | ||||||||||||||||||||||||||
| 77 | getPaperSizes | ||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||
| 79 | 1 | @EXPORT_OK = qw( | |||||||||||||||||||||||||
| 80 | pdfkey | ||||||||||||||||||||||||||
| 81 | pdfkey2 | ||||||||||||||||||||||||||
| 82 | digest digestx digest16 digest32 | ||||||||||||||||||||||||||
| 83 | float floats floats5 intg intgs | ||||||||||||||||||||||||||
| 84 | mMin mMax | ||||||||||||||||||||||||||
| 85 | cRGB cRGB8 RGBasCMYK | ||||||||||||||||||||||||||
| 86 | HSVtoRGB RGBtoHSV HSLtoRGB RGBtoHSL RGBtoLUM | ||||||||||||||||||||||||||
| 87 | namecolor namecolor_cmyk namecolor_lab optInvColor defineColor | ||||||||||||||||||||||||||
| 88 | dofilter unfilter | ||||||||||||||||||||||||||
| 89 | nameByUni uniByName initNameTable defineName | ||||||||||||||||||||||||||
| 90 | page_size | ||||||||||||||||||||||||||
| 91 | ); | ||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||
| 94 | 1 | %PaperSizes=(); | |||||||||||||||||||||||||
| 95 | 1 | foreach my $dir (@INC) { | |||||||||||||||||||||||||
| 96 | 2 | ▶ | if(-f "$dir/PDF/API3/Compat/API2/Resource/unipaper.txt") | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||
| 98 | 1 | my ($fh,$line); | |||||||||||||||||||||||||
| 99 | 1 | open($fh,"$dir/PDF/API3/Compat/API2/Resource/unipaper.txt"); | |||||||||||||||||||||||||
| 100 | 1 | ▶ | while($line=<$fh>) | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||
| 102 | 26 | ▶ | next if($line=~m|^#|); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 103 | 25 | chomp($line); | |||||||||||||||||||||||||
| 104 | 25 | my ($name,$x,$y)=split(/\s+;\s+/,$line); | |||||||||||||||||||||||||
| 105 | 25 | $PaperSizes{lc $name}=[$x,$y]; | |||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||
| 107 | 1 | close($fh); | |||||||||||||||||||||||||
| 108 | 1 | last; | |||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||
| 112 | 1 | ▶ | no warnings qw[ recursion uninitialized ]; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||
| 114 | 1 | ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:16:00 $ | |||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||
| 116 | 1 | $key_var='CBA'; | |||||||||||||||||||||||||
| 117 | 1 | $key_var2=0; | |||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||
| 119 | 1 | $pua=0xE000; | |||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||
| 121 | 1 | %u2n_o=(); | |||||||||||||||||||||||||
| 122 | 1 | %n2u_o=(); | |||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||
| 124 | 1 | $uuu={g=>{},u=>{}}; | |||||||||||||||||||||||||
| 125 | 1 | foreach my $dir (@INC) { | |||||||||||||||||||||||||
| 126 | 2 | ▶ | if(-f "$dir/PDF/API3/Compat/API2/Resource/uniglyph.txt") | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 127 | { | ||||||||||||||||||||||||||
| 128 | 1 | my ($fh,$line); | |||||||||||||||||||||||||
| 129 | 1 | open($fh,"$dir/PDF/API3/Compat/API2/Resource/uniglyph.txt"); | |||||||||||||||||||||||||
| 130 | 1 | ▶ | while($line=<$fh>) | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 131 | { | ||||||||||||||||||||||||||
| 132 | 5509 | ▶ | next if($line=~m|^#|); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 133 | 5508 | chomp($line); | |||||||||||||||||||||||||
| 134 | 5508 | $line=~s|\s+\#.+$||go; | |||||||||||||||||||||||||
| 135 | 5508 | my ($uni,$name,$prio)=split(/\s+;\s+/,$line); | |||||||||||||||||||||||||
| 136 | 5508 | $uni=hex($uni); | |||||||||||||||||||||||||
| 137 | 5508 | ▶ | $uuu->{u}->{$uni}||=[]; | ||||||||||||||||||||||||
|
Condition100%2/2
$uuu->{"u"}{$uni} ||= []
MC/DC100%1/1
$uuu->{"u"}{$uni} ||= []
$uuu->{"u"}{$uni}
Truth table100%2/2
A
A= $uuu->{"u"}{$uni}
| |||||||||||||||||||||||||||
| 138 | 5508 | ▶ | $uuu->{g}->{$name}||=[]; | ||||||||||||||||||||||||
|
Condition100%2/2
$uuu->{"g"}{$name} ||= []
MC/DC100%1/1
$uuu->{"g"}{$name} ||= []
$uuu->{"g"}{$name}
Truth table100%2/2
A
A= $uuu->{"g"}{$name}
| |||||||||||||||||||||||||||
| 139 | 5508 | push @{$uuu->{u}->{$uni}},{uni=>$uni,name=>$name,prio=>$prio}; | |||||||||||||||||||||||||
| 140 | 5508 | push @{$uuu->{g}->{$name}},{uni=>$uni,name=>$name,prio=>$prio}; | |||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||
| 142 | 1 | close($fh); | |||||||||||||||||||||||||
| 143 | 1 | last; | |||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||
| 146 | 1 | foreach my $k (sort {$a<=>$b} keys %{$uuu->{u}}) | |||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||
| 148 | 4291 | $u2n_o{$k}=$uuu->{u}->{$k}->[0]->{name}; | |||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||
| 150 | 1 | foreach my $k (keys %{$uuu->{g}}) | |||||||||||||||||||||||||
| 151 | { | ||||||||||||||||||||||||||
| 152 | 5422 | my($r)=sort {$a->{prio}<=>$b->{prio}} @{$uuu->{g}->{$k}}; | |||||||||||||||||||||||||
| 153 | 5422 | $n2u_o{$k}=$r->{uni}; | |||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||
| 155 | 1 | $uuu=undef; | |||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||
| 157 | 1 | %u2n=%u2n_o; | |||||||||||||||||||||||||
| 158 | 1 | %n2u=%n2u_o; | |||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||
| 160 | 1 | %colors=(); | |||||||||||||||||||||||||
| 161 | 1 | foreach my $dir (@INC) { | |||||||||||||||||||||||||
| 162 | 2 | ▶ | if(-f "$dir/PDF/API3/Compat/API2/Resource/unicolor.txt") | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 163 | { | ||||||||||||||||||||||||||
| 164 | 1 | my ($fh,$line); | |||||||||||||||||||||||||
| 165 | 1 | open($fh,"$dir/PDF/API3/Compat/API2/Resource/unicolor.txt"); | |||||||||||||||||||||||||
| 166 | 1 | ▶ | while($line=<$fh>) | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||
| 168 | 683 | ▶ | next if($line=~m|^#|); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 169 | 682 | chomp($line); | |||||||||||||||||||||||||
| 170 | 682 | my ($name,$val)=split(/\s+;\s+/,$line); | |||||||||||||||||||||||||
| 171 | 682 | $colors{lc $name}=$val; | |||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||
| 173 | 1 | close($fh); | |||||||||||||||||||||||||
| 174 | 1 | last; | |||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub pdfkey { | ||||||||||||||||||||||||
|
Subroutine
pdfkey: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 180 | 0 | return($PDF::API3::Compat::API2::Util::key_var++); | |||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub pdfkey2 { | ||||||||||||||||||||||||
|
Subroutine
pdfkey2: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 184 | 0 | return($PDF::API3::Compat::API2::Util::key_var.($PDF::API3::Compat::API2::Util::key_var2++)); | |||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub digestx { | ||||||||||||||||||||||||
|
Subroutine
digestx: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 188 | 0 | my $len=shift @_; | |||||||||||||||||||||||||
| 189 | 0 | my $mask=$len-1; | |||||||||||||||||||||||||
| 190 | 0 | my $ddata=join('',@_); | |||||||||||||||||||||||||
| 191 | 0 | my $mdkey='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789gT'; | |||||||||||||||||||||||||
| 192 | 0 | my $xdata="0" x $len; | |||||||||||||||||||||||||
| 193 | 0 | my $off=0; | |||||||||||||||||||||||||
| 194 | 0 | my $set; | |||||||||||||||||||||||||
| 195 | 0 | foreach $set (0..(length($ddata)<<1)) { | |||||||||||||||||||||||||
| 196 | 0 | $off+=vec($ddata,$set,4); | |||||||||||||||||||||||||
| 197 | 0 | $off+=vec($xdata,($set & $mask),8); | |||||||||||||||||||||||||
| 198 | 0 | vec($xdata,($set & ($mask<<1 |1)),4)=vec($mdkey,($off & 0x7f),4); | |||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||
| 201 | # foreach $set (0..$mask) { | ||||||||||||||||||||||||||
| 202 | # vec($xdata,$set,8)=(vec($xdata,$set,8) & 0x7f) | 0x40; | ||||||||||||||||||||||||||
| 203 | # } | ||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||
| 205 | # $off=0; | ||||||||||||||||||||||||||
| 206 | # foreach $set (0..$mask) { | ||||||||||||||||||||||||||
| 207 | # $off+=vec($xdata,$set,8); | ||||||||||||||||||||||||||
| 208 | # vec($xdata,$set,8)=vec($mdkey,($off & 0x3f),8); | ||||||||||||||||||||||||||
| 209 | # } | ||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||
| 211 | 0 | return($xdata); | |||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub digest { | ||||||||||||||||||||||||
|
Subroutine
digest: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 215 | 0 | return(digestx(32,@_)); | |||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub digest16 { | ||||||||||||||||||||||||
|
Subroutine
digest16: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 219 | 0 | return(digestx(16,@_)); | |||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub digest32 { | ||||||||||||||||||||||||
|
Subroutine
digest32: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 223 | 0 | return(digestx(32,@_)); | |||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub xlog10 { | ||||||||||||||||||||||||
|
Subroutine
xlog10: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 227 | 0 | my $n = shift; | |||||||||||||||||||||||||
| 228 | 0 | ▶ | if($n) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 229 | 0 | return log(abs($n))/log(10); | |||||||||||||||||||||||||
| 230 | 0 | } else { return 0; } | |||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub float { | ||||||||||||||||||||||||
|
Subroutine
float: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 234 | 0 | my $f=shift @_; | |||||||||||||||||||||||||
| 235 | 0 | ▶ | my $mxd=shift @_||4; | ||||||||||||||||||||||||
|
Condition0%0/2
shift @_ || 4
MC/DC0%0/1
shift @_ || 4
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||||||||||||||||
| 236 | 0 | ▶ | $f=0 if(abs($f)<0.0000000000000001); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 237 | 0 | my $ad=floor(xlog10($f)-$mxd); | |||||||||||||||||||||||||
| 238 | 0 | ▶ | if(abs($f-int($f)) < (10**(-$mxd))) { | ||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||
| 239 | # just in case we have an integer | ||||||||||||||||||||||||||
| 240 | 0 | return sprintf('%i',$f); | |||||||||||||||||||||||||
| 241 | } elsif($ad>0){ | ||||||||||||||||||||||||||
| 242 | 0 | return sprintf('%f',$f); | |||||||||||||||||||||||||
| 243 | } else { | ||||||||||||||||||||||||||
| 244 | 0 | return sprintf('%.'.abs($ad).'f',$f); | |||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub floats { return map { float($_); } @_; } | ||||||||||||||||||||||||
|
Subroutine
floats: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub floats5 { return map { float($_,5); } @_; } | ||||||||||||||||||||||||
|
Subroutine
floats5: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||
| 251 | 0 | ▶ | sub intg { | ||||||||||||||||||||||||
|
Subroutine
intg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 252 | 0 | my $f=shift @_; | |||||||||||||||||||||||||
| 253 | 0 | return sprintf('%i',$f); | |||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub intgs { return map { intg($_); } @_; } | ||||||||||||||||||||||||
|
Subroutine
intgs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub mMin { | ||||||||||||||||||||||||
|
Subroutine
mMin: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 258 | 0 | my $n=HUGE_VAL; | |||||||||||||||||||||||||
| 259 | 0 | ▶ | map { $n=($n>$_) ? $_ : $n } @_; | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 260 | 0 | return($n); | |||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub mMax { | ||||||||||||||||||||||||
|
Subroutine
mMax: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 264 | 0 | my $n=-(HUGE_VAL); | |||||||||||||||||||||||||
| 265 | 0 | ▶ | map { $n=($n<$_) ? $_ : $n } @_; | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 266 | 0 | return($n); | |||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||
| 269 | 0 | ▶ | sub cRGB { | ||||||||||||||||||||||||
|
Subroutine
cRGB: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 270 | 0 | my @cmy=(map { 1-$_ } @_); | |||||||||||||||||||||||||
| 271 | 0 | my $k=mMin(@cmy); | |||||||||||||||||||||||||
| 272 | 0 | return((map { $_-$k } @cmy),$k); | |||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub cRGB8 { | ||||||||||||||||||||||||
|
Subroutine
cRGB8: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 276 | 0 | return cRGB(map { $_/255 } @_); | |||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||
| 279 | 0 | ▶ | sub RGBtoLUM { | ||||||||||||||||||||||||
|
Subroutine
RGBtoLUM: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 280 | 0 | my ($r,$g,$b)=@_; | |||||||||||||||||||||||||
| 281 | 0 | return($r*0.299+$g*0.587+$b*0.114); | |||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||
| 284 | 0 | ▶ | sub RGBasCMYK { | ||||||||||||||||||||||||
|
Subroutine
RGBasCMYK: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 285 | 0 | my @rgb=@_; | |||||||||||||||||||||||||
| 286 | 0 | my @cmy=(map { 1-$_ } @rgb); | |||||||||||||||||||||||||
| 287 | 0 | my $k=mMin(@cmy)*0.44; | |||||||||||||||||||||||||
| 288 | 0 | return((map { $_-$k } @cmy),$k); | |||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub HSVtoRGB { | ||||||||||||||||||||||||
|
Subroutine
HSVtoRGB: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||
| 292 | 0 | my ($h,$s,$v)=@_; | |||||||||||||||||||||||||
| 293 | 0 | my ($r,$g,$b,$i,$f,$p,$q,$t); | |||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||
| 295 | 0 | ▶ | if( $s == 0 ) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 296 | ## achromatic (grey) | ||||||||||||||||||||||||||
| 297 | 0 | return ($v,$v,$v); | |||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||
| 300 | 0 | $h %= 360; | |||||||||||||||||||||||||
| 301 | 0 | $h /= 60; ## sector 0 to 5 | |||||||||||||||||||||||||
| 302 | 0 | $i = POSIX::floor( $h ); | |||||||||||||||||||||||||
| 303 | 0 | $f = $h - $i; ## factorial part of h | |||||||||||||||||||||||||
| 304 | 0 | $p = $v * ( 1 - $s ); | |||||||||||||||||||||||||
| 305 | 0 | $q = $v * ( 1 - $s * $f ); | |||||||||||||||||||||||||
| 306 | 0 | $t = $v * ( 1 - $s * ( 1 - $f ) ); | |||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||
| 308 | 0 | ▶ | if($i<1) { | ||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||
| 309 | 0 | $r = $v; | |||||||||||||||||||||||||
| 310 | 0 | $g = $t; | |||||||||||||||||||||||||
| 311 | 0 | $b = $p; | |||||||||||||||||||||||||
| 312 | } elsif($i<2){ | ||||||||||||||||||||||||||
| 313 | 0 | $r = $q; | |||||||||||||||||||||||||
| 314 | 0 | $g = $v; | |||||||||||||||||||||||||
| 315 | 0 | $b = $p; | |||||||||||||||||||||||||
| 316 | } elsif($i<3){ | ||||||||||||||||||||||||||
| 317 | 0 | $r = $p; | |||||||||||||||||||||||||
| 318 | 0 | $g = $v; | |||||||||||||||||||||||||
| 319 | 0 | $b = $t; | |||||||||||||||||||||||||
| 320 | } elsif($i<4){ | ||||||||||||||||||||||||||
| 321 | 0 | $r = $p; | |||||||||||||||||||||||||
| 322 | 0 | $g = $q; | |||||||||||||||||||||||||
| 323 | 0 | $b = $v; | |||||||||||||||||||||||||
| 324 | } elsif($i<5){ | ||||||||||||||||||||||||||
| 325 | 0 | $r = $t; | |||||||||||||||||||||||||
| 326 | 0 | $g = $p; | |||||||||||||||||||||||||
| 327 | 0 | $b = $v; | |||||||||||||||||||||||||
| 328 | } else { | ||||||||||||||||||||||||||
| 329 | 0 | $r = $v; | |||||||||||||||||||||||||
| 330 | 0 | $g = $p; | |||||||||||||||||||||||||
| 331 | 0 | $b = $q; | |||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||
| 333 | 0 | return ($r,$g,$b); | |||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||
| 335 | 0 | ▶ | sub _HSVtoRGB { # test | ||||||||||||||||||||||||
|
Subroutine
_HSVtoRGB: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||
| 336 | 0 | my ($h,$s,$v)=@_; | |||||||||||||||||||||||||
| 337 | 0 | my ($r,$g,$b,$i,$f,$p,$q,$t); | |||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||
| 339 | 0 | ▶ | if( $s == 0 ) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 340 | ## achromatic (grey) | ||||||||||||||||||||||||||
| 341 | 0 | return ($v,$v,$v); | |||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||
| 344 | 0 | $h %= 360; | |||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||
| 346 | 0 | $r = 2*cos(deg2rad($h)); | |||||||||||||||||||||||||
| 347 | 0 | $g = 2*cos(deg2rad($h+120)); | |||||||||||||||||||||||||
| 348 | 0 | $b = 2*cos(deg2rad($h+240)); | |||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||
| 350 | 0 | $p = max($r,$g,$b); | |||||||||||||||||||||||||
| 351 | 0 | $q = min($r,$g,$b); | |||||||||||||||||||||||||
| 352 | 0 | ▶ | ($p,$q) = map { ($_<0 ? 0 : ($_>1 ? 1 : $_)) } ($p,$q); | ||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||
| 353 | 0 | $f = $p - $q; | |||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||
| 355 | #if($p>=$v) { | ||||||||||||||||||||||||||
| 356 | # ($r,$g,$b) = map { $_*$v/$p } ($r,$g,$b); | ||||||||||||||||||||||||||
| 357 | #} else { | ||||||||||||||||||||||||||
| 358 | # ($r,$g,$b) = map { $_*$p/$v } ($r,$g,$b); | ||||||||||||||||||||||||||
| 359 | #} | ||||||||||||||||||||||||||
| 360 | # | ||||||||||||||||||||||||||
| 361 | #if($f>=$s) { | ||||||||||||||||||||||||||
| 362 | # ($r,$g,$b) = map { (($_-$q/2)*$f/$s)+$q/2 } ($r,$g,$b); | ||||||||||||||||||||||||||
| 363 | #} else { | ||||||||||||||||||||||||||
| 364 | # ($r,$g,$b) = map { (($_-$q/2)*$s/$f)+$q/2 } ($r,$g,$b); | ||||||||||||||||||||||||||
| 365 | #} | ||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||
| 367 | 0 | ▶ | ($r,$g,$b) = map { ($_<0 ? 0 : ($_>1 ? 1 : $_)) } ($r,$g,$b); | ||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||
| 369 | 0 | return ($r,$g,$b); | |||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||
| 372 | 0 | ▶ | sub RGBquant ($$$) { | ||||||||||||||||||||||||
|
Subroutine
RGBquant: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 373 | 0 | my($q1,$q2,$h)=@_; | |||||||||||||||||||||||||
| 374 | 0 | ▶ | while($h<0){$h+=360;} | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 375 | 0 | $h%=360; | |||||||||||||||||||||||||
| 376 | 0 | ▶ | if ($h<60) { | ||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||
| 377 | 0 | return($q1+(($q2-$q1)*$h/60)); | |||||||||||||||||||||||||
| 378 | } elsif ($h<180) { | ||||||||||||||||||||||||||
| 379 | 0 | return($q2); | |||||||||||||||||||||||||
| 380 | } elsif ($h<240) { | ||||||||||||||||||||||||||
| 381 | 0 | return($q1+(($q2-$q1)*(240-$h)/60)); | |||||||||||||||||||||||||
| 382 | } else { | ||||||||||||||||||||||||||
| 383 | 0 | return($q1); | |||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||
| 387 | 0 | ▶ | sub RGBtoHSV { | ||||||||||||||||||||||||
|
Subroutine
RGBtoHSV: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 388 | 0 | my ($r,$g,$b)=@_; | |||||||||||||||||||||||||
| 389 | 0 | my ($h,$s,$v,$min,$max,$delta); | |||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||
| 391 | 0 | $min= mMin($r,$g,$b); | |||||||||||||||||||||||||
| 392 | 0 | $max= mMax($r,$g,$b); | |||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||
| 394 | 0 | $v = $max; | |||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||
| 396 | 0 | $delta = $max - $min; | |||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||
| 398 | 0 | ▶ | if( $delta > 0.000000001 ) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 399 | 0 | $s = $delta / $max; | |||||||||||||||||||||||||
| 400 | } else { | ||||||||||||||||||||||||||
| 401 | 0 | $s = 0; | |||||||||||||||||||||||||
| 402 | 0 | $h = 0; | |||||||||||||||||||||||||
| 403 | 0 | return($h,$s,$v); | |||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||
| 406 | 0 | ▶ | if( $r == $max ) { | ||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||
| 407 | 0 | $h = ( $g - $b ) / $delta; | |||||||||||||||||||||||||
| 408 | } elsif( $g == $max ) { | ||||||||||||||||||||||||||
| 409 | 0 | $h = 2 + ( $b - $r ) / $delta; | |||||||||||||||||||||||||
| 410 | } else { | ||||||||||||||||||||||||||
| 411 | 0 | $h = 4 + ( $r - $g ) / $delta; | |||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||
| 413 | 0 | $h *= 60; | |||||||||||||||||||||||||
| 414 | 0 | ▶ | if( $h < 0 ) {$h += 360;} | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 415 | 0 | return($h,$s,$v); | |||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||
| 418 | 0 | ▶ | sub RGBtoHSL { | ||||||||||||||||||||||||
|
Subroutine
RGBtoHSL: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||
| 419 | 0 | my ($r,$g,$b)=@_; | |||||||||||||||||||||||||
| 420 | 0 | my ($h,$s,$v,$l,$min,$max,$delta); | |||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||
| 422 | 0 | $min= mMin($r,$g,$b); | |||||||||||||||||||||||||
| 423 | 0 | $max= mMax($r,$g,$b); | |||||||||||||||||||||||||
| 424 | 0 | ($h,$s,$v)=RGBtoHSV($r,$g,$b); | |||||||||||||||||||||||||
| 425 | 0 | $l=($max+$min)/2.0; | |||||||||||||||||||||||||
| 426 | 0 | $delta = $max - $min; | |||||||||||||||||||||||||
| 427 | 0 | ▶ | if($delta<0.00000000001){ | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 428 | 0 | return(0,0,$l); | |||||||||||||||||||||||||
| 429 | } else { | ||||||||||||||||||||||||||
| 430 | 0 | ▶ | if($l<=0.5){ | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 431 | 0 | $s=$delta/($max+$min); | |||||||||||||||||||||||||
| 432 | } else { | ||||||||||||||||||||||||||
| 433 | 0 | $s=$delta/(2-$max-$min); | |||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||
| 436 | 0 | return($h,$s,$l); | |||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||
| 439 | 0 | ▶ | sub HSLtoRGB { | ||||||||||||||||||||||||
|
Subroutine
HSLtoRGB: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||
| 440 | 0 | my($h,$s,$l,$r,$g,$b,$p1,$p2)=@_; | |||||||||||||||||||||||||
| 441 | 0 | ▶ | if($l<=0.5){ | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 442 | 0 | $p2=$l*(1+$s); | |||||||||||||||||||||||||
| 443 | } else { | ||||||||||||||||||||||||||
| 444 | 0 | $p2=$l+$s-($l*$s); | |||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||
| 446 | 0 | $p1=2*$l-$p2; | |||||||||||||||||||||||||
| 447 | 0 | ▶ | if($s<0.0000000000001){ | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 448 | 0 | $r=$l; $g=$l; $b=$l; | |||||||||||||||||||||||||
| 449 | } else { | ||||||||||||||||||||||||||
| 450 | 0 | $r=RGBquant($p1,$p2,$h+120); | |||||||||||||||||||||||||
| 451 | 0 | $g=RGBquant($p1,$p2,$h); | |||||||||||||||||||||||||
| 452 | 0 | $b=RGBquant($p1,$p2,$h-120); | |||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||
| 454 | 0 | return($r,$g,$b); | |||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||
| 457 | 0 | ▶ | sub optInvColor { | ||||||||||||||||||||||||
|
Subroutine
optInvColor: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 458 | 0 | my ($r,$g,$b) = @_; | |||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||
| 460 | 0 | my $ab = (0.2*$r) + (0.7*$g) + (0.1*$b); | |||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||
| 462 | 0 | ▶ | if($ab > 0.45) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 463 | 0 | return(0,0,0); | |||||||||||||||||||||||||
| 464 | } else { | ||||||||||||||||||||||||||
| 465 | 0 | return(1,1,1); | |||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||
| 469 | 0 | ▶ | sub defineColor { | ||||||||||||||||||||||||
|
Subroutine
defineColor: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 470 | 0 | my ($name,$mx,$r,$g,$b)=@_; | |||||||||||||||||||||||||
| 471 | 0 | ▶ | $colors{$name}||=[ map {$_/$mx} ($r,$g,$b) ]; | ||||||||||||||||||||||||
|
Condition0%0/2
$colors{$name} ||= [map({$_ / $mx;} $r, $g, $b)]
MC/DC0%0/1
$colors{$name} ||= [map({$_ / $mx;} $r, $g, $b)]
$colors{$name}
Truth table0%0/2
A
A= $colors{$name}
| |||||||||||||||||||||||||||
| 472 | 0 | return($colors{$name}); | |||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||
| 475 | 0 | ▶ | sub rgbHexValues { | ||||||||||||||||||||||||
|
Subroutine
rgbHexValues: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 476 | 0 | my $name=lc(shift @_); | |||||||||||||||||||||||||
| 477 | 0 | my ($r,$g,$b); | |||||||||||||||||||||||||
| 478 | 0 | ▶ | if(length($name)<5) { # zb. #fa4, #cf0 | ||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||
| 479 | 0 | $r=hex(substr($name,1,1))/0xf; | |||||||||||||||||||||||||
| 480 | 0 | $g=hex(substr($name,2,1))/0xf; | |||||||||||||||||||||||||
| 481 | 0 | $b=hex(substr($name,3,1))/0xf; | |||||||||||||||||||||||||
| 482 | } elsif(length($name)<8) { # zb. #ffaa44, #ccff00 | ||||||||||||||||||||||||||
| 483 | 0 | $r=hex(substr($name,1,2))/0xff; | |||||||||||||||||||||||||
| 484 | 0 | $g=hex(substr($name,3,2))/0xff; | |||||||||||||||||||||||||
| 485 | 0 | $b=hex(substr($name,5,2))/0xff; | |||||||||||||||||||||||||
| 486 | } elsif(length($name)<11) { # zb. #fffaaa444, #cccfff000 | ||||||||||||||||||||||||||
| 487 | 0 | $r=hex(substr($name,1,3))/0xfff; | |||||||||||||||||||||||||
| 488 | 0 | $g=hex(substr($name,4,3))/0xfff; | |||||||||||||||||||||||||
| 489 | 0 | $b=hex(substr($name,7,3))/0xfff; | |||||||||||||||||||||||||
| 490 | } else { # zb. #ffffaaaa4444, #ccccffff0000 | ||||||||||||||||||||||||||
| 491 | 0 | $r=hex(substr($name,1,4))/0xffff; | |||||||||||||||||||||||||
| 492 | 0 | $g=hex(substr($name,5,4))/0xffff; | |||||||||||||||||||||||||
| 493 | 0 | $b=hex(substr($name,9,4))/0xffff; | |||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||
| 495 | 0 | return($r,$g,$b); | |||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||
| 497 | 0 | ▶ | sub cmykHexValues { | ||||||||||||||||||||||||
|
Subroutine
cmykHexValues: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 498 | 0 | my $name=lc(shift @_); | |||||||||||||||||||||||||
| 499 | 0 | my ($c,$m,$y,$k); | |||||||||||||||||||||||||
| 500 | 0 | ▶ | if(length($name)<6) { # zb. %cmyk | ||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||
| 501 | 0 | $c=hex(substr($name,1,1))/0xf; | |||||||||||||||||||||||||
| 502 | 0 | $m=hex(substr($name,2,1))/0xf; | |||||||||||||||||||||||||
| 503 | 0 | $y=hex(substr($name,3,1))/0xf; | |||||||||||||||||||||||||
| 504 | 0 | $k=hex(substr($name,4,1))/0xf; | |||||||||||||||||||||||||
| 505 | } elsif(length($name)<10) { # zb. %ccmmyykk | ||||||||||||||||||||||||||
| 506 | 0 | $c=hex(substr($name,1,2))/0xff; | |||||||||||||||||||||||||
| 507 | 0 | $m=hex(substr($name,3,2))/0xff; | |||||||||||||||||||||||||
| 508 | 0 | $y=hex(substr($name,5,2))/0xff; | |||||||||||||||||||||||||
| 509 | 0 | $k=hex(substr($name,7,2))/0xff; | |||||||||||||||||||||||||
| 510 | } elsif(length($name)<14) { # zb. %cccmmmyyykkk | ||||||||||||||||||||||||||
| 511 | 0 | $c=hex(substr($name,1,3))/0xfff; | |||||||||||||||||||||||||
| 512 | 0 | $m=hex(substr($name,4,3))/0xfff; | |||||||||||||||||||||||||
| 513 | 0 | $y=hex(substr($name,7,3))/0xfff; | |||||||||||||||||||||||||
| 514 | 0 | $k=hex(substr($name,10,3))/0xfff; | |||||||||||||||||||||||||
| 515 | } else { # zb. %ccccmmmmyyyykkkk | ||||||||||||||||||||||||||
| 516 | 0 | $c=hex(substr($name,1,4))/0xffff; | |||||||||||||||||||||||||
| 517 | 0 | $m=hex(substr($name,5,4))/0xffff; | |||||||||||||||||||||||||
| 518 | 0 | $y=hex(substr($name,9,4))/0xffff; | |||||||||||||||||||||||||
| 519 | 0 | $k=hex(substr($name,13,4))/0xffff; | |||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||
| 521 | 0 | return($c,$m,$y,$k); | |||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||
| 523 | 0 | ▶ | sub hsvHexValues { | ||||||||||||||||||||||||
|
Subroutine
hsvHexValues: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 524 | 0 | my $name=lc(shift @_); | |||||||||||||||||||||||||
| 525 | 0 | my ($h,$s,$v); | |||||||||||||||||||||||||
| 526 | 0 | ▶ | if(length($name)<5) { | ||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||
| 527 | 0 | $h=360*hex(substr($name,1,1))/0x10; | |||||||||||||||||||||||||
| 528 | 0 | $s=hex(substr($name,2,1))/0xf; | |||||||||||||||||||||||||
| 529 | 0 | $v=hex(substr($name,3,1))/0xf; | |||||||||||||||||||||||||
| 530 | } elsif(length($name)<8) { | ||||||||||||||||||||||||||
| 531 | 0 | $h=360*hex(substr($name,1,2))/0x100; | |||||||||||||||||||||||||
| 532 | 0 | $s=hex(substr($name,3,2))/0xff; | |||||||||||||||||||||||||
| 533 | 0 | $v=hex(substr($name,5,2))/0xff; | |||||||||||||||||||||||||
| 534 | } elsif(length($name)<11) { | ||||||||||||||||||||||||||
| 535 | 0 | $h=360*hex(substr($name,1,3))/0x1000; | |||||||||||||||||||||||||
| 536 | 0 | $s=hex(substr($name,4,3))/0xfff; | |||||||||||||||||||||||||
| 537 | 0 | $v=hex(substr($name,7,3))/0xfff; | |||||||||||||||||||||||||
| 538 | } else { | ||||||||||||||||||||||||||
| 539 | 0 | $h=360*hex(substr($name,1,4))/0x10000; | |||||||||||||||||||||||||
| 540 | 0 | $s=hex(substr($name,5,4))/0xffff; | |||||||||||||||||||||||||
| 541 | 0 | $v=hex(substr($name,9,4))/0xffff; | |||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||
| 543 | 0 | return($h,$s,$v); | |||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||
| 545 | 0 | ▶ | sub labHexValues { | ||||||||||||||||||||||||
|
Subroutine
labHexValues: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 546 | 0 | my $name=lc(shift @_); | |||||||||||||||||||||||||
| 547 | 0 | my ($l,$a,$b); | |||||||||||||||||||||||||
| 548 | 0 | ▶ | if(length($name)<5) { | ||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||
| 549 | 0 | $l=100*hex(substr($name,1,1))/0xf; | |||||||||||||||||||||||||
| 550 | 0 | $a=(200*hex(substr($name,2,1))/0xf)-100; | |||||||||||||||||||||||||
| 551 | 0 | $b=(200*hex(substr($name,3,1))/0xf)-100; | |||||||||||||||||||||||||
| 552 | } elsif(length($name)<8) { | ||||||||||||||||||||||||||
| 553 | 0 | $l=100*hex(substr($name,1,2))/0xff; | |||||||||||||||||||||||||
| 554 | 0 | $a=(200*hex(substr($name,3,2))/0xff)-100; | |||||||||||||||||||||||||
| 555 | 0 | $b=(200*hex(substr($name,5,2))/0xff)-100; | |||||||||||||||||||||||||
| 556 | } elsif(length($name)<11) { | ||||||||||||||||||||||||||
| 557 | 0 | $l=100*hex(substr($name,1,3))/0xfff; | |||||||||||||||||||||||||
| 558 | 0 | $a=(200*hex(substr($name,4,3))/0xfff)-100; | |||||||||||||||||||||||||
| 559 | 0 | $b=(200*hex(substr($name,7,3))/0xfff)-100; | |||||||||||||||||||||||||
| 560 | } else { | ||||||||||||||||||||||||||
| 561 | 0 | $l=100*hex(substr($name,1,4))/0xffff; | |||||||||||||||||||||||||
| 562 | 0 | $a=(200*hex(substr($name,5,4))/0xffff)-100; | |||||||||||||||||||||||||
| 563 | 0 | $b=(200*hex(substr($name,9,4))/0xffff)-100; | |||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||
| 565 | 0 | return($l,$a,$b); | |||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||
| 568 | 0 | ▶ | sub namecolor { | ||||||||||||||||||||||||
|
Subroutine
namecolor: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||
| 569 | 0 | my $name=shift @_; | |||||||||||||||||||||||||
| 570 | 0 | ▶ | unless(ref $name) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 571 | 0 | $name=lc($name); | |||||||||||||||||||||||||
| 572 | 0 | $name=~s/[^\#!%\&\$a-z0-9]//go; | |||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||
| 574 | 0 | ▶ | if($name=~/^[a-z]/) { # name spec. | ||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||
| 575 | 0 | return(namecolor($colors{$name})); | |||||||||||||||||||||||||
| 576 | } elsif($name=~/^#/) { # rgb spec. | ||||||||||||||||||||||||||
| 577 | 0 | return(floats5(rgbHexValues($name))); | |||||||||||||||||||||||||
| 578 | } elsif($name=~/^%/) { # cmyk spec. | ||||||||||||||||||||||||||
| 579 | 0 | return(floats5(cmykHexValues($name))); | |||||||||||||||||||||||||
| 580 | } elsif($name=~/^!/) { # hsv spec. | ||||||||||||||||||||||||||
| 581 | 0 | return(floats5(HSVtoRGB(hsvHexValues($name)))); | |||||||||||||||||||||||||
| 582 | } elsif($name=~/^&/) { # hsl spec. | ||||||||||||||||||||||||||
| 583 | 0 | return(floats5(HSLtoRGB(hsvHexValues($name)))); | |||||||||||||||||||||||||
| 584 | } else { # or it is a ref ? | ||||||||||||||||||||||||||
| 585 | 0 | ▶ | return(floats5(@{$name || [0.5,0.5,0.5]})); | ||||||||||||||||||||||||
|
Condition0%0/2
$name || [0.5, 0.5, 0.5]
MC/DC0%0/1
$name || [0.5, 0.5, 0.5]
$name
Truth table0%0/2
A
A= $name
| |||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||
| 588 | 0 | ▶ | sub namecolor_cmyk { | ||||||||||||||||||||||||
|
Subroutine
namecolor_cmyk: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||
| 589 | 0 | my $name=shift @_; | |||||||||||||||||||||||||
| 590 | 0 | ▶ | unless(ref $name) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 591 | 0 | $name=lc($name); | |||||||||||||||||||||||||
| 592 | 0 | $name=~s/[^\#!%\&\$a-z0-9]//go; | |||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||
| 594 | 0 | ▶ | if($name=~/^[a-z]/) { # name spec. | ||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||
| 595 | 0 | return(namecolor_cmyk($colors{$name})); | |||||||||||||||||||||||||
| 596 | } elsif($name=~/^#/) { # rgb spec. | ||||||||||||||||||||||||||
| 597 | 0 | return(floats5(RGBasCMYK(rgbHexValues($name)))); | |||||||||||||||||||||||||
| 598 | } elsif($name=~/^%/) { # cmyk spec. | ||||||||||||||||||||||||||
| 599 | 0 | return(floats5(cmykHexValues($name))); | |||||||||||||||||||||||||
| 600 | } elsif($name=~/^!/) { # hsv spec. | ||||||||||||||||||||||||||
| 601 | 0 | return(floats5(RGBasCMYK(HSVtoRGB(hsvHexValues($name))))); | |||||||||||||||||||||||||
| 602 | } elsif($name=~/^&/) { # hsl spec. | ||||||||||||||||||||||||||
| 603 | 0 | return(floats5(RGBasCMYK(HSLtoRGB(hsvHexValues($name))))); | |||||||||||||||||||||||||
| 604 | } else { # or it is a ref ? | ||||||||||||||||||||||||||
| 605 | 0 | ▶ | return(floats5(RGBasCMYK(@{$name || [0.5,0.5,0.5]}))); | ||||||||||||||||||||||||
|
Condition0%0/2
$name || [0.5, 0.5, 0.5]
MC/DC0%0/1
$name || [0.5, 0.5, 0.5]
$name
Truth table0%0/2
A
A= $name
| |||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||
| 608 | 0 | ▶ | sub namecolor_lab { | ||||||||||||||||||||||||
|
Subroutine
namecolor_lab: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||
| 609 | 0 | my $name=shift @_; | |||||||||||||||||||||||||
| 610 | 0 | ▶ | unless(ref $name) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 611 | 0 | $name=lc($name); | |||||||||||||||||||||||||
| 612 | 0 | $name=~s/[^\#!%\&\$a-z0-9]//go; | |||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||
| 614 | 0 | ▶ | if($name=~/^[a-z]/) { # name spec. | ||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||
| 615 | 0 | return(namecolor_lab($colors{$name})); | |||||||||||||||||||||||||
| 616 | } elsif($name=~/^\$/) { # lab spec. | ||||||||||||||||||||||||||
| 617 | 0 | return(floats5(labHexValues($name))); | |||||||||||||||||||||||||
| 618 | } elsif($name=~/^#/) { # rgb spec. | ||||||||||||||||||||||||||
| 619 | 0 | my ($h,$s,$v)=RGBtoHSV(rgbHexValues($name)); | |||||||||||||||||||||||||
| 620 | 0 | my $a=cos(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 621 | 0 | my $b=sin(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 622 | 0 | my $l=100*$v; | |||||||||||||||||||||||||
| 623 | 0 | return(floats5($l,$a,$b)); | |||||||||||||||||||||||||
| 624 | } elsif($name=~/^!/) { # hsv spec. | ||||||||||||||||||||||||||
| 625 | # fake conversion | ||||||||||||||||||||||||||
| 626 | 0 | my ($h,$s,$v)=hsvHexValues($name); | |||||||||||||||||||||||||
| 627 | 0 | my $a=cos(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 628 | 0 | my $b=sin(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 629 | 0 | my $l=100*$v; | |||||||||||||||||||||||||
| 630 | 0 | return(floats5($l,$a,$b)); | |||||||||||||||||||||||||
| 631 | } elsif($name=~/^&/) { # hsl spec. | ||||||||||||||||||||||||||
| 632 | 0 | my ($h,$s,$v)=hsvHexValues($name); | |||||||||||||||||||||||||
| 633 | 0 | my $a=cos(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 634 | 0 | my $b=sin(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 635 | 0 | ($h,$s,$v)=RGBtoHSV(HSLtoRGB($h,$s,$v)); | |||||||||||||||||||||||||
| 636 | 0 | my $l=100*$v; | |||||||||||||||||||||||||
| 637 | 0 | return(floats5($l,$a,$b)); | |||||||||||||||||||||||||
| 638 | } else { # or it is a ref ? | ||||||||||||||||||||||||||
| 639 | 0 | ▶ | my ($h,$s,$v)=RGBtoHSV(@{$name || [0.5,0.5,0.5]}); | ||||||||||||||||||||||||
|
Condition0%0/2
$name || [0.5, 0.5, 0.5]
MC/DC0%0/1
$name || [0.5, 0.5, 0.5]
$name
Truth table0%0/2
A
A= $name
| |||||||||||||||||||||||||||
| 640 | 0 | my $a=cos(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 641 | 0 | my $b=sin(deg2rad $h)*$s*100; | |||||||||||||||||||||||||
| 642 | 0 | my $l=100*$v; | |||||||||||||||||||||||||
| 643 | 0 | return(floats5($l,$a,$b)); | |||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||
| 647 | sub unfilter | ||||||||||||||||||||||||||
| 648 | 0 | ▶ | { | ||||||||||||||||||||||||
|
Subroutine
unfilter: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 649 | 0 | my ($filter,$stream)=@_; | |||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||
| 651 | 0 | ▶ | if(defined $filter) | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 652 | { | ||||||||||||||||||||||||||
| 653 | # we need to fix filter because it MAY be | ||||||||||||||||||||||||||
| 654 | # an array BUT IT COULD BE only a name | ||||||||||||||||||||||||||
| 655 | 0 | ▶ | if(ref($filter)!~/Array$/) | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 656 | { | ||||||||||||||||||||||||||
| 657 | 0 | $filter = PDFArray($filter); | |||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||
| 659 | 0 | my @filts; | |||||||||||||||||||||||||
| 660 | 0 | my ($hasflate) = -1; | |||||||||||||||||||||||||
| 661 | 0 | my ($temp, $i, $temp1); | |||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||
| 663 | 0 | @filts=(map { ("PDF::API3::Compat::API2::Basic::PDF::".($_->val))->new } $filter->elementsof); | |||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||
| 665 | 0 | foreach my $f (@filts) | |||||||||||||||||||||||||
| 666 | { | ||||||||||||||||||||||||||
| 667 | 0 | $stream = $f->infilt($stream, 1); | |||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||
| 670 | 0 | return($stream); | |||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||
| 673 | 0 | ▶ | sub dofilter { | ||||||||||||||||||||||||
|
Subroutine
dofilter: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 674 | 0 | my ($filter,$stream)=@_; | |||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||
| 676 | 0 | ▶ | if((defined $filter) ) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 677 | # we need to fix filter because it MAY be | ||||||||||||||||||||||||||
| 678 | # an array BUT IT COULD BE only a name | ||||||||||||||||||||||||||
| 679 | 0 | ▶ | if(ref($filter)!~/Array$/) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 680 | 0 | $filter = PDFArray($filter); | |||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||
| 682 | 0 | my @filts; | |||||||||||||||||||||||||
| 683 | 0 | my ($hasflate) = -1; | |||||||||||||||||||||||||
| 684 | 0 | my ($temp, $i, $temp1); | |||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||
| 686 | 0 | @filts=(map { ("PDF::API3::Compat::API2::Basic::PDF::".($_->val))->new } $filter->elementsof); | |||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||
| 688 | 0 | foreach my $f (@filts) { | |||||||||||||||||||||||||
| 689 | 0 | $stream = $f->outfilt($stream, 1); | |||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||
| 692 | 0 | return($stream); | |||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||
| 695 | 0 | ▶ | sub nameByUni { | ||||||||||||||||||||||||
|
Subroutine
nameByUni: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 696 | 0 | my ($e)=@_; | |||||||||||||||||||||||||
| 697 | 0 | ▶ | return($u2n{$e} || sprintf('uni%04X',$e)); | ||||||||||||||||||||||||
|
Condition0%0/3
$u2n{$e} || sprintf('uni%04X', $e)
MC/DC0%0/2
$u2n{$e} || sprintf('uni%04X', $e)
$u2n{$e}
sprintf('uni%04X', $e)
Truth table0%0/3
A || B
A= $u2n{$e}B= sprintf('uni%04X', $e)
| |||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||
| 700 | 0 | ▶ | sub uniByName { | ||||||||||||||||||||||||
|
Subroutine
uniByName: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||
| 701 | 0 | my ($e)=@_; | |||||||||||||||||||||||||
| 702 | 0 | ▶ | if($e=~/^uni([0-9A-F]{4})$/) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 703 | 0 | return(hex($1)); | |||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||
| 705 | 0 | ▶ | return($n2u{$e} || undef); | ||||||||||||||||||||||||
|
Condition0%0/2
$n2u{$e} || undef
MC/DC0%0/1
$n2u{$e} || undef
$n2u{$e}
Truth table0%0/2
A
A= $n2u{$e}
| |||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||
| 708 | 0 | ▶ | sub initNameTable { | ||||||||||||||||||||||||
|
Subroutine
initNameTable: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||
| 709 | 0 | %u2n=(); %u2n=%u2n_o; | |||||||||||||||||||||||||
| 710 | 0 | %n2u=(); %n2u=%n2u_o; | |||||||||||||||||||||||||
| 711 | 0 | $pua=0xE000; | |||||||||||||||||||||||||
| 712 | 0 | 1; | |||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||
| 714 | 0 | ▶ | sub defineName { | ||||||||||||||||||||||||
|
Subroutine
defineName: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||
| 715 | 0 | my $name=shift @_; | |||||||||||||||||||||||||
| 716 | 0 | ▶ | return($n2u{$name}) if(defined $n2u{$name}); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||
| 718 | 0 | ▶ | while(defined $u2n{$pua}) { $pua++; } | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||
| 720 | 0 | $u2n{$pua}=$name; | |||||||||||||||||||||||||
| 721 | 0 | $n2u{$name}=$pua; | |||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||
| 723 | 0 | return($pua); | |||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||
| 726 | 0 | ▶ | sub page_size { | ||||||||||||||||||||||||
|
Subroutine
page_size: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 727 | 0 | my ($x1,$y1,$x2,$y2) = @_; | |||||||||||||||||||||||||
| 728 | 0 | ▶ | if(defined $x2) { | ||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||
| 729 | # full bbox | ||||||||||||||||||||||||||
| 730 | 0 | return($x1,$y1,$x2,$y2); | |||||||||||||||||||||||||
| 731 | } elsif(defined $y1) { | ||||||||||||||||||||||||||
| 732 | # half bbox | ||||||||||||||||||||||||||
| 733 | 0 | return(0,0,$x1,$y1); | |||||||||||||||||||||||||
| 734 | } elsif(defined $PaperSizes{lc($x1)}) { | ||||||||||||||||||||||||||
| 735 | # textual spec. | ||||||||||||||||||||||||||
| 736 | 0 | return(0,0,@{$PaperSizes{lc($x1)}}); | |||||||||||||||||||||||||
| 737 | } elsif($x1=~/^[\d\.]+$/) { | ||||||||||||||||||||||||||
| 738 | # single quadratic | ||||||||||||||||||||||||||
| 739 | 0 | return(0,0,$x1,$x1); | |||||||||||||||||||||||||
| 740 | } else { | ||||||||||||||||||||||||||
| 741 | # pdf default. | ||||||||||||||||||||||||||
| 742 | 0 | return(0,0,612,792); | |||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||
| 746 | sub getPaperSizes | ||||||||||||||||||||||||||
| 747 | 0 | ▶ | { | ||||||||||||||||||||||||
|
Subroutine
getPaperSizes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||
| 748 | 0 | my %h=(); | |||||||||||||||||||||||||
| 749 | 0 | foreach my $k (keys %PaperSizes) | |||||||||||||||||||||||||
| 750 | { | ||||||||||||||||||||||||||
| 751 | 0 | $h{$k}=[@{$PaperSizes{$k}}]; | |||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||
| 753 | 0 | return(%h); | |||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||
| 756 | sub xmlMarkupDecl | ||||||||||||||||||||||||||
| 757 | 0 | ▶ | { | ||||||||||||||||||||||||
|
Subroutine
xmlMarkupDecl: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||
| 758 | 0 | my $xml=<<EOT; | |||||||||||||||||||||||||
| 759 | <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||||||||||||||||||||||||||
| 760 | <!DOCTYPE p [ | ||||||||||||||||||||||||||
| 761 | EOT | ||||||||||||||||||||||||||
| 762 | 0 | foreach my $n (sort {lc($a) cmp lc($b)} keys %n2u) | |||||||||||||||||||||||||
| 763 | { | ||||||||||||||||||||||||||
| 764 | 0 | ▶ | next if($n eq 'apos'); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 765 | 0 | ▶ | next if($n eq 'amp'); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 766 | 0 | ▶ | next if($n eq 'quot'); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 767 | 0 | ▶ | next if($n eq 'gt'); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 768 | 0 | ▶ | next if($n eq 'lt'); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 769 | 0 | ▶ | next if($n eq '.notdef'); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 770 | 0 | ▶ | next if($n2u{$n}<32); | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 771 | 0 | $xml.=sprintf('<!ENTITY %s "&#x%04X;">',$n,$n2u{$n})."\n"; | |||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||
| 773 | 0 | $xml.="\n]>\n"; | |||||||||||||||||||||||||
| 774 | 0 | return($xml); | |||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||
| 778 | 1 | 1; | |||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||
| 780 | __END__ | ||||||||||||||||||||||||||