| 12 |
|
#include "plot.h" |
| 13 |
|
#include "rast.h" |
| 14 |
|
#include "bmpfile.h" |
| 15 |
+ |
#include "targa.h" |
| 16 |
|
|
| 17 |
< |
#define MAXALLOC 30000 |
| 17 |
> |
#define MAXALLOC 100000 |
| 18 |
|
#define DXSIZE 400 /* default x resolution */ |
| 19 |
|
#define DYSIZE 400 /* default y resolution */ |
| 20 |
|
#define XCOM "pexpand +vOCImsp -DP %s | psort +y" |
| 24 |
|
|
| 25 |
|
SCANBLOCK outblock; |
| 26 |
|
|
| 27 |
< |
int dxsize = DXSIZE, dysize = DYSIZE; |
| 27 |
> |
int dxsiz = DXSIZE, dysiz = DYSIZE; |
| 28 |
|
|
| 29 |
|
int maxalloc = MAXALLOC; |
| 30 |
|
|
| 40 |
|
static short condonly = FALSE, |
| 41 |
|
conditioned = FALSE; |
| 42 |
|
|
| 42 |
– |
static int putthead(struct hdStruct *hp, char *ip, FILE *fp); |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
char * |
| 47 |
< |
findtack(s) /* find place to tack on suffix */ |
| 48 |
< |
register char *s; |
| 47 |
> |
findtack(char *s) /* find place to tack on suffix */ |
| 48 |
|
{ |
| 49 |
|
while (*s && *s != '.') |
| 50 |
|
s++; |
| 57 |
|
int argc, |
| 58 |
|
char **argv |
| 59 |
|
) |
| 61 |
– |
|
| 60 |
|
{ |
| 61 |
|
FILE *fp; |
| 62 |
|
char comargs[200], command[300]; |
| 80 |
|
argc--; |
| 81 |
|
break; |
| 82 |
|
case 'x': |
| 83 |
< |
dxsize = atoi(*++argv); |
| 83 |
> |
dxsiz = atoi(*++argv); |
| 84 |
|
argc--; |
| 85 |
|
break; |
| 86 |
|
case 'y': |
| 87 |
< |
dysize = atoi(*++argv); |
| 87 |
> |
dysiz = atoi(*++argv); |
| 88 |
|
argc--; |
| 89 |
|
break; |
| 90 |
|
case 'o': |
| 135 |
|
} |
| 136 |
|
|
| 137 |
|
return(0); |
| 138 |
< |
} |
| 138 |
> |
} |
| 139 |
|
|
| 140 |
|
|
| 143 |
– |
|
| 141 |
|
void |
| 142 |
|
thispage(void) /* rewind current file */ |
| 143 |
|
{ |
| 149 |
|
void |
| 150 |
|
initfile(void) /* initialize this file */ |
| 151 |
|
{ |
| 152 |
< |
/* |
| 153 |
< |
static unsigned char cmap[24] = {255,255,255, 255,152,0, 0,188,0, 0,0,255, |
| 157 |
< |
179,179,0, 255,0,255, 0,200,200, 0,0,0}; |
| 158 |
< |
*/ |
| 159 |
< |
static const unsigned char cmap[8][3] = {0,0,0, 0,0,255, 0,188,0, 255,152,0, |
| 160 |
< |
0,200,200, 255,0,255, 179,179,0, 255,255,255}; |
| 152 |
> |
static const unsigned char cmap[8][3] = {{0,0,0}, {0,0,255}, {0,188,0}, |
| 153 |
> |
{255,152,0}, {0,200,200}, {255,0,255}, {179,179,0}, {255,255,255}}; |
| 154 |
|
static int filenum = 0; |
| 155 |
|
BMPHeader *hp; |
| 156 |
< |
register int i; |
| 156 |
> |
int i; |
| 157 |
|
|
| 158 |
< |
hp = BMPmappedHeader(dxsize, dysize, 0, 256); |
| 166 |
< |
hp->compr = BI_RLE8; |
| 158 |
> |
hp = BMPmappedHeader(dxsiz, dysiz, 0, 256); |
| 159 |
|
if (hp == NULL) |
| 160 |
|
error(USER, "Illegal image parameter(s)"); |
| 161 |
+ |
hp->compr = BI_RLE8; |
| 162 |
|
for (i = 0; i < 8; i++) { |
| 163 |
|
hp->palette[i].r = cmap[i][2]; |
| 164 |
|
hp->palette[i].g = cmap[i][1]; |
| 176 |
|
} |
| 177 |
|
|
| 178 |
|
|
| 186 |
– |
|
| 179 |
|
void |
| 180 |
|
nextpage(void) /* advance to next page */ |
| 189 |
– |
|
| 181 |
|
{ |
| 182 |
|
|
| 183 |
|
if (lineno == 0) |
| 184 |
|
return; |
| 185 |
|
if (bmpw != NULL) { |
| 186 |
< |
while (lineno < dysize) { |
| 186 |
> |
while (lineno < dysiz) { |
| 187 |
|
nextblock(); |
| 188 |
|
outputblock(); |
| 189 |
|
} |
| 195 |
|
} |
| 196 |
|
|
| 197 |
|
|
| 207 |
– |
|
| 198 |
|
#define MINRUN 4 |
| 199 |
|
|
| 200 |
< |
extern void |
| 200 |
> |
void |
| 201 |
|
printblock(void) /* output scanline block to file */ |
| 212 |
– |
|
| 202 |
|
{ |
| 203 |
< |
int i, c2; |
| 204 |
< |
register unsigned char *scanline; |
| 216 |
< |
register int j, beg, cnt = 0; |
| 203 |
> |
int i; |
| 204 |
> |
unsigned char *scanline; |
| 205 |
|
|
| 206 |
|
if (lineno == 0) |
| 207 |
|
initfile(); |
| 208 |
< |
for (i = outblock.ybot; i <= outblock.ytop && i < dysize; i++) { |
| 208 |
> |
for (i = outblock.ybot; i <= outblock.ytop && i < dysiz; i++) { |
| 209 |
|
scanline = outblock.cols[i-outblock.ybot] + outblock.xleft; |
| 210 |
|
memcpy((void *)bmpw->scanline, (void *)scanline, |
| 211 |
|
sizeof(uint8)*(outblock.xright-outblock.xleft+1)); |