aboutsummaryrefslogtreecommitdiff
path: root/src/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw.c')
-rw-r--r--src/draw.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/draw.c b/src/draw.c
index b9b140c..26b0cb0 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -51,9 +51,26 @@ static void paint_button(cairo_t *cr, const Layout *layout)
{
double degree = M_PI / 180.0;
int radius = (layout->height - 2 * layout->y_pad) / 2;
+ int line_radius = radius - layout->line_w / 2;
+
+ //// Layout size
+ //cairo_set_source_rgb(cr, 0, 0, 0);
+ //cairo_move_to(cr, layout->x, layout->y);
+ //cairo_line_to(cr, layout->x, layout->y + layout->height);
+ //cairo_stroke(cr);
+
+ //cairo_move_to(cr, layout->x + layout->width, layout->y);
+ //cairo_line_to(cr, layout->x + layout->width, layout->y + layout->height);
+ //cairo_stroke(cr);
+
+ //// Layout padding
+ //cairo_set_source_rgb(cr, 0.5, 0.1, 0.1);
+ //cairo_rectangle(cr, layout->x + layout->x_pad, layout->y + layout->y_pad, layout->width - 2 * layout->x_pad, layout->height - 2 * layout->y_pad);
+ //cairo_stroke(cr);
cairo_set_line_width(cr, layout->line_w);
+ // Button background
Color color = layout->btn->color;
cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
cairo_new_sub_path(cr);
@@ -62,11 +79,12 @@ static void paint_button(cairo_t *cr, const Layout *layout)
cairo_close_path(cr);
cairo_fill(cr);
+ // Button border
color = layout->btn->line_color;
cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
cairo_new_sub_path(cr);
- cairo_arc(cr, layout->x + layout->x_pad + radius, layout->y + layout->y_pad + radius, radius - layout->line_w, 90 * degree, 270 * degree);
- cairo_arc(cr, layout->x + layout->width - layout->x_pad - radius, layout->y + layout->y_pad + radius, radius - layout->line_w, 270 * degree, 450 * degree);
+ cairo_arc(cr, layout->x + layout->x_pad + radius, layout->y + layout->y_pad + radius, line_radius, 90 * degree, 270 * degree);
+ cairo_arc(cr, layout->x + layout->width - layout->x_pad - radius, layout->y + layout->y_pad + radius, line_radius, 270 * degree, 450 * degree);
cairo_close_path(cr);
cairo_stroke(cr);
}