--- ray/src/px/ra_t16.c 1991/12/19 14:52:20 2.2 +++ ray/src/px/ra_t16.c 2003/06/05 19:29:34 2.7 @@ -1,9 +1,6 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: ra_t16.c,v 2.7 2003/06/05 19:29:34 schorsch Exp $"; #endif - /* * ra_t16.c - program to convert between RADIANCE and * Targa 16, 24 and 32-bit images. @@ -12,13 +9,13 @@ static char SCCSid[] = "$SunId$ LBL"; */ #include +#include +#include +#include "platform.h" #include "color.h" - #include "resolu.h" - #include "random.h" - #include "targa.h" #define goodpic(h) (((h)->dataType==IM_RGB || (h)->dataType==IM_CRGB) \ @@ -34,10 +31,8 @@ static char SCCSid[] = "$SunId$ LBL"; extern char *ecalloc(), *emalloc(); -extern double pow(); +double gamcor = 2.2; /* gamma correction */ -double gamma = 2.2; /* gamma correction */ - int bradj = 0; /* brightness adjustment */ char *progname; @@ -52,7 +47,9 @@ char *argv[]; struct hdStruct head; int reverse = 0; int i; - + SET_DEFAULT_BINARY(); + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); progname = argv[0]; head.dataBits = 16; @@ -60,7 +57,7 @@ char *argv[]; if (argv[i][0] == '-') switch (argv[i][1]) { case 'g': - gamma = atof(argv[++i]); + gamcor = atof(argv[++i]); break; case 'r': reverse = !reverse; @@ -95,7 +92,7 @@ char *argv[]; quiterr(msg); } /* set gamma */ - setcolrgam(gamma); + setcolrgam(gamcor); /* convert */ if (reverse) { /* get header */ @@ -104,6 +101,7 @@ char *argv[]; if (!goodpic(&head)) quiterr("incompatible format"); /* put header */ + newheader("RADIANCE", stdout); printargs(i, argv, stdout); fputformat(COLRFMT, stdout); putchar('\n'); @@ -164,6 +162,7 @@ char *err; } +void eputs(s) char *s; { @@ -171,6 +170,7 @@ char *s; } +void quit(code) int code; { @@ -281,8 +281,8 @@ struct hdStruct *hp; if (fwritecolrs(scanline, hp->x, stdout) < 0) quiterr("error writing RADIANCE file"); } - free((char *)scanline); - free((char *)tarData); + free((void *)scanline); + free((void *)tarData); } @@ -330,8 +330,8 @@ struct hdStruct *hp; /* write out targa data */ writetarga(hp, tarData, stdout); - free((char *)inl); - free((char *)tarData); + free((void *)inl); + free((void *)tarData); }