1 |
< |
/* Copyright (c) 1992 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1993 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
86 |
|
int i; |
87 |
|
|
88 |
|
progname = argv[0] = fixargv0(argv[0]); |
89 |
< |
if ((gv = getenv("GAMMA")) != NULL) |
89 |
> |
if ((gv = getenv("DISPLAY_GAMMA")) != NULL) |
90 |
|
gamcor = atof(gv); |
91 |
|
|
92 |
|
for (i = 1; i < argc; i++) |
168 |
|
short xsiz, ysiz; |
169 |
|
} video[] = { |
170 |
|
{_MRES256COLOR, 320, 200}, |
171 |
< |
{_VRES256COLOR, 640, 400}, |
171 |
> |
{_VRES256COLOR, 640, 480}, |
172 |
|
{_SVRES256COLOR, 800, 600}, |
173 |
|
{_XRES256COLOR, 1024, 768}, |
174 |
< |
-1 |
174 |
> |
{-1, 0, 0} |
175 |
|
}; |
176 |
|
struct videoconfig config; |
177 |
|
register int i; |
186 |
|
ms_init(); |
187 |
|
initialized = 1; |
188 |
|
_getvideoconfig(&config); |
189 |
< |
if (maxcolors == 0) |
190 |
< |
maxcolors = config.numcolors; |
191 |
< |
if (maxcolors > 4) { |
192 |
< |
maxcolors -= minpix = 2; |
193 |
< |
_settextcolor(ourwhite); |
194 |
< |
} |
189 |
> |
if (maxcolors == 0 | maxcolors > config.numcolors) |
190 |
> |
maxcolors = config.numcolors-2; |
191 |
> |
if (maxcolors <= config.numcolors-2) |
192 |
> |
minpix = 2; |
193 |
> |
else |
194 |
> |
ourwhite = maxcolors-1; |
195 |
> |
_settextcolor(ourwhite); |
196 |
|
cheight = config.numypixels/config.numtextrows; |
197 |
|
cwidth = config.numxpixels/config.numtextcols; |
198 |
|
/* clear scan position array */ |
376 |
|
long cvals[256]; |
377 |
|
register int i; |
378 |
|
|
379 |
< |
if (minpix >= 2) { |
380 |
< |
cvals[ourblack] = _BLACK; cvals[ourwhite] = _BRIGHTWHITE; |
380 |
< |
} |
379 |
> |
cvals[ourblack] = _BLACK; |
380 |
> |
cvals[ourwhite] = _BRIGHTWHITE; |
381 |
|
for (i = 0; i < maxcolors; i++) |
382 |
< |
cvals[i+minpix] = clrtab[i][BLU]<<14 & 0x3f0000L | |
382 |
> |
cvals[i+minpix] = (long)clrtab[i][BLU]<<14 & 0x3f0000L | |
383 |
|
clrtab[i][GRN]<<6 & 0x3f00 | |
384 |
|
clrtab[i][RED]>>2; |
385 |
|
_remapallpalette(cvals); |
395 |
|
setcolrgam(gamcor); |
396 |
|
/* set up color map */ |
397 |
|
for (x = 0; x < maxcolors; x++) |
398 |
< |
clrtab[x][RED] = clrtab[x][GRN] = |
399 |
< |
clrtab[x][BLU] = ((long)x*256+maxcolors/2)/maxcolors; |
398 |
> |
clrtab[x][RED] = clrtab[x][GRN] = clrtab[x][BLU] = |
399 |
> |
((long)x*256 + 128)/maxcolors; |
400 |
|
setpalette(); |
401 |
|
_setplotaction(_GPSET); |
402 |
|
/* read and display file */ |
404 |
|
getscan(y); |
405 |
|
if (scale) |
406 |
|
shiftcolrs(scanline, xmax, scale); |
407 |
+ |
for (x = 0; x < xmax; x++) |
408 |
+ |
scanline[x][GRN] = normbright(scanline[x]); |
409 |
|
colrs_gambs(scanline, xmax); |
410 |
|
if (maxcolors < 256) |
411 |
|
for (x = 0; x < xmax; x++) { |
412 |
< |
thiscolor = ((long)normbright(scanline[x]) * |
413 |
< |
maxcolors + 128) >> 8; |
412 |
> |
thiscolor = ((long)scanline[x][GRN] * |
413 |
> |
maxcolors + maxcolors/2) / 256; |
414 |
|
if (thiscolor != lastcolor) |
415 |
|
_setcolor((lastcolor=thiscolor)+minpix); |
416 |
|
_setpixel(x, y); |
417 |
|
} |
418 |
|
else |
419 |
|
for (x = 0; x < xmax; x++) { |
420 |
< |
thiscolor = normbright(scanline[x]); |
420 |
> |
thiscolor = scanline[x][GRN]; |
421 |
|
if (thiscolor != lastcolor) |
422 |
|
_setcolor((lastcolor=thiscolor)+minpix); |
423 |
|
_setpixel(x, y); |
478 |
|
if (fseek(fin, scanpos[y], 0) == -1) |
479 |
|
quiterr("fseek error"); |
480 |
|
cury = y; |
481 |
< |
} else if (scanpos != NULL && scanpos[y] == -1) |
481 |
> |
} else if (fin != stdin && scanpos[y] == -1) |
482 |
|
scanpos[y] = ftell(fin); |
483 |
|
|
484 |
|
if (freadcolrs(scanline, xmax, fin) < 0) |
599 |
|
inregs.w.ax = 0; |
600 |
|
int386 (0x33, &inregs, &outregs); |
601 |
|
} |
600 |
– |
|