From: ian Date: Sun, 1 Jun 2008 19:28:56 +0000 (+0000) Subject: correct cropping and scaling of overlay-info X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=e7002eb4c1c5c40771f1f5acca020ec77bc1c732;p=trains.git correct cropping and scaling of overlay-info --- diff --git a/layout/genoverlayinfo b/layout/genoverlayinfo index 872ea9e..d3779fd 100755 --- a/layout/genoverlayinfo +++ b/layout/genoverlayinfo @@ -3,7 +3,7 @@ use IO::Handle; @ARGV==5 or die; -($cropinfo,$forui,$matrixinfo, $height,$psdpi)=@ARGV; +($plandatac,$forui,$matrixinfo, $height,$psdpi)=@ARGV; open M, $matrixinfo or die $!; $!=0; @matrix= ; @@ -26,13 +26,15 @@ $matrix[2] *= -1; print STDERR join("\n",@matrix),"\n"; -open C, $cropinfo or die $!; -while () { - next unless m/^pnmcrop: cropping (\d+) \w+ off the (\w+)$/; - $crop{$2}= $1; +open C, $plandatac or die $!; +for (;;) { + $!=0; defined($_=) or die $!; + next unless m,^/\* region\: (\d+)\.\.\d+ (\d+)\.\.\d+ \*/$,; + $crop_x= $1; + $crop_y= $2; + last; } -C->error and die $!; -close C or die $!; +close C; open U, $forui or die $!; while () { @@ -52,8 +54,8 @@ while () { $y= $height - $y; - $x -= $crop{'left'}; - $y -= $crop{'top'}; + $x -= $crop_x; + $y -= $crop_y; printf "%s %d %d\n", $lhs, $x, $y or die $!; } diff --git a/layout/make-dgram-make b/layout/make-dgram-make index f801cb3..b9b08b6 100755 --- a/layout/make-dgram-make +++ b/layout/make-dgram-make @@ -20,16 +20,13 @@ BASE.matrix-info: BASE.p0.segenco.ps matrix-demonstrate.ps sed -e '1,/^%L matrix here/d' matrix-demonstrate.ps >>$@.ps.new gs -sDEVICE=nullpage -dBATCH=1 -q $@.ps.new $o -BASE.crop-info: BASE.testui.ppm - @: - BASE.testui.ppm: BASE.pa.segenco.ppm pnmcrop -verbose 2>&1 <$< >$@.1.new | tee BASE.crop-info pnmflip <$@.1.new -ccw >$@.2.new pnmpad <$@.2.new -white -l5 -r5 -t5 -b5 $o BASE.overlay-info: genoverlayinfo \ - BASE.crop-info STEM.redacted.for-ui BASE.matrix-info + BASE.plandata.c STEM.redacted.for-ui BASE.matrix-info ./$^ $(PLANUI_HEIGHT) $(PLANUI_PSDPI) $o END diff --git a/layout/plan-to-gui-data b/layout/plan-to-gui-data index 62bb5ed..129d306 100755 --- a/layout/plan-to-gui-data +++ b/layout/plan-to-gui-data @@ -610,6 +610,8 @@ sub plandata_output_all () { } print "#include \"plan-data-format.h\"\n" or die $!; +print "/* region: $overall{X}{Min}..$overall{X}{Max}". + " $overall{Y}{Min}..$overall{Y}{Max} */\n"; cmapdata_output_all(); xpmdata_output_all(); plandata_output_all();