chiark / gitweb /
correct cropping and scaling of overlay-info
authorian <ian>
Sun, 1 Jun 2008 19:28:56 +0000 (19:28 +0000)
committerian <ian>
Sun, 1 Jun 2008 19:28:56 +0000 (19:28 +0000)
layout/genoverlayinfo
layout/make-dgram-make
layout/plan-to-gui-data

index 872ea9eef2f7abca9af881dc562c72e56d2d0105..d3779fd53401b5249054e8ba491c6a86cc6dbdf4 100755 (executable)
@@ -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= <M>;
@@ -26,13 +26,15 @@ $matrix[2] *= -1;
 
 print STDERR join("\n",@matrix),"\n";
 
-open C, $cropinfo or die $!;
-while (<C>) {
-    next unless m/^pnmcrop: cropping (\d+) \w+ off the (\w+)$/;
-    $crop{$2}= $1;
+open C, $plandatac or die $!;
+for (;;) {
+    $!=0; defined($_=<C>) 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 (<U>) {
@@ -52,8 +54,8 @@ while (<U>) {
 
     $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 $!;
 }
index f801cb3e9c8bc513d48df29c78d9de04a2fb8cf2..b9b08b6d0e6a7eaf861a5730fe27231177d89a19 100755 (executable)
@@ -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
index 62bb5ed77ec6fd51681a0edbf5b59eba26bc92a8..129d3063dd310b7b803995e463c8b135418bee0d 100755 (executable)
@@ -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();