$NetBSD$ --- tiff.c.orig Mon Nov 2 14:25:51 1998 +++ tiff.c Mon Jul 31 14:20:22 2000 @@ -22,6 +22,8 @@ #include #include +#include +#include /******** tiny TIFF loader ( 256 colors, not compressed ) ********/ @@ -125,7 +127,7 @@ int i; int j=0; unsigned char *ptr; - int x, y, a, byte; + int x, y, a, color; for(i=0; i<34816; i++) data[i] = getchar(); @@ -135,9 +137,11 @@ return -1; } for (i=0; i<256; i++){ - r[j] = *(data + pos_cmap + j*2 ) & 0xff; - g[j] = *(data + pos_cmap + j*2 +512 ) & 0xff; - b[j] = *(data + pos_cmap + j*2 +1024) & 0xff; + j = i; + r[j] = (*(data + pos_cmap + j*2 ) & 0xff) >> 4; + g[j] = (*(data + pos_cmap + j*2 +512 ) & 0xff) >> 4; + b[j] = (*(data + pos_cmap + j*2 +1024) & 0xff) >> 4; + if ((r[j]==0xff)&&(g[j]==0)&&(b[j]==0)){ /* through */ mask[j] = 3; @@ -150,36 +154,36 @@ mask[j] = 0; } /* shuffle */ - j = (j + 169) & 255; + //j = (j + 169) & 255; } - printf("static struct screen chip = { 0, 64, 256, 128,\n"); + printf("static mglcol_pixmap chip = { 256, 128,\n"); ptr = (unsigned char *)(data + pos_image); for (y=0; y> 8); + printf("\\x%02x", color & 0xff); } printf("\"\n"); } printf("};\n"); - printf("static struct screen chip_mask = { 0, 64, 256, 128,\n"); + printf("static mglcol_pixmap chip_mask = { 256, 128,\n"); ptr = (unsigned char *)(data + pos_image); for (y=0; y> 8); + printf("\\x%02x", color & 0xff); } printf("\"\n"); }