#ifndef XSIMPLE_H #define XSIMPLE_H #include #include #include #define XK_LATIN1 #define XK_MISCELLANY #include typedef struct { Display *d; int s; Visual *v; int depth; Colormap cmap; Window w; Pixmap pmap; GC gc; int dwidth, dheight; int x, y, width, height; int bwidth, twidth; int r_max, g_max, b_max; int r_shift, g_shift, b_shift; unsigned long p_red[256], p_green[256], p_blue[256]; unsigned long egacolor[64]; int sig; } XVARS; extern XVARS xv; void xinit(char *appname, char *classname, char *winname, int x, int y, int width, int height, int resizable, char *bgcolor, char *fgcolor, long evtmask); void mapwindow(void); int getevent(XEvent *event); void doexpose(XEvent *event); void update(int x, int y, int width, int height); /* pixmap.c */ Pixmap mkpixmap(int width, int height, int depth); void rmpixmap(Pixmap pmap); void putpixmap(Pixmap pmap, int src_x, int src_y, int dst_x, int dst_y, int width, int height); /* image.c */ XImage *mkximage(int width, int height, int depth, int *pad); void rmximage(XImage *img); void putximage(XImage *img, int src_x, int src_y, int dst_x, int dst_y, int width, int height); unsigned long pgetximage(XImage *img, int x, int y); void psetximage(XImage *img, int x, int y, unsigned long pixel); /* draw.c */ void setlinewidth(int width); void cls(unsigned long pixel); void pset(int x, int y, unsigned long pixel); void line(int x1, int y1, int x2, int y2, unsigned long pixel); void poly(XPoint *points, int npoints, unsigned long pixel); void fillpoly(XPoint *points, int npoints, unsigned long pixel); void rect(int x, int y, int width, int height, unsigned long pixel); void fillrect(int x, int y, int width, int height, unsigned long pixel); void ellipse(int x, int y, int width, int height, unsigned long pixel); void fillellipse(int x, int y, int width, int height, unsigned long pixel); void string(int x, int y, char *s, unsigned long pixel); void imgstring(int x, int y, char *s, unsigned long bgpixel, unsigned long fgpixel); /* font.c */ XFontStruct *getfont(char *name); void setfont(XFontStruct *fontinfo); /* color.c */ #define BLACK xv.egacolor[0] #define BLUE xv.egacolor[1] #define GREEN xv.egacolor[2] #define CYAN xv.egacolor[3] #define RED xv.egacolor[4] #define MAGENTA xv.egacolor[5] #define BROWN xv.egacolor[20] #define LIGHTGRAY xv.egacolor[7] #define GRAY xv.egacolor[56] #define LIGHTBLUE xv.egacolor[57] #define LIGHTGREEN xv.egacolor[58] #define LIGHTCYAN xv.egacolor[59] #define LIGHTRED xv.egacolor[60] #define LIGHTMAGENTA xv.egacolor[61] #define YELLOW xv.egacolor[62] #define WHITE xv.egacolor[63] #define GETPIXEL(red, green, blue) \ (xv.p_red[red] | xv.p_green[green] | xv.p_blue[blue]) void mkrgbtable(unsigned long p_red[], unsigned long p_green[], unsigned long p_blue[], int maxval); unsigned long getnamedcolor(char *name, XColor *color); void initcolors(void); /* misc.c */ void settitle(char *s); #endif .