38 |
|
#define BORWIDTH 5 /* border width */ |
39 |
|
#define BARHEIGHT 25 /* menu bar size */ |
40 |
|
|
41 |
< |
double gamcor = 2.0; /* gamma correction */ |
41 |
> |
double gamcor = 2.2; /* gamma correction */ |
42 |
|
|
43 |
|
XRASTER *ourras = NULL; /* our stored raster image */ |
44 |
|
|
144 |
|
if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) |
145 |
|
quiterr("bad picture size"); |
146 |
|
/* set view parameters */ |
147 |
< |
if (gotview) |
147 |
> |
if (gotview) { |
148 |
> |
ourview.hresolu = xmax; |
149 |
> |
ourview.vresolu = ymax; |
150 |
|
if (setview(&ourview) != NULL) |
151 |
|
gotview = 0; |
152 |
< |
|
152 |
> |
} |
153 |
|
if ((scanline = (COLR *)malloc(xmax*sizeof(COLR))) == NULL) |
154 |
|
quiterr("out of memory"); |
155 |
|
|
648 |
|
int y; |
649 |
|
register rgbpixel *l3; |
650 |
|
{ |
651 |
< |
register BYTE *l4; |
652 |
< |
register int shift, c; |
651 |
< |
int i; |
652 |
< |
|
651 |
> |
register int i; |
652 |
> |
/* read scanline */ |
653 |
|
if (getscan(y) < 0) |
654 |
|
quiterr("cannot seek for picreadline"); |
655 |
|
/* convert scanline */ |
656 |
< |
for (l4=scanline[0], i=xmax; i--; l4+=4, l3++) { |
657 |
< |
shift = l4[EXP] - COLXS + scale; |
658 |
< |
if (shift >= 8) { |
659 |
< |
l3->r = l3->g = l3->b = 255; |
660 |
< |
} else if (shift <= -8) { |
661 |
< |
l3->r = l3->g = l3->b = 0; |
662 |
< |
} else if (shift > 0) { |
663 |
< |
c = l4[RED] << shift; |
664 |
< |
l3->r = c > 255 ? 255 : c; |
665 |
< |
c = l4[GRN] << shift; |
666 |
< |
l3->g = c > 255 ? 255 : c; |
667 |
< |
c = l4[BLU] << shift; |
668 |
< |
l3->b = c > 255 ? 255 : c; |
669 |
< |
} else if (shift < 0) { |
670 |
< |
l3->r = l4[RED] >> -shift; |
671 |
< |
l3->g = l4[GRN] >> -shift; |
672 |
< |
l3->b = l4[BLU] >> -shift; |
673 |
< |
} else { |
674 |
< |
l3->r = l4[RED]; |
675 |
< |
l3->g = l4[GRN]; |
676 |
< |
l3->b = l4[BLU]; |
677 |
< |
} |
656 |
> |
if (scale != 0) |
657 |
> |
for (i = 0; i < xmax; i++) |
658 |
> |
if (scanline[i][EXP]+scale >= 0) |
659 |
> |
scanline[i][EXP] += scale; |
660 |
> |
normcolrs(scanline, xmax); |
661 |
> |
for (i = 0; i < xmax; i++) { |
662 |
> |
l3[i].r = scanline[i][RED]; |
663 |
> |
l3[i].g = scanline[i][GRN]; |
664 |
> |
l3[i].b = scanline[i][BLU]; |
665 |
|
} |
666 |
|
} |
667 |
|
|