From: Jacob Nevins <0jacobnk.git@chiark.greenend.org.uk>
Date: Sat, 18 Jan 2014 16:53:17 +0000 (+0000)
Subject: Smoothed state colours now correct if zoomed out
X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~jacobn/git?a=commitdiff_plain;h=a125f2a1caaac14ecc376f35d3dc15a40b719135;p=bedbugs.git
Smoothed state colours now correct if zoomed out
---
diff --git a/Bedbugs.rule b/Bedbugs.rule
index 967bcb9..ee92bb9 100644
--- a/Bedbugs.rule
+++ b/Bedbugs.rule
@@ -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,
. 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"
diff --git a/src/Bedbugs.rule.template b/src/Bedbugs.rule.template
index a197702..ffed743 100644
--- a/src/Bedbugs.rule.template
+++ b/src/Bedbugs.rule.template
@@ -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,
. 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
diff --git a/src/bedbugs.c b/src/bedbugs.c
index 05d22ba..0f83648 100644
--- a/src/bedbugs.c
+++ b/src/bedbugs.c
@@ -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;