| 1 |
– |
/* Copyright (c) 1994 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Convert from Radiance picture file to Compuserve GIF. |
| 6 |
|
* Currently, we don't know how to get back. |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
|
#include <stdio.h> |
| 10 |
+ |
#include <time.h> |
| 11 |
+ |
#include <math.h> |
| 12 |
|
|
| 13 |
+ |
#include "platform.h" |
| 14 |
|
#include "color.h" |
| 15 |
– |
|
| 15 |
|
#include "resolu.h" |
| 16 |
|
|
| 18 |
– |
#ifdef MSDOS |
| 19 |
– |
#include <fcntl.h> |
| 20 |
– |
#endif |
| 21 |
– |
|
| 22 |
– |
#include <math.h> |
| 23 |
– |
|
| 17 |
|
#define MAXCOLORS 256 |
| 18 |
|
|
| 19 |
|
int rmap[MAXCOLORS]; |
| 45 |
|
|
| 46 |
|
int bradj = 0; /* brightness adjustment */ |
| 47 |
|
|
| 48 |
+ |
int ncolors = 0; /* number of colors requested */ |
| 49 |
+ |
|
| 50 |
|
char *progname; |
| 51 |
|
|
| 52 |
|
|
| 54 |
|
int argc; |
| 55 |
|
char *argv[]; |
| 56 |
|
{ |
| 62 |
– |
int ncolors = 0; |
| 57 |
|
int bitsperpix; |
| 58 |
|
int i; |
| 59 |
< |
#ifdef MSDOS |
| 60 |
< |
extern int _fmode; |
| 61 |
< |
_fmode = O_BINARY; |
| 68 |
< |
setmode(fileno(stdin), O_BINARY); |
| 69 |
< |
setmode(fileno(stdout), O_BINARY); |
| 70 |
< |
#endif |
| 59 |
> |
SET_DEFAULT_BINARY(); |
| 60 |
> |
SET_FILE_BINARY(stdin); |
| 61 |
> |
SET_FILE_BINARY(stdout); |
| 62 |
|
progname = argv[0]; |
| 63 |
|
samplefac = 0; |
| 64 |
|
|
| 219 |
|
|
| 220 |
|
getrow(y); |
| 221 |
|
if (greyscale) |
| 222 |
< |
return(normbright(scanln[x])); |
| 222 |
> |
return((normbright(scanln[x])*ncolors)>>8); |
| 223 |
|
if (pixscan != NULL) |
| 224 |
|
return(pixscan[x]); |
| 225 |
|
return(samplefac ? neu_map_pixel(scanln[x]) : map_pixel(scanln[x])); |