chiark / gitweb /
Use find_aa_density for colon detection
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Jul 2009 18:11:21 +0000 (19:11 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Jul 2009 18:11:21 +0000 (19:11 +0100)
pctb/structure.c

index c54f89a..26945ad 100644 (file)
@@ -765,10 +765,15 @@ void find_islandname(RgbImage *ri) {
       
       for (p.y=islandnamer.tl.y; p.y<=islandnamer.br.y; p.y++) {
        pattern <<= 1;
-       switch (get_p(p)) {
-       case '*': if (runs[nruns]) { nruns++; runs[nruns]=0; }          break;
-       case 'O': runs[nruns]++;              pattern |= 1u;            break;
-       default:                              pattern |= 1UL<<31;       break;
+       double alpha= find_aa_density(ri,p, 0xCCCCAA,0x002255,0);
+       if (alpha >= 0.49) {
+          runs[nruns]++;
+          pattern |= 1u;
+       } else {
+         if (runs[nruns]) {
+           nruns++;
+           runs[nruns]=0;
+         }
        }
       }