| 77 |
|
|
| 78 |
|
double exposure = 1.0; /* exposure compensation used */ |
| 79 |
|
|
| 80 |
+ |
int wrongformat = 0; /* input in another format? */ |
| 81 |
+ |
|
| 82 |
|
GC revgc; /* graphics context with GXinvert */ |
| 83 |
|
|
| 84 |
|
XRASTER *ourras; /* our stored image */ |
| 158 |
|
} else if (i != argc) |
| 159 |
|
goto userr; |
| 160 |
|
/* get header */ |
| 161 |
< |
getheader(fin, headline); |
| 161 |
> |
getheader(fin, headline, NULL); |
| 162 |
|
/* get picture dimensions */ |
| 163 |
< |
if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) |
| 164 |
< |
quiterr("bad picture size"); |
| 163 |
> |
if (wrongformat || fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) |
| 164 |
> |
quiterr("bad picture format"); |
| 165 |
|
/* set view parameters */ |
| 166 |
|
if (gotview && setview(&ourview) != NULL) |
| 167 |
|
gotview = 0; |
| 185 |
|
{ |
| 186 |
|
static char *altname[] = {"rview","rpict","pinterp",VIEWSTR,NULL}; |
| 187 |
|
register char **an; |
| 188 |
+ |
char fmt[32]; |
| 189 |
|
|
| 190 |
|
if (isexpos(s)) |
| 191 |
|
exposure *= exposval(s); |
| 192 |
< |
else |
| 192 |
> |
else if (isformat(s)) { |
| 193 |
> |
formatval(fmt, s); |
| 194 |
> |
wrongformat = strcmp(fmt, COLRFMT); |
| 195 |
> |
} else |
| 196 |
|
for (an = altname; *an != NULL; an++) |
| 197 |
|
if (!strncmp(*an, s, strlen(*an))) { |
| 198 |
|
if (sscanview(&ourview, s+strlen(*an)) > 0) |
| 246 |
|
if (geometry != NULL) { |
| 247 |
|
bzero((char *)&oursizhints, sizeof(oursizhints)); |
| 248 |
|
i = XParseGeometry(geometry, &oursizhints.x, &oursizhints.y, |
| 249 |
< |
&oursizhints.width, &oursizhints.height); |
| 249 |
> |
(unsigned *)&oursizhints.width, |
| 250 |
> |
(unsigned *)&oursizhints.height); |
| 251 |
|
if ((i&(WidthValue|HeightValue)) == (WidthValue|HeightValue)) |
| 252 |
|
oursizhints.flags |= USSize; |
| 253 |
|
else { |
| 417 |
|
sprintf(buf, "%.3f", intens(cval)/exposure); |
| 418 |
|
break; |
| 419 |
|
case 'l': /* luminance */ |
| 420 |
< |
sprintf(buf, "%.0fn", bright(cval)*683.0/exposure); |
| 420 |
> |
sprintf(buf, "%.0fn", luminance(cval)/exposure); |
| 421 |
|
break; |
| 422 |
|
case 'c': /* color */ |
| 423 |
|
comp = pow(2.0, (double)scale); |