#pragma src "/sys/src/alef/lib/libg" #pragma lib "/$M/lib/alef/libg.a" /* * Types */ aggr Point { int x; int y; }; aggr Rectangle { Point min; Point max; }; aggr Bitmap { Rectangle r; /* rectangle in data area, local coords */ Rectangle clipr; /* clipping region */ int ldepth; int id; Bitmap *cache; /* zero; distinguishes bitmap from layer */ }; aggr Mouse { int buttons; Point xy; uint msec; }; aggr Cursor { Point offset; byte clr[2*16]; byte set[2*16]; }; aggr Linedesc { int x0; int y0; byte xmajor; byte slopeneg; int dminor; int dmajor; }; adt Menu { extern byte **item; extern byte *(*gen)(int); int lasthit; (int, Mouse) hit(*Menu, int, chan(Mouse), Mouse); }; /* * 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. * */ aggr Fontchar { usint x; /* left edge of bits */ byte top; /* first non-zero scan-line */ byte bottom; /* last non-zero scan-line + 1 */ byte left; /* offset of baseline */ byte width; /* width of baseline */ }; aggr Subfont { sint n; /* number of chars in font */ byte height; /* height of bitmap */ byte 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) {(p)[0]=(v); (p)[1]=(v)>>8; (p)[2]=(v)>>16; (p)[3]=(v)>>24; }