1 2 extern void *bbmalloc(int); 3 extern void bbfree(void *, int); 4 extern int bbonstack(void); 5 extern void bbexec(void(*)(void), int, int); 6 7 /* 8 * Graphics types 9 */ 10 11 typedef struct GBitmap GBitmap; 12 typedef struct GFont GFont; 13 typedef struct GSubfont GSubfont; 14 typedef struct GCacheinfo GCacheinfo; 15 16 struct GBitmap 17 { 18 ulong *base; /* pointer to start of data */ 19 long zero; /* base+zero=&word containing (0,0) */ 20 ulong width; /* width in 32 bit words of total data area */ 21 int ldepth; /* log base 2 of number of bits per pixel */ 22 Rectangle r; /* rectangle in data area, local coords */ 23 Rectangle clipr; /* clipping region */ 24 GBitmap *cache; /* zero; distinguishes bitmap from layer */ 25 }; 26 27 28 /* 29 * GFont etc. are not used in the library, only in devbit.c. 30 * GSubfont is only barely used. 31 */ 32 struct GSubfont 33 { 34 short n; /* number of chars in font */ 35 char height; /* height of bitmap */ 36 char ascent; /* top of bitmap to baseline */ 37 Fontchar *info; /* n+1 character descriptors */ 38 GBitmap *bits; /* where the characters are */ 39 }; 40 struct GCacheinfo 41 { 42 ulong xright; /* right edge of bits */ 43 Fontchar; 44 }; 45 46 struct GFont 47 { 48 uchar height; /* max height of bitmap, interline spacing */ 49 char ascent; /* top of bitmap to baseline */ 50 char width; /* widest so far; used in caching only */ 51 char ldepth; /* of images */ 52 short id; /* of font */ 53 int ncache; /* number of entries in cache */ 54 GCacheinfo *cache; /* cached characters */ 55 GBitmap *b; /* cached images */ 56 }; 57 58 extern ulong *gaddr(GBitmap*, Point); 59 extern uchar *gbaddr(GBitmap*, Point); 60 extern void gbitblt(GBitmap*, Point, GBitmap*, Rectangle, Fcode); 61 extern void gbitbltclip(void*); 62 extern void gtexture(GBitmap*, Rectangle, GBitmap*, Fcode); 63 extern Point gsubfstrsize(GSubfont*, char*); 64 extern int gsubfstrwidth(GSubfont*, char*); 65 extern Point gsubfstring(GBitmap*, Point, GSubfont*, char*, Fcode); 66 extern Point gbitbltstring(GBitmap*, Point, GSubfont*, char*, Fcode); 67 extern void gsegment(GBitmap*, Point, Point, int, Fcode); 68 extern void gpoint(GBitmap*, Point, int, Fcode); 69 extern void gflushcpucache(void); 70 extern GBitmap* gballoc(Rectangle, int); 71 extern void gbfree(GBitmap*); 72