83 |
|
|
84 |
|
COLR *scanline; /* scan line buffer */ |
85 |
|
TMbright *lscan; /* encoded luminance scanline */ |
86 |
< |
BYTE *cscan; /* encoded chroma scanline */ |
87 |
< |
BYTE *pscan; /* compute pixel scanline */ |
86 |
> |
uby8 *cscan; /* encoded chroma scanline */ |
87 |
> |
uby8 *pscan; /* compute pixel scanline */ |
88 |
|
|
89 |
|
RESOLU inpres; /* input resolution and ordering */ |
90 |
|
int xmax, ymax; /* picture dimensions */ |
122 |
|
|
123 |
|
char errmsg[128]; |
124 |
|
|
125 |
< |
BYTE clrtab[256][3]; /* global color map */ |
125 |
> |
uby8 clrtab[256][3]; /* global color map */ |
126 |
|
|
127 |
|
|
128 |
|
Display *thedisplay; |
271 |
|
getevent(); /* main loop */ |
272 |
|
userr: |
273 |
|
fprintf(stderr, |
274 |
< |
"Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e spec][-g gamcor][-s][-ospec][-t intvl] pic ..\n", |
274 |
> |
"Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e spec][-g gamcor][-s][-ospec][-t intvl] hdr ..\n", |
275 |
|
progname); |
276 |
|
exit(1); |
277 |
|
} |
283 |
|
void *p |
284 |
|
) |
285 |
|
{ |
286 |
< |
char fmt[32]; |
286 |
> |
char fmt[MAXFMTLEN]; |
287 |
|
|
288 |
|
if (isexpos(s)) |
289 |
|
exposure *= exposval(s); |
290 |
|
else if (formatval(fmt, s)) |
291 |
< |
wrongformat = strcmp(fmt, COLRFMT); |
292 |
< |
else if (isview(s) && sscanview(&ourview, s) > 0) |
293 |
< |
gotview++; |
291 |
> |
wrongformat = strcmp(fmt, COLRFMT) && strcmp(fmt, SPECFMT); |
292 |
> |
else if (isview(s)) |
293 |
> |
gotview += sscanview(&ourview, s); |
294 |
> |
else if (isncomp(s)) |
295 |
> |
NCSAMP = ncompval(s); |
296 |
> |
else if (iswlsplit(s)) |
297 |
> |
wlsplitval(WLPART, s); |
298 |
|
return(0); |
299 |
|
} |
300 |
|
|
401 |
|
windowName.encoding = iconName.encoding = XA_STRING; |
402 |
|
windowName.format = iconName.format = 8; |
403 |
|
windowName.value = (u_char *)name; |
404 |
< |
windowName.nitems = strlen(windowName.value); |
404 |
> |
windowName.nitems = strlen((char *)windowName.value); |
405 |
|
iconName.value = (u_char *)name; |
406 |
< |
iconName.nitems = strlen(windowName.value); |
406 |
> |
iconName.nitems = strlen((char *)windowName.value); |
407 |
|
|
408 |
|
xclshints.res_name = NULL; |
409 |
|
xclshints.res_class = "Ximage"; |
425 |
|
register int es; |
426 |
|
int cs; |
427 |
|
|
428 |
< |
if ( (es = err != NULL) ) |
428 |
> |
if ( (es = (err != NULL)) ) |
429 |
|
fprintf(stderr, "%s: %s: %s\n", progname, |
430 |
|
fname==NULL?"<stdin>":fname, err); |
431 |
|
if (thedisplay != NULL) |
451 |
|
register int *rp; |
452 |
|
|
453 |
|
if (v1->class == v2->class) { |
454 |
< |
if (v1->class == TrueColor || v1->class == DirectColor) { |
455 |
< |
/* prefer 24-bit to 32-bit */ |
456 |
< |
if (v1->depth == 24 && v2->depth == 32) |
454 |
> |
if ((v1->class == TrueColor) | (v1->class == DirectColor)) { |
455 |
> |
/* prefer 24-bit */ |
456 |
> |
if ((v1->depth == 24) & (v2->depth > 24)) |
457 |
|
return(-1); |
458 |
< |
if (v1->depth == 32 && v2->depth == 24) |
458 |
> |
if ((v1->depth > 24) & (v2->depth == 24)) |
459 |
|
return(1); |
460 |
|
/* go for maximum depth otherwise */ |
461 |
|
return(v2->depth - v1->depth); |
462 |
|
} |
463 |
|
/* don't be too greedy */ |
464 |
< |
if (maxcolors <= 1<<v1->depth && maxcolors <= 1<<v2->depth) |
464 |
> |
if ((maxcolors <= 1<<v1->depth) & (maxcolors <= 1<<v2->depth)) |
465 |
|
return(v1->depth - v2->depth); |
466 |
|
return(v2->depth - v1->depth); |
467 |
|
} |
468 |
|
/* prefer Pseudo when < 15-bit */ |
469 |
< |
if ((v1->class == TrueColor || v1->class == DirectColor) && |
469 |
> |
if ((v1->class == TrueColor) | (v1->class == DirectColor) && |
470 |
|
v1->depth < 15) |
471 |
|
bad1 = 1; |
472 |
< |
if ((v2->class == TrueColor || v2->class == DirectColor) && |
472 |
> |
if ((v2->class == TrueColor) | (v2->class == DirectColor) && |
473 |
|
v2->depth < 15) |
474 |
|
bad2 = -1; |
475 |
|
if (bad1 | bad2) |
575 |
|
ourdata = (unsigned char *)malloc(ymax*((xmax+7)/8)); |
576 |
|
if (ourdata == NULL) |
577 |
|
goto fail; |
578 |
< |
ourras = make_raster(thedisplay, &ourvis, 1, ourdata, |
578 |
> |
ourras = make_raster(thedisplay, &ourvis, 1, (char *)ourdata, |
579 |
|
xmax, ymax, 8); |
580 |
|
if (ourras == NULL) |
581 |
|
goto fail; |
586 |
|
if (ourdata == NULL) |
587 |
|
goto fail; |
588 |
|
ourras = make_raster(thedisplay, &ourvis, datsiz*8, |
589 |
< |
ourdata, xmax, ymax, datsiz*8); |
589 |
> |
(char *)ourdata, xmax, ymax, datsiz*8); |
590 |
|
if (ourras == NULL) |
591 |
|
goto fail; |
592 |
|
getfull(); |
594 |
|
ourdata = (unsigned char *)malloc(xmax*ymax); |
595 |
|
if (ourdata == NULL) |
596 |
|
goto fail; |
597 |
< |
ourras = make_raster(thedisplay, &ourvis, 8, ourdata, |
597 |
> |
ourras = make_raster(thedisplay, &ourvis, 8, (char *)ourdata, |
598 |
|
xmax, ymax, 8); |
599 |
|
if (ourras == NULL) |
600 |
|
goto fail; |
1064 |
|
goto memerr; |
1065 |
|
if (greyscale) { |
1066 |
|
cscan = TM_NOCHROM; |
1067 |
< |
if ((pscan = (BYTE *)malloc(sizeof(BYTE)*xmax)) == NULL) |
1067 |
> |
if ((pscan = (uby8 *)malloc(sizeof(uby8)*xmax)) == NULL) |
1068 |
|
goto memerr; |
1069 |
< |
} else if ((pscan=cscan = (BYTE *)malloc(3*sizeof(BYTE)*xmax)) |
1069 |
> |
} else if ((pscan=cscan = (uby8 *)malloc(3*sizeof(uby8)*xmax)) |
1070 |
|
== NULL) |
1071 |
|
goto memerr; |
1072 |
|
/* initialize tm library */ |
1073 |
|
tmGlobal = tmInit(flags, stdprims, gamcor); |
1074 |
|
if (tmGlobal == NULL) |
1075 |
|
goto memerr; |
1076 |
< |
if (tmSetSpace(tmGlobal, stdprims, WHTEFFICACY/exposure)) |
1076 |
> |
if (tmSetSpace(tmGlobal, stdprims, WHTEFFICACY/exposure, NULL)) |
1077 |
|
goto tmerr; |
1078 |
|
/* compute picture histogram */ |
1079 |
|
for (y = 0; y < ymax; y++) { |
1104 |
|
int len |
1105 |
|
) |
1106 |
|
{ |
1107 |
< |
register BYTE *ps; |
1107 |
> |
register uby8 *ps; |
1108 |
|
|
1109 |
|
if (tmflags == TM_F_LINEAR) { |
1110 |
|
if (scale) |
1405 |
|
} else if (scanpos != NULL && scanpos[y] == -1) |
1406 |
|
scanpos[y] = ftell(fin); |
1407 |
|
|
1408 |
< |
if (freadcolrs(scanline, xmax, fin) < 0) { |
1408 |
> |
if (fread2colrs(scanline, xmax, fin, NCSAMP, WLPART) < 0) { |
1409 |
|
fprintf(stderr, "%s: %s: unfinished picture\n", |
1410 |
|
progname, fname==NULL?"<stdin>":fname); |
1411 |
|
trunced = y; |