2 * draw.h - draw functions header
4 * Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef AWESOME_COMMON_DRAW_H
23 #define AWESOME_COMMON_DRAW_H
30 #include <pango/pangocairo.h>
32 #include "common/util.h"
33 #include "common/list.h"
44 typedef struct area_t area_t
;
47 /** Co-ords of upper left corner */
55 DO_SLIST(area_t
, area
, p_delete
)
57 #define AREA_LEFT(a) ((a).x)
58 #define AREA_TOP(a) ((a).y)
59 #define AREA_RIGHT(a) ((a).x + (a).width)
60 #define AREA_BOTTOM(a) ((a).y + (a).height)
63 area_intersect_area(area_t a
, area_t b
)
65 return (b
.x
< a
.x
+ a
.width
66 && b
.x
+ b
.width
> a
.x
67 && b
.y
< a
.y
+ a
.height
68 && b
.y
+ b
.height
> a
.y
);
72 area_get_intersect_area(area_t a
, area_t b
)
78 g
.width
= MIN(a
.x
+ a
.width
, b
.x
+ b
.width
) - g
.x
;
79 g
.height
= MIN(a
.y
+ a
.height
, b
.y
+ b
.height
) - g
.y
;
86 PangoFontDescription
*desc
;
92 /** Foreground color */
94 /** Background color */
116 cairo_surface_t
*surface
;
120 DrawCtx
*draw_context_new(Display
*, int, int, int, Drawable
);
121 void draw_context_delete(DrawCtx
**);
123 font_t
*draw_font_new(Display
*disp
, char *fontname
);
124 void draw_font_delete(font_t
**);
126 void draw_text(DrawCtx
*, area_t
, Alignment
, int, char *, style_t
);
127 void draw_rectangle(DrawCtx
*, area_t
, float, Bool
, XColor
);
128 void draw_rectangle_gradient(DrawCtx
*, area_t
, float, Bool
, area_t
, XColor
*, XColor
*, XColor
*);
130 void draw_graph_setup(DrawCtx
*);
131 void draw_graph(DrawCtx
*, area_t
, int *, int *, int, Position
, area_t
, XColor
*, XColor
*, XColor
*);
132 void draw_graph_line(DrawCtx
*, area_t
, int *, int, Position
, area_t
, XColor
*, XColor
*, XColor
*);
133 void draw_circle(DrawCtx
*, int, int, int, Bool
, XColor
);
134 void draw_image(DrawCtx
*, int, int, int, const char *);
135 void draw_image_from_argb_data(DrawCtx
*, int, int, int, int, int, unsigned char *);
136 area_t
draw_get_image_size(const char *filename
);
137 void draw_rotate(DrawCtx
*, Drawable
, int, int, double, int, int);
138 unsigned short draw_textwidth(Display
*, font_t
*, const char *);
139 Alignment
draw_align_get_from_str(const char *);
140 Bool
draw_color_new(Display
*, int, const char *, XColor
*);
141 void draw_style_init(Display
*, int, cfg_t
*, style_t
*, style_t
*);
143 void area_list_remove(area_t
**, area_t
*);
146 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80