chiark / gitweb /
trying colour flipping; is broken atm
authorian <ian>
Fri, 22 Oct 2004 12:02:35 +0000 (12:02 +0000)
committerian <ian>
Fri, 22 Oct 2004 12:02:35 +0000 (12:02 +0000)
layout/Makefile
layout/layout
layout/segcmapassign

index 3651f08e7321c2c60066a77bf96b8db09fc0b702..bfe1bd92ea4529ba81ad2ffb06a5ee749f3043b6 100644 (file)
@@ -66,3 +66,4 @@ clean:
                -rm -f *.oprint-*.ps
 
 .PRECIOUS:     $(OPRINTS)
+.PRECIOUS:     ours-g%.segcmap ours-g%.segcmapreq
index 7d58e276aeecafc819bc0eb497c5fe485af8feb0..82496240c6be34fb772cfe8c13e070893fa997c6 100755 (executable)
@@ -665,6 +665,7 @@ print DEBUG "ps $p0 $p1 $lenperp ($ppu)\n";
                $red += 32 if $segments[0] =~ m/^\-/;
                $red %= 64;
                $red /= 64.0;
+               $red <<= 2;
                $red= sprintf("%f", $red);
                o("    $red $subsegcmap{$csegbare} setrgbcolor\n");
            } else {
index f25ec6defb10e3574f124e0e7e37ac3b2f21d92d..f97d9c8ff8ed1775971fa7a408ead6467af25123 100755 (executable)
@@ -25,9 +25,9 @@
 # Encoding is as follows (bits from MSbit to LSbit):
 #
 #  RED
+#     6 bits angle
 #     1 bit reserved (0)
 #     1 bit `edge or core' (currently 0 meaning `core')
-#     6 bits angle
 #
 #  GREEN
 #     2 bits segment overflow
 #          the remainder of the bits are the position of that feature
 #       the feature all-bits-1 (0b111111) is for fixed track
 #       (so every moveable feature prefix must contain at least one 0)
+#     BUT all of the bits are in the reverse order (so the
+#     MSbit of GREEN is the LSbit of the moveable feature position)
 #
 #  BLUE
-#     8 bits segment main
+#     8 bits segment main IN REVERSE ORDER
 
 use strict;
 use IO::Handle;
@@ -66,18 +68,29 @@ while (<>) {
     }
 }
 
+sub reverse_bits_in_byte ($) {
+    my ($b) = @_;
+    my ($c);
+    $c  = (($b >>  1) & 0x55) | (($b <<  1) & 0xaa);
+    $c |= (($b >>  2) & 0x33) | (($b <<  2) & 0xcc);
+    $c |= (($b >>  4) & 0x0f) | (($b <<  4) & 0xf0);
+    return $c;
+}
+
 sub cssnmap ($$$$) {
     my ($seg,$movfeatconf,$segnum,$posinfo) = @_;
-    my ($green,$blue);
+    my ($green,$blue,$greenr,$bluer);
     $green= (($segnum >> 8) & 0x03)<<6;
     $green |= $posinfo;
     $blue= $segnum & 0xff;
+    $greenr= reverse_bits_in_byte($green);
+    $bluer= reverse_bits_in_byte($blue);
     printf("C %s/%s %.10f %.10f\n".
-          "# %s/%s 0x%x 0x%x\n",
+          "# %s/%s 0x%x 0x%x 0x%x 0x%x\n",
           $seg,$movfeatconf,
-          $green/255, $blue/255,
+          $greenr/255, $bluer/255,
           $seg,$movfeatconf,
-          $green, $blue)
+          $green, $blue, $greenr, $bluer)
        or die $!;
 }