| 1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Find extrema points in a Radiance picture. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
< |
#include <stdio.h> |
| 8 |
> |
#include <math.h> |
| 9 |
> |
|
| 10 |
> |
#include "rtio.h" |
| 11 |
> |
#include "platform.h" |
| 12 |
|
#include "color.h" |
| 13 |
+ |
#include "resolu.h" |
| 14 |
|
|
| 15 |
|
|
| 16 |
|
int orig = 0; |
| 19 |
|
|
| 20 |
|
COLOR expos = WHTCOLOR; |
| 21 |
|
|
| 22 |
+ |
static gethfunc headline; |
| 23 |
|
|
| 24 |
< |
headline(s) /* check header line */ |
| 25 |
< |
char *s; |
| 24 |
> |
|
| 25 |
> |
static int |
| 26 |
> |
headline( /* check header line */ |
| 27 |
> |
char *s, |
| 28 |
> |
void *p |
| 29 |
> |
) |
| 30 |
|
{ |
| 31 |
< |
char fmt[32]; |
| 31 |
> |
char fmt[MAXFMTLEN]; |
| 32 |
|
double d; |
| 33 |
|
COLOR ctmp; |
| 34 |
|
|
| 35 |
|
if (isformat(s)) { /* format */ |
| 36 |
|
formatval(fmt, s); |
| 37 |
< |
wrongformat = strcmp(fmt, COLRFMT); |
| 37 |
> |
wrongformat = !globmatch(PICFMT, fmt); |
| 38 |
|
} |
| 39 |
|
if (!orig) |
| 40 |
< |
return; |
| 40 |
> |
return(0); |
| 41 |
|
if (isexpos(s)) { /* exposure */ |
| 42 |
|
d = exposval(s); |
| 43 |
|
scalecolor(expos, d); |
| 45 |
|
colcorval(ctmp, s); |
| 46 |
|
multcolor(expos, ctmp); |
| 47 |
|
} |
| 48 |
+ |
return(0); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
|
| 52 |
< |
main(argc, argv) |
| 53 |
< |
int argc; |
| 54 |
< |
char *argv[]; |
| 52 |
> |
int |
| 53 |
> |
main( |
| 54 |
> |
int argc, |
| 55 |
> |
char *argv[] |
| 56 |
> |
) |
| 57 |
|
{ |
| 58 |
|
int i; |
| 59 |
|
int xres, yres; |
| 62 |
|
COLR *scan; |
| 63 |
|
COLR cmin, cmax; |
| 64 |
|
int xmin, ymin, xmax, ymax; |
| 65 |
< |
|
| 65 |
> |
SET_DEFAULT_BINARY(); |
| 66 |
> |
SET_FILE_BINARY(stdin); |
| 67 |
|
for (i = 1; i < argc; i++) /* get options */ |
| 68 |
|
if (!strcmp(argv[i], "-o")) |
| 69 |
|
orig++; |
| 85 |
|
fprintf(stderr, "%s: out of memory\n", argv[0]); |
| 86 |
|
exit(1); |
| 87 |
|
} |
| 88 |
< |
setcolr(cmin, 1e10, 1e10, 1e10); |
| 89 |
< |
setcolr(cmax, 0., 0., 0.); |
| 88 |
> |
setcolr(cmin, 1e30, 1e30, 1e30); |
| 89 |
> |
setcolr(cmax, 0., 0., 0.); xmax=ymax=0; |
| 90 |
|
/* find extrema */ |
| 91 |
|
for (y = yres-1; y >= 0; y--) { |
| 92 |
|
if (freadcolrs(scan, xres, stdin) < 0) { |
| 110 |
|
} |
| 111 |
|
} |
| 112 |
|
} |
| 113 |
< |
free((char *)scan); |
| 114 |
< |
printf("%d %d\t%e %e %e\n", xmin, ymin, |
| 113 |
> |
free((void *)scan); |
| 114 |
> |
printf("%d %d\t%.2e %.2e %.2e\n", xmin, ymin, |
| 115 |
|
colrval(cmin,RED)/colval(expos,RED), |
| 116 |
|
colrval(cmin,GRN)/colval(expos,GRN), |
| 117 |
|
colrval(cmin,BLU)/colval(expos,BLU)); |
| 118 |
< |
printf("%d %d\t%e %e %e\n", xmax, ymax, |
| 118 |
> |
printf("%d %d\t%.2e %.2e %.2e\n", xmax, ymax, |
| 119 |
|
colrval(cmax,RED)/colval(expos,RED), |
| 120 |
|
colrval(cmax,GRN)/colval(expos,GRN), |
| 121 |
|
colrval(cmax,BLU)/colval(expos,BLU)); |