| 1 |
/* RCSid: $Id: rast.h,v 1.2 2003/07/14 22:24:00 schorsch Exp $ */ |
| 2 |
/* |
| 3 |
* Structures for line segment output to raster files |
| 4 |
*/ |
| 5 |
#ifndef _RAD_RAST_H_ |
| 6 |
#define _RAD_RAST_H_ |
| 7 |
|
| 8 |
#ifdef __cplusplus |
| 9 |
extern "C" { |
| 10 |
#endif |
| 11 |
|
| 12 |
#define NUMSCANS 16 /* number of scanlines per block */ |
| 13 |
|
| 14 |
typedef struct { /* raster scanline block */ |
| 15 |
unsigned char *cols[NUMSCANS]; |
| 16 |
int ybot, ytop; /* ybot is scan[0] */ |
| 17 |
int xleft, xright; |
| 18 |
int width; |
| 19 |
} SCANBLOCK; |
| 20 |
|
| 21 |
extern int ydown; /* y going down? */ |
| 22 |
|
| 23 |
extern int minwidth; /* minimum line width */ |
| 24 |
|
| 25 |
extern SCANBLOCK outblock; /* output span */ |
| 26 |
|
| 27 |
#define IBLK 0 /* index for black */ |
| 28 |
#define IRED 1 |
| 29 |
#define IGRN 2 |
| 30 |
#define IBLU 3 |
| 31 |
#define IYEL 4 |
| 32 |
#define IMAG 5 |
| 33 |
#define ICYN 6 |
| 34 |
#define IWHT 7 |
| 35 |
|
| 36 |
#define pixtog(x,y,c) { register unsigned char \ |
| 37 |
*cp = outblock.cols[(y)-outblock.ybot]+(x); \ |
| 38 |
*cp = ((~*cp ^ (c)<<3)&070) | (*cp&07); } |
| 39 |
|
| 40 |
#define pixmix(x,y,c) (outblock.cols[(y)-outblock.ybot][x] &= 070|(c)) |
| 41 |
|
| 42 |
#define someabove(p,y) (CONV((p)->xy[YMX],dysiz) > (y)) |
| 43 |
#define somebelow(p,y) (CONV((p)->xy[YMN],dysiz) < (y)) |
| 44 |
|
| 45 |
#define inthis(p) (ydown ? someabove(p,outblock.ybot-1) : \ |
| 46 |
somebelow(p,outblock.ytop+1)) |
| 47 |
#define innext(p) (ydown ? somebelow(p,outblock.ybot) : \ |
| 48 |
someabove(p,outblock.ytop)) |
| 49 |
|
| 50 |
#ifdef __cplusplus |
| 51 |
} |
| 52 |
#endif |
| 53 |
#endif /* _RAD_RAST_H_ */ |
| 54 |
|