--- ray/src/px/ra_t16.c 1991/08/23 13:40:04 1.14 +++ 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,11 +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) \ @@ -32,10 +31,8 @@ static char SCCSid[] = "$SunId$ LBL"; extern char *ecalloc(), *emalloc(); -extern double atof(), pow(); +double gamcor = 2.2; /* gamma correction */ -double gamma = 2.2; /* gamma correction */ - int bradj = 0; /* brightness adjustment */ char *progname; @@ -50,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; @@ -58,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; @@ -93,7 +92,7 @@ char *argv[]; quiterr(msg); } /* set gamma */ - setcolrgam(gamma); + setcolrgam(gamcor); /* convert */ if (reverse) { /* get header */ @@ -102,15 +101,16 @@ char *argv[]; if (!goodpic(&head)) quiterr("incompatible format"); /* put header */ + newheader("RADIANCE", stdout); printargs(i, argv, stdout); fputformat(COLRFMT, stdout); putchar('\n'); - fputresolu(YMAJOR|YDECR, head.x, head.y, stdout); + fprtresolu(head.x, head.y, stdout); /* convert file */ tg2ra(&head); } else { if (checkheader(stdin, COLRFMT, NULL) < 0 || - fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR)) + fgetresolu(&head.x, &head.y, stdin) < 0) quiterr("bad picture file"); /* assign header */ head.textSize = 0; @@ -162,6 +162,7 @@ char *err; } +void eputs(s) char *s; { @@ -169,6 +170,7 @@ char *s; } +void quit(code) int code; { @@ -279,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); } @@ -328,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); }