Xinqi Bao's Git
04e7f0d4f6f7d19a1b6aeadfd5dfdb3e14f6c69f
1 /* See LICENSE file for copyright and license details. */
8 draw_create(Display
*dpy
, Window win
, unsigned int w
, unsigned int h
) {
9 Draw
*draw
= (Draw
*)calloc(1, sizeof(Draw
));
12 /* TODO: drawable creation */
13 /* TODO: gc allocation */
18 draw_resize(Draw
*draw
, unsigned int w
, unsigned int h
) {
23 /* TODO: resize drawable */
27 draw_free(Draw
*draw
) {
28 /* TODO: deallocate DDCs */
29 /* TODO: deallocate drawable */
34 dc_create(Draw
*draw
) {
35 DDC
*dc
= (DDC
*)calloc(1, sizeof(DDC
));
48 /* remove from dc list */
49 for(tdc
= &dc
->draw
->dc
; *tdc
&& *tdc
!= dc
; tdc
= &(*tdc
)->next
);
51 /* TODO: deallocate any resources of this dc, if needed */
56 font_create(const char *fontname
) {
57 Fnt
*font
= (Fnt
*)calloc(1, sizeof(Fnt
));
58 /* TODO: allocate actual font */
63 font_free(Fnt
*font
) {
66 /* TODO: deallocate any font resources */
71 col_create(const char *colname
) {
72 Col
*col
= (Col
*)calloc(1, sizeof(Col
));
73 /* TODO: allocate color */
81 /* TODO: deallocate any color resource */
86 dc_setfont(DDC
*dc
, Fnt
*font
) {
93 dc_setfg(DDC
*dc
, Col
*col
) {
100 dc_setbg(DDC
*dc
, Col
*col
) {
107 dc_setfill(DDC
*dc
, Bool fill
) {
114 dc_drawrect(DDC
*dc
, int x
, int y
, unsigned int w
, unsigned int h
) {
117 /* TODO: draw the rectangle */
121 dc_drawtext(DDC
*dc
, int x
, int y
, const char *text
) {
124 /* TODO: draw the text */
128 dc_map(DDC
*dc
, int x
, int y
, unsigned int w
, unsigned int h
) {
131 /* TODO: map the dc contents in the region */
135 dc_getextents(DDC
*dc
, const char *text
, TextExtents
*extents
) {
138 /* TODO: get extents */