chiark / gitweb /
Smoothed state colours now correct if zoomed out
authorJacob Nevins <0jacobnk.git@chiark.greenend.org.uk>
Sat, 18 Jan 2014 16:53:17 +0000 (16:53 +0000)
committerJacob Nevins <0jacobnk.git@chiark.greenend.org.uk>
Sat, 18 Jan 2014 16:53:17 +0000 (16:53 +0000)
Bedbugs.rule
src/Bedbugs.rule.template
src/bedbugs.c

index 967bcb926cc798e77be4e33766b7414b23eccc2d..ee92bb9f08551d78a778027d50b7dd636c8a72a7 100644 (file)
@@ -17,10 +17,6 @@ long. This two-step nature means this is a bit fiddly to use:
 Editing should only be done in the 2-state phase; mixing smoothed and
 unsmoothed states will probably confuse the current rules.
 
-If you zoom out beyond the point where icons are displayed, everything
-gets blobby as smoothed 'off' cells are currently displayed; you'll
-probably want to turn icons off again.
-
 The smoothing algorithm comes from Ben Harris' "Bedstead" font generator,
 <http://bjh21.me.uk/bedstead/>. The idea of applying it to cellular
 automata is due to Simon Tatham. Implementation is by Jacob Nevins.
@@ -774,7 +770,40 @@ anw,aw,zsw,as,zse,ze,zne,zn,zc,1
 anw,aw,asw,zs,zse,ze,zne,zn,zc,1
 
 @COLORS
-255 255 255  255 255 255  white to white
+ 0   0   0   0
+ 1 255 255 255
+ 2   0   0   0
+ 3   0   0   0
+ 4   0   0   0
+ 5   0   0   0
+ 6   0   0   0
+ 7   0   0   0
+ 8   0   0   0
+ 9   0   0   0
+10   0   0   0
+11   0   0   0
+12   0   0   0
+13   0   0   0
+14   0   0   0
+15   0   0   0
+16   0   0   0
+17   0   0   0
+18 255 255 255
+19 255 255 255
+20 255 255 255
+21 255 255 255
+22 255 255 255
+23 255 255 255
+24 255 255 255
+25 255 255 255
+26 255 255 255
+27 255 255 255
+28 255 255 255
+29 255 255 255
+30 255 255 255
+31 255 255 255
+32 255 255 255
+33 255 255 255
 
 @ICONS
 XPM
@@ -782,7 +811,7 @@ XPM
 "7 231 2 1"
 /* colors */
 ". c #000000"
-"A c #FFFFFF"
+"A c #FEFEFF"
 /* icon for state 1 */
 "AAAAAAA"
 "AAAAAAA"
@@ -1052,7 +1081,7 @@ XPM
 "15 495 2 1"
 /* colors */
 ". c #000000"
-"A c #FFFFFF"
+"A c #FEFEFF"
 /* icon for state 1 */
 "AAAAAAAAAAAAAAA"
 "AAAAAAAAAAAAAAA"
@@ -1586,7 +1615,7 @@ XPM
 "31 1023 2 1"
 /* colors */
 ". c #000000"
-"A c #FFFFFF"
+"A c #FEFEFF"
 /* icon for state 1 */
 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
index a19770274979dd6b075f2f2a9db0be15dc5ab70b..ffed7433ddbdaa2fea2b356b07ee9af4efe217d8 100644 (file)
@@ -17,10 +17,6 @@ long. This two-step nature means this is a bit fiddly to use:
 Editing should only be done in the 2-state phase; mixing smoothed and
 unsmoothed states will probably confuse the current rules.
 
-If you zoom out beyond the point where icons are displayed, everything
-gets blobby as smoothed 'off' cells are currently displayed; you'll
-probably want to turn icons off again.
-
 The smoothing algorithm comes from Ben Harris' "Bedstead" font generator,
 <http://bjh21.me.uk/bedstead/>. The idea of applying it to cellular
 automata is due to Simon Tatham. Implementation is by Jacob Nevins.
@@ -36,7 +32,7 @@ symmetries:none
 @@mungedlife.table
 
 @COLORS
-255 255 255  255 255 255  white to white
+@@COLORS
 
 @ICONS
 @@ICONS
index 05d22ba39bb3ba41b11fd58d67b4f9f88a546373..0f83648a3e552eae3347b8967d2bb3f1a4959544 100644 (file)
@@ -298,7 +298,12 @@ void icons(void)
                 int size = sizes[size_index], state;
                 printf("XPM\n/* width height num_colors chars_per_pixel */\n");
                 printf("\"%d %d 2 1\"\n", size, size*33);
-                printf("/* colors */\n\". c #000000\"\n\"A c #FFFFFF\"\n");
+                /* We have to have a non-greyscale colour to trigger Golly's
+                 * "multi-colour icon" mode, so that we can make some states'
+                 * non-icon versions black. And it's not sufficient to
+                 * include an unreferenced, colour, so our 'on' state is
+                 * off-white. */
+                printf("/* colors */\n\". c #000000\"\n\"A c #FEFEFF\"\n");
                 /* icons never used for state 0 */
                 for (state = 1; state < 34; state++) {
                     bool *r = blank(size);
@@ -324,6 +329,26 @@ void icons(void)
         }
 }
 
+void colours(void)
+{
+    int i;
+    for (i=0; i<34; i++) {
+        int lvl;
+        switch (i) {
+            case 0:
+                lvl = 0;
+                break;
+            case 1:
+                lvl = 255;
+                break;
+            default:
+                lvl = (i >= 2+16) ? 255 : 0;
+                break;
+        }
+        printf("%2d %3d %3d %3d\n", i, lvl, lvl, lvl);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     while (!feof(stdin)) {
@@ -341,6 +366,8 @@ int main(int argc, char *argv[])
                 bedstead();
             } else if (strncmp(l+2, "ICONS", n) == 0) {
                 icons();
+            } else if (strncmp(l+2, "COLORS", n) == 0) {
+                colours();
             } else {
                 /* Bodily insert named file on stdout. */
                 FILE *f;