| 27 |
|
#define my_mapType(h) ((h)->mapType==CM_HASMAP && \ |
| 28 |
|
((h)->CMapBits==24 || (h)->CMapBits==32)) |
| 29 |
|
|
| 30 |
< |
#define taralloc(h) (BYTE *)emalloc((h)->x*(h)->y) |
| 30 |
> |
#define taralloc(h) (uby8 *)emalloc((h)->x*(h)->y) |
| 31 |
|
|
| 32 |
< |
BYTE clrtab[256][3]; |
| 32 |
> |
uby8 clrtab[256][3]; |
| 33 |
|
extern int samplefac; |
| 34 |
|
double gamv = 2.2; /* gamv correction */ |
| 35 |
|
int bradj = 0; /* brightness adjustment */ |
| 36 |
|
char *progname; |
| 37 |
|
char errmsg[128]; |
| 38 |
|
COLR *inl; |
| 39 |
< |
BYTE *tarData; |
| 39 |
> |
uby8 *tarData; |
| 40 |
|
int xmax, ymax; |
| 41 |
|
|
| 42 |
|
static int getint2(FILE *fp); |
| 48 |
|
static void tg2ra(struct hdStruct *hp); |
| 49 |
|
static void getmapped(int nc, int dith); |
| 50 |
|
static void getgrey(int nc); |
| 51 |
< |
static void writetarga(struct hdStruct *h, BYTE *d, FILE *fp); |
| 52 |
< |
static void readtarga(struct hdStruct *h, BYTE *data, FILE *fp); |
| 51 |
> |
static void writetarga(struct hdStruct *h, uby8 *d, FILE *fp); |
| 52 |
> |
static void readtarga(struct hdStruct *h, uby8 *data, FILE *fp); |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
int |
| 309 |
|
) |
| 310 |
|
{ |
| 311 |
|
union { |
| 312 |
< |
BYTE c3[256][3]; |
| 313 |
< |
BYTE c4[256][4]; |
| 312 |
> |
uby8 c3[256][3]; |
| 313 |
> |
uby8 c4[256][4]; |
| 314 |
|
} map; |
| 315 |
|
COLR ctab[256]; |
| 316 |
|
COLR *scanline; |
| 410 |
|
) |
| 411 |
|
{ |
| 412 |
|
int y; |
| 413 |
< |
register BYTE *dp; |
| 413 |
> |
register uby8 *dp; |
| 414 |
|
register int x; |
| 415 |
|
|
| 416 |
|
setcolrgam(gamv); |
| 441 |
|
static void |
| 442 |
|
writetarga( /* write out targa data */ |
| 443 |
|
struct hdStruct *h, |
| 444 |
< |
BYTE *d, |
| 444 |
> |
uby8 *d, |
| 445 |
|
FILE *fp |
| 446 |
|
) |
| 447 |
|
{ |
| 451 |
|
for (j = 2; j >= 0; j--) |
| 452 |
|
putc(clrtab[i][j], fp); |
| 453 |
|
if (h->dataType == IM_CMAP) { /* uncompressed */ |
| 454 |
< |
if (fwrite((char *)d,h->x*sizeof(BYTE),h->y,fp) != h->y) |
| 454 |
> |
if (fwrite((char *)d,h->x*sizeof(uby8),h->y,fp) != h->y) |
| 455 |
|
quiterr("error writing targa file"); |
| 456 |
|
return; |
| 457 |
|
} |
| 462 |
|
static void |
| 463 |
|
readtarga( /* read in targa data */ |
| 464 |
|
struct hdStruct *h, |
| 465 |
< |
BYTE *data, |
| 465 |
> |
uby8 *data, |
| 466 |
|
FILE *fp |
| 467 |
|
) |
| 468 |
|
{ |
| 469 |
|
register int cnt, c; |
| 470 |
< |
register BYTE *dp; |
| 470 |
> |
register uby8 *dp; |
| 471 |
|
|
| 472 |
|
if (h->dataType == IM_CMAP) { /* uncompressed */ |
| 473 |
< |
if (fread((char *)data,h->x*sizeof(BYTE),h->y,fp) != h->y) |
| 473 |
> |
if (fread((char *)data,h->x*sizeof(uby8),h->y,fp) != h->y) |
| 474 |
|
goto readerr; |
| 475 |
|
return; |
| 476 |
|
} |