21 |
|
sum_images(const char *fspec, const CMATRIX *cv, FILE *fout) |
22 |
|
{ |
23 |
|
int myDT = DTfromHeader; |
24 |
< |
COLOR *scanline = NULL; |
24 |
> |
COLR *scanline = NULL; |
25 |
|
CMATRIX *pmat = NULL; |
26 |
|
int myXR=0, myYR=0; |
27 |
|
int i, y; |
56 |
|
if (myDT == DTfromHeader) { /* on first one */ |
57 |
|
myDT = dt; |
58 |
|
myXR = xr; myYR = yr; |
59 |
< |
scanline = (COLOR *)malloc(sizeof(COLOR)*myXR); |
59 |
> |
scanline = (COLR *)malloc(sizeof(COLR)*myXR); |
60 |
|
if (scanline == NULL) |
61 |
|
error(SYSTEM, "out of memory in sum_images()"); |
62 |
|
pmat = cm_alloc(myYR, myXR); |
72 |
|
} |
73 |
|
psp = pmat->cmem; |
74 |
|
for (y = 0; y < yr; y++) { /* read it in */ |
75 |
+ |
COLOR col; |
76 |
|
int x; |
77 |
< |
if (freadscan(scanline, xr, fp) < 0) { |
77 |
> |
if (freadcolrs(scanline, xr, fp) < 0) { |
78 |
|
sprintf(errmsg, "error reading picture '%s'", |
79 |
|
fname); |
80 |
|
error(SYSTEM, errmsg); |
81 |
|
} |
82 |
|
/* sum in scanline */ |
83 |
|
for (x = 0; x < xr; x++, psp += 3) { |
84 |
< |
multcolor(scanline[x], scv); |
85 |
< |
addcolor(psp, scanline[x]); |
84 |
> |
if (!scanline[x][EXP]) |
85 |
> |
continue; /* skip zeroes */ |
86 |
> |
colr_color(col, scanline[x]); |
87 |
> |
multcolor(col, scv); |
88 |
> |
addcolor(psp, col); |
89 |
|
} |
90 |
|
} |
91 |
|
fclose(fp); /* done this picture */ |