#include	<stdio.h>
#include	<stdlib.h>
#include	<string.h>
#include	<math.h>
#include	<winb.h>
#include	<te.h>
#include	<fntb.h>
#include	<gui.h>
#include	<wgb.h>
#include	<egb.h>
#include	<mos.h>
#include	<fmcfrb.h>
#include	<time.h>
#include	"tpspin.h"

#define	ERROR	(-1)

/****************************************************************/

#define	EGB_PSET	0
#define	EGB_PRESET	1
#define	EGB_OR  	2
#define	EGB_AND 	3
#define	EGB_XOR 	4
#define	EGB_NOT 	5
#define	EGB_MATTE	6
#define	EGB_PASTEL	7

#define	EGB_FORECOL 	0
#define	EGB_BACKCOL 	1
#define	EGB_PAINTCOL	2
#define	EGB_TRANSCOL	3

#define	EGB_MASK_ON		0x81
#define	EGB_MASK_OFF	0x00

#define	EGB_PAINT_BETA		0x0002
#define	EGB_PAINT_BETAF		0x0022
#define	EGB_PAINT_BETAFF	0x0020
#define	EGB_PAINT_TILE		0x0004
#define	EGB_PAINT_TILEF		0x0044
#define	EGB_PAINT_TILEFF	0x0040
#define	EGB_PAIMT_HATCH		0x0008
#define	EGB_PAINT_HATCHF	0x0088
#define	EGB_PAINT_HATCHFF	0x0080

/****************************************************************/

#define	MosPatSize	258

#define	MOS_LEFT	1
#define	MOS_RIGHT	2

/****************************************************************/

typedef struct	
	{	char	*addr;
		short	ds;
		short	x0,y0,x1,y1;
	}BLOCK;

typedef	struct	
	{	short	x,y;
		short	r;
	}CIRCLE;

typedef	struct	
	{	short	x,y;
		short	rx,ry;
	}ELLIPSE;

typedef	struct	
	{	short	x,y;
		short	x0,y0,x1,y1;
		short	r;
	}FAN;

typedef	struct
	{	short	n;
		short	x,y;
	}PSET;

typedef	struct
	{	short	n;
		short	x0,y0,x1,y1;
	}LINE;

