Xinqi Bao's Git

Added tag 4.3.1 for changeset 34a2d77049a9
[dmenu.git] / draw.h
1 /* See LICENSE file for copyright and license details. */
2
3 #define FG(dc, col) ((col)[(dc)->invert ? ColBG : ColFG])
4 #define BG(dc, col) ((col)[(dc)->invert ? ColFG : ColBG])
5
6 enum { ColBG, ColFG, ColBorder, ColLast };
7
8 typedef struct {
9 int x, y, w, h;
10 Bool invert;
11 Display *dpy;
12 GC gc;
13 Pixmap canvas;
14 struct {
15 int ascent;
16 int descent;
17 int height;
18 XFontSet set;
19 XFontStruct *xfont;
20 } font;
21 } DC; /* draw context */
22
23 void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color);
24 void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
25 void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]);
26 void eprintf(const char *fmt, ...);
27 void freedc(DC *dc);
28 unsigned long getcolor(DC *dc, const char *colstr);
29 DC *initdc(void);
30 void initfont(DC *dc, const char *fontstr);
31 void mapdc(DC *dc, Window win, unsigned int w, unsigned int h);
32 void resizedc(DC *dc, unsigned int w, unsigned int h);
33 int textnw(DC *dc, const char *text, size_t len);
34 int textw(DC *dc, const char *text);