27 |
|
my $doposter = 0; # Posterization: -cp |
28 |
|
my $doextrem = 0; # Don't mark extrema |
29 |
|
my $needfile = 0; |
30 |
< |
my $showpal = 0; # Show availabel colour palettes |
30 |
> |
my $showpal = 0; # Show available colour palettes |
31 |
|
|
32 |
+ |
my @savedARGV = @ARGV; # Save for final header |
33 |
+ |
|
34 |
|
while ($#ARGV >= 0) { |
35 |
|
$_ = shift; |
36 |
|
# Options with qualifiers |
120 |
|
close(FHpic); |
121 |
|
|
122 |
|
if ($cpict eq '-') { |
123 |
< |
$cpict = "$td/stdin.hdr"; |
123 |
> |
$cpict = $picture; |
124 |
|
} |
125 |
|
} |
126 |
|
|
166 |
|
EPS : 1e-7; |
167 |
|
neq(a,b) : if(a-b-EPS,1,b-a-EPS); |
168 |
|
btwn(a,x,b) : if(a-x,-1,b-x); |
169 |
< |
clip(x) : if(x-1,1,if(x,x,0)); |
169 |
> |
clip(x) : min(1,max(x,0)); |
170 |
|
frac(x) : x - floor(x); |
171 |
|
boundary(a,b) : neq(floor(ndivs*a),floor(ndivs*b)); |
172 |
< |
round(x):if(x-floor(x)-0.5,ceil(x),floor(x)); |
172 |
> |
round(x) : floor(x+.5); |
173 |
|
|
174 |
|
spec_red(x) = 1.6*x - .6; |
175 |
|
spec_grn(x) = if(x-.375, 1.6-1.6*x, 8/3*x); |
312 |
|
my $theight = floor($legwidth/(8/1.67)); |
313 |
|
my $stheight = $sheight <= $theight ? $sheight : $theight; |
314 |
|
my $vlegheight = $sheight * $ndivs * (1+1.5/$ndivs); |
313 |
– |
my $text = "$label\n"; |
315 |
|
my $tslabpic = "$td/slabT.hdr"; |
316 |
< |
open PSIGN, "| psign -s -.15 -cf 1 1 1 -cb 0 0 0 -h $stheight > $tslabpic"; |
316 |
< |
print PSIGN "$text"; |
317 |
< |
close PSIGN; |
316 |
> |
system "psign -s -.15 -cf 1 1 1 -cb 0 0 0 -h $stheight $label > $tslabpic"; |
317 |
|
my $loop = $ndivs+$haszero; |
318 |
|
my $hlegheight = $sheight * ($loop) + $sheight * .5; |
319 |
|
my $pcompost = qq[pcompos -b 0 0 0 =-0 $tslabpic 0 $hlegheight ]; |
327 |
|
} |
328 |
|
# Have no more than 3 decimal places |
329 |
|
$value =~ s/(\.[0-9]{$scaledigits})[0-9]*/$1/; |
331 |
– |
$text = "$value\n"; |
330 |
|
$tslabpic = "$td/slab$i.hdr"; |
331 |
< |
open PSIGN, "| psign -s -.15 -cf 1 1 1 -cb 0 0 0 -h $stheight > $tslabpic"; |
334 |
< |
print PSIGN "$text"; |
335 |
< |
close PSIGN; |
331 |
> |
system "psign -s -.15 -cf 1 1 1 -cb 0 0 0 -h $stheight $value > $tslabpic"; |
332 |
|
$hlegheight = $sheight * ($loop - $i - 1) + $sheight * .5; |
333 |
|
$pcompost .= qq[=-0 $tslabpic 0 $hlegheight ]; |
334 |
|
} |
346 |
|
} else { |
347 |
|
# Create dummy colour scale and legend labels so we don't |
348 |
|
# need to change the final command line. |
349 |
< |
open(FHscolpic, ">$scolpic"); |
350 |
< |
print FHscolpic "\n-Y 1 +X 1\naaa\n"; |
355 |
< |
close(FHscolpic); |
356 |
< |
open(FHslabpic, ">$slabpic"); |
357 |
< |
print FHslabpic "\n-Y 1 +X 1\naaa\n"; |
358 |
< |
close(FHslabpic); |
349 |
> |
system "pcomb -x 1 -y 1 -e lo=1 > $scolpic"; |
350 |
> |
system "pcomb -x 1 -y 1 -e lo=1 > $slabpic"; |
351 |
|
} |
352 |
|
|
353 |
|
# Legend: Invert the text labels (for dropshadow) |
365 |
|
|
366 |
|
$cmd = qq[pcomb $pc0args $pc1args "$picture"]; |
367 |
|
$cmd .= qq[ "$cpict"] if ($cpict); |
368 |
< |
$cmd .= qq[ | pcompos -b 0 0 0 $scolpic 0 $sh0 +t .1 $slabinvpic 2 -1 ]; |
368 |
> |
$cmd .= qq[ | pcompos -h -b 0 0 0 $scolpic 0 $sh0 +t .1 $slabinvpic 2 -1 ]; |
369 |
|
$cmd .= qq[ -t .5 $slabpic 0 0 - $legwidth 0]; |
370 |
|
|
371 |
|
if ($doextrem == 1) { |
399 |
|
$cmd .= qq[ $minvpic $minpos $maxvpic $lxmax $ymax]; |
400 |
|
} |
401 |
|
|
402 |
< |
|
403 |
< |
|
402 |
> |
# Clean up and simplify info header with this command |
403 |
> |
$cmd .= qq[ | getinfo -r "pcompos " "falsecolor @savedARGV"]; |
404 |
|
|
405 |
|
# Process image and combine with legend |
406 |
|
system "$cmd"; |