#pragma lib "libg.a" /* * you may think it's a blit, but it's gnot */ enum { EMAXMSG = 128+8192, /* size of 9p header+data */ }; /* * Types */ typedef struct Bitmap Bitmap; typedef struct Point Point; typedef struct Rectangle Rectangle; typedef struct Cursor Cursor; typedef struct Mouse Mouse; typedef struct Menu Menu; typedef struct Font Font; typedef struct Fontchar Fontchar; typedef struct Subfont Subfont; typedef struct Cachefont Cachefont; typedef struct Cacheinfo Cacheinfo; typedef struct Cachesubf Cachesubf; typedef struct Event Event; typedef struct RGB RGB; typedef struct Linedesc Linedesc; struct Point { int x; int y; }; struct Rectangle { Point min; Point max; }; struct Bitmap { Rectangle r; /* rectangle in data area, local coords */ Rectangle clipr; /* clipping region */ int ldepth; int id; Bitmap *cache; /* zero; distinguishes bitmap from layer */ }; struct Mouse { int buttons; /* bit array: LMR=124 */ Point xy; ulong msec; }; struct Cursor { Point offset; uchar clr[2*16]; uchar set[2*16]; }; struct Menu { char **item; char *(*gen)(int); int lasthit; }; struct Linedesc { int x0; int y0; char xmajor; char slopeneg; long dminor; long dmajor; }; /* * Subfonts * * given char c, Subfont *f, Fontchar *i, and Point p, one says * i = f->info+c; * bitblt(b, Pt(p.x+i->left,p.y+i->top), * bitmap, Rect(i->x,i->top,(i+1)->x,i->bottom), * fc); * p.x += i->width; * where bitmap b is the repository of the images. * */ struct Fontchar { ushort x; /* left edge of bits */ uchar top; /* first non-zero scan-line */ uchar bottom; /* last non-zero scan-line + 1 */ char left; /* offset of baseline */ uchar width; /* width of baseline */ }; struct Subfont { short n; /* number of chars in font */ uchar height; /* height of bitmap */ char ascent; /* top of bitmap to baseline */ Fontchar *info; /* n+1 character descriptors */ int id; /* of font */ }; enum { /* starting values */ LOG2NFCACHE = 6, NFCACHE = (1<>8)) #define BPLONG(p, v) (BPSHORT(p, (v)), BPSHORT(p+2, (v)>>16))