/*
 * raster op structures
 */

typedef struct {
    int x;
    int y;
} Point;

typedef struct {
    Point origin;
    Point corner;
} Rectangle;

typedef struct {
    int *blk_address;		/* pointer to image */
    int  blk_width;		/* width of image in bytes */
    Rectangle rect;		/* pixel-positioning */
} Bitmap;

#define	F_CLR		0			/* erase src from dest */
#define	F_STORE		1			/* store src to dest */
#define	F_XOR		2			/* invert src in dest */ 
#define F_ERASE		3			/* erase destination */
#define F_FILL		(F_STORE + F_ERASE)	/* 1 fill destination */
#define F_INVERT	(F_XOR + F_ERASE)	/* compliment destination */

#define	XMAX	640
#define	YMAX	400

#define Pt(p,xval,yval)	((p).x = (xval), (p).y = (yval))
#define Assign(p1,p2)	((p1).x = (p2).x, (p1).y = (p2).y)
#define Rect(r,ox,oy,cx,cy) (Pt((r).origin,(ox),(oy)),Pt((r).corner,(cx),(cy)))

#define muldiv(a,b,c)	(((long)(a)*(long)(b))/(long)(c))

extern Bitmap Dblock;
extern char *display;
extern Bitmap *balloc();

#define Drect Dblock.rect