| 1 |
– |
/* Copyright (c) 1991 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 |
|
* ra_t16.c - program to convert between RADIANCE and |
| 6 |
|
* Targa 16, 24 and 32-bit images. |
| 9 |
|
*/ |
| 10 |
|
|
| 11 |
|
#include <stdio.h> |
| 12 |
< |
|
| 16 |
< |
#ifdef MSDOS |
| 17 |
< |
#include <fcntl.h> |
| 18 |
< |
#endif |
| 19 |
< |
|
| 12 |
> |
#include <time.h> |
| 13 |
|
#include <math.h> |
| 14 |
|
|
| 15 |
+ |
#include "platform.h" |
| 16 |
|
#include "color.h" |
| 23 |
– |
|
| 17 |
|
#include "resolu.h" |
| 25 |
– |
|
| 18 |
|
#include "random.h" |
| 27 |
– |
|
| 19 |
|
#include "targa.h" |
| 20 |
|
|
| 21 |
|
#define goodpic(h) (((h)->dataType==IM_RGB || (h)->dataType==IM_CRGB) \ |
| 47 |
|
struct hdStruct head; |
| 48 |
|
int reverse = 0; |
| 49 |
|
int i; |
| 50 |
< |
#ifdef MSDOS |
| 51 |
< |
extern int _fmode; |
| 52 |
< |
_fmode = O_BINARY; |
| 62 |
< |
setmode(fileno(stdin), O_BINARY); |
| 63 |
< |
setmode(fileno(stdout), O_BINARY); |
| 64 |
< |
#endif |
| 50 |
> |
SET_DEFAULT_BINARY(); |
| 51 |
> |
SET_FILE_BINARY(stdin); |
| 52 |
> |
SET_FILE_BINARY(stdout); |
| 53 |
|
progname = argv[0]; |
| 54 |
|
|
| 55 |
|
head.dataBits = 16; |
| 101 |
|
if (!goodpic(&head)) |
| 102 |
|
quiterr("incompatible format"); |
| 103 |
|
/* put header */ |
| 104 |
+ |
newheader("RADIANCE", stdout); |
| 105 |
|
printargs(i, argv, stdout); |
| 106 |
|
fputformat(COLRFMT, stdout); |
| 107 |
|
putchar('\n'); |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
|
| 165 |
+ |
void |
| 166 |
|
eputs(s) |
| 167 |
|
char *s; |
| 168 |
|
{ |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
|
| 173 |
+ |
void |
| 174 |
|
quit(code) |
| 175 |
|
int code; |
| 176 |
|
{ |
| 281 |
|
if (fwritecolrs(scanline, hp->x, stdout) < 0) |
| 282 |
|
quiterr("error writing RADIANCE file"); |
| 283 |
|
} |
| 284 |
< |
free((char *)scanline); |
| 285 |
< |
free((char *)tarData); |
| 284 |
> |
free((void *)scanline); |
| 285 |
> |
free((void *)tarData); |
| 286 |
|
} |
| 287 |
|
|
| 288 |
|
|
| 330 |
|
/* write out targa data */ |
| 331 |
|
writetarga(hp, tarData, stdout); |
| 332 |
|
|
| 333 |
< |
free((char *)inl); |
| 334 |
< |
free((char *)tarData); |
| 333 |
> |
free((void *)inl); |
| 334 |
> |
free((void *)tarData); |
| 335 |
|
} |
| 336 |
|
|
| 337 |
|
|