| 109 | 
  | 
 | 
| 110 | 
  | 
extern char  *malloc(), *calloc(); | 
| 111 | 
  | 
 | 
| 112 | 
– | 
extern double  pow(), log(); | 
| 113 | 
– | 
 | 
| 112 | 
  | 
Display  *thedisplay; | 
| 113 | 
  | 
 | 
| 114 | 
+ | 
 | 
| 115 | 
  | 
main(argc, argv) | 
| 116 | 
  | 
int  argc; | 
| 117 | 
  | 
char  *argv[]; | 
| 307 | 
  | 
} | 
| 308 | 
  | 
 | 
| 309 | 
  | 
 | 
| 311 | 
– | 
eputs(s) | 
| 312 | 
– | 
char    *s; | 
| 313 | 
– | 
{ | 
| 314 | 
– | 
        fputs(s, stderr); | 
| 315 | 
– | 
} | 
| 316 | 
– | 
 | 
| 317 | 
– | 
 | 
| 318 | 
– | 
quit(code) | 
| 319 | 
– | 
int  code; | 
| 320 | 
– | 
{ | 
| 321 | 
– | 
        exit(code); | 
| 322 | 
– | 
} | 
| 323 | 
– | 
 | 
| 324 | 
– | 
 | 
| 310 | 
  | 
static int | 
| 311 | 
  | 
viscmp(v1,v2)           /* compare visual to see which is better, descending */ | 
| 312 | 
  | 
register XVisualInfo    *v1, *v2; | 
| 725 | 
  | 
                return(-1); | 
| 726 | 
  | 
        if (left == ll && right == lr && top == lt && bottom == lb) { | 
| 727 | 
  | 
                copycolor(clr, lc); | 
| 728 | 
< | 
                return; | 
| 728 | 
> | 
                return(0); | 
| 729 | 
  | 
        } | 
| 730 | 
  | 
        for (y = top; y < bottom; y++) { | 
| 731 | 
  | 
                if (getscan(y) == -1) | 
| 754 | 
  | 
                quiterr("out of memory in getmono"); | 
| 755 | 
  | 
        dp = ourdata - 1; | 
| 756 | 
  | 
        for (y = 0; y < ymax; y++) { | 
| 757 | 
< | 
                if (getscan(y) < 0) | 
| 773 | 
< | 
                        quiterr("seek error in getmono"); | 
| 774 | 
< | 
                normcolrs(scanline, xmax, scale); | 
| 757 | 
> | 
                getscan(y); | 
| 758 | 
  | 
                add2icon(y, scanline); | 
| 759 | 
+ | 
                normcolrs(scanline, xmax, scale); | 
| 760 | 
  | 
                err = 0; | 
| 761 | 
  | 
                for (x = 0; x < xmax; x++) { | 
| 762 | 
  | 
                        if (!(x&7)) | 
| 782 | 
  | 
        static short  cerr[ICONSIZ]; | 
| 783 | 
  | 
        static int  ynext; | 
| 784 | 
  | 
        static char  *dp; | 
| 785 | 
+ | 
        COLR  clr; | 
| 786 | 
  | 
        register int  err; | 
| 787 | 
  | 
        register int    x, ti; | 
| 788 | 
  | 
        int  errp; | 
| 813 | 
  | 
                        *++dp = 0; | 
| 814 | 
  | 
                errp = err; | 
| 815 | 
  | 
                ti = x*xmax/iconwidth; | 
| 816 | 
< | 
                err += normbright(scan[ti]) + cerr[x]; | 
| 816 | 
> | 
                copycolr(clr, scan[ti]); | 
| 817 | 
> | 
                normcolrs(clr, 1, scale); | 
| 818 | 
> | 
                err += normbright(clr) + cerr[x]; | 
| 819 | 
  | 
                if (err > 127) | 
| 820 | 
  | 
                        err -= 255; | 
| 821 | 
  | 
                else | 
| 837 | 
  | 
                                        /* read and convert file */ | 
| 838 | 
  | 
        dp = (unsigned long *)ourdata; | 
| 839 | 
  | 
        for (y = 0; y < ymax; y++) { | 
| 840 | 
< | 
                if (getscan(y) < 0) | 
| 841 | 
< | 
                        quiterr("seek error in getfull"); | 
| 840 | 
> | 
                getscan(y); | 
| 841 | 
> | 
                add2icon(y, scanline); | 
| 842 | 
  | 
                if (scale) | 
| 843 | 
  | 
                        shiftcolrs(scanline, xmax, scale); | 
| 844 | 
  | 
                colrs_gambs(scanline, xmax); | 
| 858 | 
– | 
                add2icon(y, scanline); | 
| 845 | 
  | 
                if (ourras->image->blue_mask & 1) | 
| 846 | 
  | 
                        for (x = 0; x < xmax; x++) | 
| 847 | 
  | 
                                *dp++ = scanline[x][RED] << 16 | | 
| 866 | 
  | 
                                        /* read and convert file */ | 
| 867 | 
  | 
        dp = ourdata; | 
| 868 | 
  | 
        for (y = 0; y < ymax; y++) { | 
| 869 | 
< | 
                if (getscan(y) < 0) | 
| 870 | 
< | 
                        quiterr("seek error in getgrey"); | 
| 869 | 
> | 
                getscan(y); | 
| 870 | 
> | 
                add2icon(y, scanline); | 
| 871 | 
  | 
                if (scale) | 
| 872 | 
  | 
                        shiftcolrs(scanline, xmax, scale); | 
| 873 | 
  | 
                colrs_gambs(scanline, xmax); | 
| 888 | 
– | 
                add2icon(y, scanline); | 
| 874 | 
  | 
                if (maxcolors < 256) | 
| 875 | 
  | 
                        for (x = 0; x < xmax; x++) | 
| 876 | 
  | 
                                *dp++ = ((long)normbright(scanline[x]) * | 
| 881 | 
  | 
        } | 
| 882 | 
  | 
        for (x = 0; x < maxcolors; x++) | 
| 883 | 
  | 
                clrtab[x][RED] = clrtab[x][GRN] = | 
| 884 | 
< | 
                        clrtab[x][BLU] = (x*256+maxcolors/2)/maxcolors; | 
| 884 | 
> | 
                        clrtab[x][BLU] = ((long)x*256+maxcolors/2)/maxcolors; | 
| 885 | 
  | 
} | 
| 886 | 
  | 
 | 
| 887 | 
  | 
 | 
| 895 | 
  | 
        for (y = 0; y < ymax; y++) { | 
| 896 | 
  | 
                if (getscan(y) < 0) | 
| 897 | 
  | 
                        quiterr("seek error in getmapped"); | 
| 898 | 
+ | 
                add2icon(y, scanline); | 
| 899 | 
  | 
                if (scale) | 
| 900 | 
  | 
                        shiftcolrs(scanline, xmax, scale); | 
| 901 | 
  | 
                colrs_gambs(scanline, xmax); | 
| 916 | 
– | 
                add2icon(y, scanline); | 
| 902 | 
  | 
                cnt_colrs(scanline, xmax); | 
| 903 | 
  | 
        } | 
| 904 | 
  | 
                                        /* map pixels */ |