38 |
|
static void getmbcalfile(char *fn, struct mbc *mb); |
39 |
|
|
40 |
|
|
41 |
< |
extern double |
41 |
> |
double |
42 |
|
rgblum( /* compute (scotopic) luminance of RGB color */ |
43 |
|
COLOR clr, |
44 |
|
int scotopic |
53 |
|
} |
54 |
|
|
55 |
|
|
56 |
< |
extern double |
56 |
> |
double |
57 |
|
cielum( /* compute (scotopic) luminance of CIE color */ |
58 |
|
COLOR xyz, |
59 |
|
int scotopic |
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
< |
extern COLOR * |
70 |
> |
COLOR * |
71 |
|
nextscan(void) /* read and condition next scanline */ |
72 |
|
{ |
73 |
|
if (nread >= numscans(&inpres)) { |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
< |
extern COLOR * |
105 |
> |
COLOR * |
106 |
|
firstscan(void) /* return first processed scanline */ |
107 |
|
{ |
108 |
|
if (mbcalfile != NULL) /* load macbethcal file */ |
127 |
|
|
128 |
|
static void |
129 |
|
sfscan( /* apply scalefactor to scanline */ |
130 |
< |
register COLOR *sl, |
130 |
> |
COLOR *sl, |
131 |
|
int len, |
132 |
|
double sf |
133 |
|
) |
149 |
|
/* improves saturated color rendering */ |
150 |
|
copycolor(gryc, col); |
151 |
|
for (i = 3; i--; ) |
152 |
< |
if (gryc[i] > cwhite[i]) |
153 |
< |
gryc[i] = cwhite[i]; |
154 |
< |
else if (gryc[i] < cblack[i]) |
155 |
< |
gryc[i] = cblack[i]; |
156 |
< |
return((*lumf)(gryc,0)); |
152 |
> |
if (gryc[i] > 1) |
153 |
> |
gryc[i] = 1; |
154 |
> |
else if (gryc[i] < 0) |
155 |
> |
gryc[i] = 0; |
156 |
> |
return(bright(gryc)); |
157 |
|
} |
158 |
|
|
159 |
|
|
160 |
|
static void |
161 |
|
matscan( /* apply color matrix to scaline */ |
162 |
< |
register COLOR *sl, |
162 |
> |
COLOR *sl, |
163 |
|
int len, |
164 |
|
COLORMAT mat |
165 |
|
) |
166 |
|
{ |
167 |
– |
double gryv; |
168 |
– |
|
167 |
|
while (len--) { |
170 |
– |
gryv = greypoint(sl[0]); |
168 |
|
colortrans(sl[0], mat, sl[0]); |
169 |
< |
clipgamut(sl[0], gryv, CGAMUT, cblack, cwhite); |
169 |
> |
clipgamut(sl[0], greypoint(sl[0]), CGAMUT, cblack, cwhite); |
170 |
|
sl++; |
171 |
|
} |
172 |
|
} |
176 |
|
mbscan( /* apply macbethcal adj. to scaline */ |
177 |
|
COLOR *sl, |
178 |
|
int len, |
179 |
< |
register struct mbc *mb |
179 |
> |
struct mbc *mb |
180 |
|
) |
181 |
|
{ |
182 |
|
double d; |
183 |
< |
register int i, j; |
183 |
> |
int i, j; |
184 |
|
|
185 |
|
while (len--) { |
189 |
– |
d = greypoint(sl[0]); |
186 |
|
colortrans(sl[0], mb->cmat, sl[0]); |
187 |
< |
clipgamut(sl[0], d, CGAMUT, mb->cmin, mb->cmax); |
187 |
> |
clipgamut(sl[0], greypoint(sl[0]), CGAMUT, mb->cmin, mb->cmax); |
188 |
|
for (i = 0; i < 3; i++) { |
189 |
|
d = colval(sl[0],i); |
190 |
|
for (j = 0; j < 4 && mb->xa[i][j+1] <= d; j++) |
206 |
|
) |
207 |
|
{ |
208 |
|
int rval; |
213 |
– |
double gryv; |
209 |
|
|
210 |
|
while (len--) { |
216 |
– |
gryv = greypoint(sl[0]); |
211 |
|
rval = warp3d(sl[0], sl[0], wp); |
212 |
|
if (rval & W3ERROR) |
213 |
|
syserror("warp3d"); |
216 |
|
progname, cwarpfile); |
217 |
|
exit(1); |
218 |
|
} |
219 |
< |
clipgamut(sl[0], gryv, CGAMUT, cblack, cwhite); |
219 |
> |
clipgamut(sl[0], greypoint(sl[0]), CGAMUT, cblack, cwhite); |
220 |
|
sl++; |
221 |
|
} |
222 |
|
} |
225 |
|
static void |
226 |
|
getmbcalfile( /* load macbethcal file */ |
227 |
|
char *fn, |
228 |
< |
register struct mbc *mb |
228 |
> |
struct mbc *mb |
229 |
|
) |
230 |
|
{ |
231 |
|
char buf[128]; |
232 |
|
FILE *fp; |
233 |
|
int inpflags = 0; |
234 |
< |
register int i; |
234 |
> |
int i; |
235 |
|
|
236 |
|
if ((fp = fopen(fn, "r")) == NULL) |
237 |
|
syserror(fn); |