1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
10 |
|
* 4/23/86 |
11 |
|
*/ |
12 |
|
|
13 |
< |
#include <stdio.h> |
13 |
> |
#include "standard.h" |
14 |
|
|
15 |
|
#include "color.h" |
16 |
|
|
17 |
+ |
#include "resolu.h" |
18 |
+ |
|
19 |
|
#define min(a,b) ((a)<(b)?(a):(b)) |
20 |
|
|
21 |
< |
int xres = 0; /* resolution of input */ |
20 |
< |
int yres = 0; |
21 |
> |
RESOLU picres; /* resolution of picture */ |
22 |
|
|
23 |
< |
int uniq = 0; /* unique values? */ |
23 |
> |
int uniq = 0; /* print only unique values? */ |
24 |
|
|
25 |
< |
int original = 0; /* original values? */ |
25 |
> |
int original = 0; /* convert back to original values? */ |
26 |
|
|
27 |
|
int dataonly = 0; /* data only format? */ |
28 |
|
|
31 |
|
int reverse = 0; /* reverse conversion? */ |
32 |
|
|
33 |
|
int format = 'a'; /* input/output format */ |
34 |
+ |
char *fmtid = "ascii"; /* format identifier for header */ |
35 |
|
|
36 |
< |
int header = 1; /* do header */ |
36 |
> |
int header = 1; /* do header? */ |
37 |
|
|
38 |
< |
double exposure = 1.0; |
38 |
> |
int resolution = 1; /* put/get resolution string? */ |
39 |
|
|
40 |
+ |
int wrongformat = 0; /* wrong input format? */ |
41 |
+ |
|
42 |
+ |
double gamcor = 1.0; /* gamma correction */ |
43 |
+ |
|
44 |
+ |
int ord[3] = {RED, GRN, BLU}; /* RGB ordering */ |
45 |
+ |
int rord[4]; /* reverse ordering */ |
46 |
+ |
|
47 |
+ |
COLOR exposure = WHTCOLOR; |
48 |
+ |
|
49 |
|
char *progname; |
50 |
|
|
51 |
|
FILE *fin; |
57 |
|
int argc; |
58 |
|
char **argv; |
59 |
|
{ |
49 |
– |
extern double atof(); |
60 |
|
extern int checkhead(); |
61 |
|
int i; |
62 |
|
|
63 |
|
progname = argv[0]; |
64 |
|
|
65 |
|
for (i = 1; i < argc; i++) |
66 |
< |
if (argv[i][0] == '-') |
66 |
> |
if (argv[i][0] == '-' || argv[i][0] == '+') |
67 |
|
switch (argv[i][1]) { |
68 |
< |
case 'h': /* no header */ |
69 |
< |
header = 0; |
68 |
> |
case 'h': /* header */ |
69 |
> |
header = argv[i][0] == '+'; |
70 |
|
break; |
71 |
+ |
case 'H': /* resolution string */ |
72 |
+ |
resolution = argv[i][0] == '+'; |
73 |
+ |
break; |
74 |
|
case 'u': /* unique values */ |
75 |
< |
uniq = 1; |
75 |
> |
uniq = argv[i][0] == '-'; |
76 |
|
break; |
77 |
|
case 'o': /* original values */ |
78 |
< |
original = 1; |
78 |
> |
original = argv[i][0] == '-'; |
79 |
|
break; |
80 |
+ |
case 'g': /* gamma correction */ |
81 |
+ |
gamcor = atof(argv[++i]); |
82 |
+ |
if (argv[i][0] == '+') |
83 |
+ |
gamcor = 1.0/gamcor; |
84 |
+ |
break; |
85 |
+ |
case 'R': /* reverse byte sequence */ |
86 |
+ |
if (argv[i][0] == '-') { |
87 |
+ |
ord[0]=BLU; ord[1]=GRN; ord[2]=RED; |
88 |
+ |
} else { |
89 |
+ |
ord[0]=RED; ord[1]=GRN; ord[2]=BLU; |
90 |
+ |
} |
91 |
+ |
break; |
92 |
|
case 'r': /* reverse conversion */ |
93 |
< |
reverse = 1; |
93 |
> |
reverse = argv[i][0] == '-'; |
94 |
|
break; |
95 |
|
case 'b': /* brightness values */ |
96 |
< |
brightonly = 1; |
96 |
> |
brightonly = argv[i][0] == '-'; |
97 |
|
break; |
98 |
|
case 'd': /* data only (no indices) */ |
99 |
< |
dataonly = 1; |
99 |
> |
dataonly = argv[i][0] == '-'; |
100 |
|
switch (argv[i][2]) { |
101 |
|
case '\0': |
102 |
|
case 'a': /* ascii */ |
103 |
|
format = 'a'; |
104 |
+ |
fmtid = "ascii"; |
105 |
|
break; |
106 |
|
case 'i': /* integer */ |
107 |
+ |
format = 'i'; |
108 |
+ |
fmtid = "ascii"; |
109 |
+ |
break; |
110 |
|
case 'b': /* byte */ |
111 |
+ |
dataonly = 1; |
112 |
+ |
format = 'b'; |
113 |
+ |
fmtid = "byte"; |
114 |
+ |
break; |
115 |
|
case 'f': /* float */ |
116 |
+ |
dataonly = 1; |
117 |
+ |
format = 'f'; |
118 |
+ |
fmtid = "float"; |
119 |
+ |
break; |
120 |
|
case 'd': /* double */ |
121 |
< |
format = argv[i][2]; |
121 |
> |
dataonly = 1; |
122 |
> |
format = 'd'; |
123 |
> |
fmtid = "double"; |
124 |
|
break; |
125 |
|
default: |
126 |
|
goto unkopt; |
127 |
|
} |
128 |
|
break; |
129 |
|
case 'x': /* x resolution */ |
130 |
< |
xres = atoi(argv[++i]); |
130 |
> |
resolution = 0; |
131 |
> |
if (argv[i][0] == '-') |
132 |
> |
picres.or |= XDECR; |
133 |
> |
picres.xr = atoi(argv[++i]); |
134 |
|
break; |
135 |
|
case 'y': /* y resolution */ |
136 |
< |
yres = atoi(argv[++i]); |
136 |
> |
resolution = 0; |
137 |
> |
if (argv[i][0] == '-') |
138 |
> |
picres.or |= YDECR; |
139 |
> |
if (picres.xr == 0) |
140 |
> |
picres.or |= YMAJOR; |
141 |
> |
picres.yr = atoi(argv[++i]); |
142 |
|
break; |
143 |
|
default: |
144 |
|
unkopt: |
149 |
|
} |
150 |
|
else |
151 |
|
break; |
152 |
< |
|
152 |
> |
/* recognize special formats */ |
153 |
> |
if (dataonly && format == 'b') |
154 |
> |
if (brightonly) |
155 |
> |
fmtid = "8-bit_grey"; |
156 |
> |
else |
157 |
> |
fmtid = "24-bit_rgb"; |
158 |
> |
/* assign reverse ordering */ |
159 |
> |
rord[ord[0]] = 0; |
160 |
> |
rord[ord[1]] = 1; |
161 |
> |
rord[ord[2]] = 2; |
162 |
> |
/* get input */ |
163 |
|
if (i == argc) { |
164 |
|
fin = stdin; |
165 |
|
} else if (i == argc-1) { |
176 |
|
set_io(); |
177 |
|
|
178 |
|
if (reverse) { |
179 |
< |
if (header) /* get header */ |
180 |
< |
copyheader(fin, stdout); |
181 |
< |
/* add to header */ |
125 |
< |
printargs(i, argv, stdout); |
126 |
< |
printf("\n"); |
127 |
< |
if (yres <= 0 || xres <= 0) { |
128 |
< |
fprintf(stderr, "%s: missing x and y resolution\n", |
129 |
< |
progname); |
179 |
> |
/* get header */ |
180 |
> |
if (header && checkheader(fin, fmtid, stdout) < 0) { |
181 |
> |
fprintf(stderr, "%s: wrong input format\n", progname); |
182 |
|
quit(1); |
183 |
|
} |
184 |
< |
printf("-Y %d +X %d\n", yres, xres); /* resolution */ |
184 |
> |
/* get resolution */ |
185 |
> |
if ((resolution && !fgetsresolu(&picres, fin)) || |
186 |
> |
picres.xr <= 0 || picres.yr <= 0) { |
187 |
> |
fprintf(stderr, "%s: missing resolution\n", progname); |
188 |
> |
quit(1); |
189 |
> |
} |
190 |
> |
/* add to header */ |
191 |
> |
printargs(i, argv, stdout); |
192 |
> |
fputformat(COLRFMT, stdout); |
193 |
> |
putchar('\n'); |
194 |
> |
fputsresolu(&picres, stdout); /* always put resolution */ |
195 |
|
valtopix(); |
196 |
|
} else { |
197 |
|
/* get header */ |
198 |
< |
getheader(fin, checkhead); |
199 |
< |
|
200 |
< |
if (xres <= 0 || yres <= 0) /* get picture size */ |
201 |
< |
if (fscanf(fin, "-Y %d +X %d\n", &yres, &xres) != 2) { |
202 |
< |
fprintf(stderr, |
203 |
< |
"%s: missing x and y resolution\n", |
204 |
< |
progname); |
205 |
< |
quit(1); |
206 |
< |
} |
198 |
> |
getheader(fin, checkhead, NULL); |
199 |
> |
if (wrongformat) { |
200 |
> |
fprintf(stderr, "%s: input not a Radiance picture\n", |
201 |
> |
progname); |
202 |
> |
quit(1); |
203 |
> |
} |
204 |
> |
if (!fgetsresolu(&picres, fin)) { |
205 |
> |
fprintf(stderr, "%s: missing resolution\n", progname); |
206 |
> |
quit(1); |
207 |
> |
} |
208 |
|
if (header) { |
209 |
|
printargs(i, argv, stdout); |
210 |
< |
printf("\n"); |
210 |
> |
fputformat(fmtid, stdout); |
211 |
> |
putchar('\n'); |
212 |
|
} |
213 |
+ |
if (resolution) /* put resolution */ |
214 |
+ |
fputsresolu(&picres, stdout); |
215 |
|
pixtoval(); |
216 |
|
} |
217 |
|
|
222 |
|
checkhead(line) /* deal with line from header */ |
223 |
|
char *line; |
224 |
|
{ |
225 |
< |
if (header) |
225 |
> |
char fmt[32]; |
226 |
> |
double d; |
227 |
> |
COLOR ctmp; |
228 |
> |
|
229 |
> |
if (isformat(line)) { |
230 |
> |
formatval(fmt, line); |
231 |
> |
wrongformat = strcmp(fmt, COLRFMT); |
232 |
> |
} else if (original && isexpos(line)) { |
233 |
> |
d = 1.0/exposval(line); |
234 |
> |
scalecolor(exposure, d); |
235 |
> |
} else if (original && iscolcor(line)) { |
236 |
> |
colcorval(ctmp, line); |
237 |
> |
setcolor(exposure, colval(exposure,RED)/colval(ctmp,RED), |
238 |
> |
colval(exposure,GRN)/colval(ctmp,GRN), |
239 |
> |
colval(exposure,BLU)/colval(ctmp,BLU)); |
240 |
> |
} else if (header) |
241 |
|
fputs(line, stdout); |
161 |
– |
if (!strncmp(line, "EXPOSURE=", 9)) |
162 |
– |
exposure *= atof(line+9); |
242 |
|
} |
243 |
|
|
244 |
|
|
245 |
|
pixtoval() /* convert picture to values */ |
246 |
|
{ |
247 |
< |
COLOR *scanln; |
247 |
> |
register COLOR *scanln; |
248 |
> |
int dogamma; |
249 |
|
COLOR lastc; |
250 |
+ |
FLOAT hv[2]; |
251 |
|
int y; |
252 |
|
register int x; |
253 |
|
|
254 |
< |
scanln = (COLOR *)malloc(xres*sizeof(COLOR)); |
254 |
> |
scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR)); |
255 |
|
if (scanln == NULL) { |
256 |
|
fprintf(stderr, "%s: out of memory\n", progname); |
257 |
|
quit(1); |
258 |
|
} |
259 |
+ |
dogamma = gamcor < .95 || gamcor > 1.05; |
260 |
|
setcolor(lastc, 0.0, 0.0, 0.0); |
261 |
< |
for (y = yres-1; y >= 0; y--) { |
262 |
< |
if (freadscan(scanln, xres, fin) < 0) { |
261 |
> |
for (y = 0; y < numscans(&picres); y++) { |
262 |
> |
if (freadscan(scanln, scanlen(&picres), fin) < 0) { |
263 |
|
fprintf(stderr, "%s: read error\n", progname); |
264 |
|
quit(1); |
265 |
|
} |
266 |
< |
for (x = 0; x < xres; x++) { |
266 |
> |
for (x = 0; x < scanlen(&picres); x++) { |
267 |
|
if (uniq) |
268 |
< |
if ( scanln[x][RED] == lastc[RED] && |
269 |
< |
scanln[x][GRN] == lastc[GRN] && |
270 |
< |
scanln[x][BLU] == lastc[BLU] ) |
268 |
> |
if ( colval(scanln[x],RED) == |
269 |
> |
colval(lastc,RED) && |
270 |
> |
colval(scanln[x],GRN) == |
271 |
> |
colval(lastc,GRN) && |
272 |
> |
colval(scanln[x],BLU) == |
273 |
> |
colval(lastc,BLU) ) |
274 |
|
continue; |
275 |
|
else |
276 |
|
copycolor(lastc, scanln[x]); |
277 |
|
if (original) |
278 |
< |
scalecolor(scanln[x], 1.0/exposure); |
279 |
< |
if (!dataonly) |
280 |
< |
printf("%7d %7d ", x, y); |
278 |
> |
multcolor(scanln[x], exposure); |
279 |
> |
if (dogamma) |
280 |
> |
setcolor(scanln[x], |
281 |
> |
pow(colval(scanln[x],RED), 1.0/gamcor), |
282 |
> |
pow(colval(scanln[x],GRN), 1.0/gamcor), |
283 |
> |
pow(colval(scanln[x],BLU), 1.0/gamcor)); |
284 |
> |
if (!dataonly) { |
285 |
> |
pix2loc(hv, &picres, x, y); |
286 |
> |
printf("%7d %7d ", (int)(hv[0]*picres.xr), |
287 |
> |
(int)(hv[1]*picres.yr)); |
288 |
> |
} |
289 |
|
if ((*putval)(scanln[x], stdout) < 0) { |
290 |
|
fprintf(stderr, "%s: write error\n", progname); |
291 |
|
quit(1); |
298 |
|
|
299 |
|
valtopix() /* convert values to a pixel file */ |
300 |
|
{ |
301 |
< |
COLOR *scanln; |
301 |
> |
int dogamma; |
302 |
> |
register COLOR *scanln; |
303 |
|
int y; |
304 |
|
register int x; |
305 |
|
|
306 |
< |
scanln = (COLOR *)malloc(xres*sizeof(COLOR)); |
306 |
> |
scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR)); |
307 |
|
if (scanln == NULL) { |
308 |
|
fprintf(stderr, "%s: out of memory\n", progname); |
309 |
|
quit(1); |
310 |
|
} |
311 |
< |
for (y = yres-1; y >= 0; y--) { |
312 |
< |
for (x = 0; x < xres; x++) { |
311 |
> |
dogamma = gamcor < .95 || gamcor > 1.05; |
312 |
> |
for (y = 0; y < numscans(&picres); y++) { |
313 |
> |
for (x = 0; x < scanlen(&picres); x++) { |
314 |
|
if (!dataonly) |
315 |
|
fscanf(fin, "%*d %*d"); |
316 |
|
if ((*getval)(scanln[x], fin) < 0) { |
317 |
|
fprintf(stderr, "%s: read error\n", progname); |
318 |
|
quit(1); |
319 |
|
} |
320 |
+ |
if (dogamma) |
321 |
+ |
setcolor(scanln[x], |
322 |
+ |
pow(colval(scanln[x],RED), gamcor), |
323 |
+ |
pow(colval(scanln[x],GRN), gamcor), |
324 |
+ |
pow(colval(scanln[x],BLU), gamcor)); |
325 |
|
} |
326 |
< |
if (fwritescan(scanln, xres, stdout) < 0 |
227 |
< |
|| fflush(stdout) < 0) { |
326 |
> |
if (fwritescan(scanln, scanlen(&picres), stdout) < 0) { |
327 |
|
fprintf(stderr, "%s: write error\n", progname); |
328 |
|
quit(1); |
329 |
|
} |
347 |
|
|
348 |
|
if (fscanf(fp, "%lf %lf %lf", &vd[0], &vd[1], &vd[2]) != 3) |
349 |
|
return(-1); |
350 |
< |
setcolor(col, vd[0], vd[1], vd[2]); |
350 |
> |
setcolor(col, vd[rord[RED]], vd[rord[GRN]], vd[rord[BLU]]); |
351 |
|
return(0); |
352 |
|
} |
353 |
|
|
358 |
|
{ |
359 |
|
double vd[3]; |
360 |
|
|
361 |
< |
if (fread(vd, sizeof(double), 3, fp) != 3) |
361 |
> |
if (fread((char *)vd, sizeof(double), 3, fp) != 3) |
362 |
|
return(-1); |
363 |
< |
setcolor(col, vd[0], vd[1], vd[2]); |
363 |
> |
setcolor(col, vd[rord[RED]], vd[rord[GRN]], vd[rord[BLU]]); |
364 |
|
return(0); |
365 |
|
} |
366 |
|
|
371 |
|
{ |
372 |
|
float vf[3]; |
373 |
|
|
374 |
< |
if (fread(vf, sizeof(float), 3, fp) != 3) |
374 |
> |
if (fread((char *)vf, sizeof(float), 3, fp) != 3) |
375 |
|
return(-1); |
376 |
< |
setcolor(col, vf[0], vf[1], vf[2]); |
376 |
> |
setcolor(col, vf[rord[RED]], vf[rord[GRN]], vf[rord[BLU]]); |
377 |
|
return(0); |
378 |
|
} |
379 |
|
|
386 |
|
|
387 |
|
if (fscanf(fp, "%d %d %d", &vi[0], &vi[1], &vi[2]) != 3) |
388 |
|
return(-1); |
389 |
< |
setcolor(col,(vi[0]+.5)/256.,(vi[1]+.5)/256.,(vi[2]+.5)/256.); |
389 |
> |
setcolor(col, (vi[rord[RED]]+.5)/256., |
390 |
> |
(vi[rord[GRN]]+.5)/256., (vi[rord[BLU]]+.5)/256.); |
391 |
|
return(0); |
392 |
|
} |
393 |
|
|
398 |
|
{ |
399 |
|
BYTE vb[3]; |
400 |
|
|
401 |
< |
if (fread(vb, sizeof(BYTE), 3, fp) != 3) |
401 |
> |
if (fread((char *)vb, sizeof(BYTE), 3, fp) != 3) |
402 |
|
return(-1); |
403 |
< |
setcolor(col,(vb[0]+.5)/256.,(vb[1]+.5)/256.,(vb[2]+.5)/256.); |
403 |
> |
setcolor(col, (vb[rord[RED]]+.5)/256., |
404 |
> |
(vb[rord[GRN]]+.5)/256., (vb[rord[BLU]]+.5)/256.); |
405 |
|
return(0); |
406 |
|
} |
407 |
|
|
425 |
|
{ |
426 |
|
double vd; |
427 |
|
|
428 |
< |
if (fread(&vd, sizeof(double), 1, fp) != 1) |
428 |
> |
if (fread((char *)&vd, sizeof(double), 1, fp) != 1) |
429 |
|
return(-1); |
430 |
|
setcolor(col, vd, vd, vd); |
431 |
|
return(0); |
438 |
|
{ |
439 |
|
float vf; |
440 |
|
|
441 |
< |
if (fread(&vf, sizeof(float), 1, fp) != 1) |
441 |
> |
if (fread((char *)&vf, sizeof(float), 1, fp) != 1) |
442 |
|
return(-1); |
443 |
|
setcolor(col, vf, vf, vf); |
444 |
|
return(0); |
467 |
|
BYTE vb; |
468 |
|
double d; |
469 |
|
|
470 |
< |
if (fread(&vb, sizeof(BYTE), 1, fp) != 1) |
470 |
> |
if (fread((char *)&vb, sizeof(BYTE), 1, fp) != 1) |
471 |
|
return(-1); |
472 |
|
d = (vb+.5)/256.; |
473 |
|
setcolor(col, d, d, d); |
480 |
|
FILE *fp; |
481 |
|
{ |
482 |
|
fprintf(fp, "%15.3e %15.3e %15.3e\n", |
483 |
< |
colval(col,RED), |
484 |
< |
colval(col,GRN), |
485 |
< |
colval(col,BLU)); |
483 |
> |
colval(col,ord[0]), |
484 |
> |
colval(col,ord[1]), |
485 |
> |
colval(col,ord[2])); |
486 |
|
|
487 |
|
return(ferror(fp) ? -1 : 0); |
488 |
|
} |
494 |
|
{ |
495 |
|
float vf[3]; |
496 |
|
|
497 |
< |
vf[0] = colval(col,RED); |
498 |
< |
vf[1] = colval(col,GRN); |
499 |
< |
vf[2] = colval(col,BLU); |
500 |
< |
fwrite(vf, sizeof(float), 3, fp); |
497 |
> |
vf[0] = colval(col,ord[0]); |
498 |
> |
vf[1] = colval(col,ord[1]); |
499 |
> |
vf[2] = colval(col,ord[2]); |
500 |
> |
fwrite((char *)vf, sizeof(float), 3, fp); |
501 |
|
|
502 |
|
return(ferror(fp) ? -1 : 0); |
503 |
|
} |
509 |
|
{ |
510 |
|
double vd[3]; |
511 |
|
|
512 |
< |
vd[0] = colval(col,RED); |
513 |
< |
vd[1] = colval(col,GRN); |
514 |
< |
vd[2] = colval(col,BLU); |
515 |
< |
fwrite(vd, sizeof(double), 3, fp); |
512 |
> |
vd[0] = colval(col,ord[0]); |
513 |
> |
vd[1] = colval(col,ord[1]); |
514 |
> |
vd[2] = colval(col,ord[2]); |
515 |
> |
fwrite((char *)vd, sizeof(double), 3, fp); |
516 |
|
|
517 |
|
return(ferror(fp) ? -1 : 0); |
518 |
|
} |
523 |
|
FILE *fp; |
524 |
|
{ |
525 |
|
fprintf(fp, "%d %d %d\n", |
526 |
< |
(int)(colval(col,RED)*256.), |
527 |
< |
(int)(colval(col,GRN)*256.), |
528 |
< |
(int)(colval(col,BLU)*256.)); |
526 |
> |
(int)(colval(col,ord[0])*256.), |
527 |
> |
(int)(colval(col,ord[1])*256.), |
528 |
> |
(int)(colval(col,ord[2])*256.)); |
529 |
|
|
530 |
|
return(ferror(fp) ? -1 : 0); |
531 |
|
} |
538 |
|
register int i; |
539 |
|
BYTE vb[3]; |
540 |
|
|
541 |
< |
i = colval(col,RED)*256.; |
541 |
> |
i = colval(col,ord[0])*256.; |
542 |
|
vb[0] = min(i,255); |
543 |
< |
i = colval(col,GRN)*256.; |
543 |
> |
i = colval(col,ord[1])*256.; |
544 |
|
vb[1] = min(i,255); |
545 |
< |
i = colval(col,BLU)*256.; |
545 |
> |
i = colval(col,ord[2])*256.; |
546 |
|
vb[2] = min(i,255); |
547 |
< |
fwrite(vb, sizeof(BYTE), 3, fp); |
547 |
> |
fwrite((char *)vb, sizeof(BYTE), 3, fp); |
548 |
|
|
549 |
|
return(ferror(fp) ? -1 : 0); |
550 |
|
} |
567 |
|
float vf; |
568 |
|
|
569 |
|
vf = bright(col); |
570 |
< |
fwrite(&vf, sizeof(float), 1, fp); |
570 |
> |
fwrite((char *)&vf, sizeof(float), 1, fp); |
571 |
|
|
572 |
|
return(ferror(fp) ? -1 : 0); |
573 |
|
} |
580 |
|
double vd; |
581 |
|
|
582 |
|
vd = bright(col); |
583 |
< |
fwrite(&vd, sizeof(double), 1, fp); |
583 |
> |
fwrite((char *)&vd, sizeof(double), 1, fp); |
584 |
|
|
585 |
|
return(ferror(fp) ? -1 : 0); |
586 |
|
} |
605 |
|
|
606 |
|
i = bright(col)*256.; |
607 |
|
vb = min(i,255); |
608 |
< |
fwrite(&vb, sizeof(BYTE), 1, fp); |
608 |
> |
fwrite((char *)&vb, sizeof(BYTE), 1, fp); |
609 |
|
|
610 |
|
return(ferror(fp) ? -1 : 0); |
611 |
|
} |