summaryrefslogtreecommitdiffstats
path: root/src/box.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-02-24 08:31:52 +0000
committerDavid Robillard <d@drobilla.net>2015-02-24 08:31:52 +0000
commit1b169cbe8955e5df9cd1c6d27d14fc2d8fb2c113 (patch)
tree73ad9701f40897bbe3f61f51bf587c6f94cbf648 /src/box.c
parent0f60c61b0d7424005385c5687377b48ceb0c0c9b (diff)
downloadganv-1b169cbe8955e5df9cd1c6d27d14fc2d8fb2c113.tar.gz
ganv-1b169cbe8955e5df9cd1c6d27d14fc2d8fb2c113.tar.bz2
ganv-1b169cbe8955e5df9cd1c6d27d14fc2d8fb2c113.zip
Add light theme for typesettable canvas export.
Don't show edge handles on export. Fix port control drawing to be pixel perfect. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5605 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/box.c')
-rw-r--r--src/box.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/box.c b/src/box.c
index a1a9315..c5206e1 100644
--- a/src/box.c
+++ b/src/box.c
@@ -201,7 +201,8 @@ ganv_box_update(GanvItem* item, int flags)
void
ganv_box_path(GanvBox* box,
- cairo_t* cr, double x1, double y1, double x2, double y2)
+ cairo_t* cr, double x1, double y1, double x2, double y2,
+ double dr)
{
static const double degrees = G_PI / 180.0;
@@ -215,18 +216,18 @@ ganv_box_path(GanvBox* box,
// Rounded rectangle
cairo_new_sub_path(cr);
cairo_arc(cr,
- x2 - impl->radius_tr,
- y1 + impl->radius_tr,
- impl->radius_tr, -90 * degrees, 0 * degrees);
+ x2 - impl->radius_tr - dr,
+ y1 + impl->radius_tr + dr,
+ impl->radius_tr + dr, -90 * degrees, 0 * degrees);
cairo_arc(cr,
- x2 - impl->radius_br, y2 - impl->radius_br,
- impl->radius_br, 0 * degrees, 90 * degrees);
+ x2 - impl->radius_br - dr, y2 - impl->radius_br - dr,
+ impl->radius_br + dr, 0 * degrees, 90 * degrees);
cairo_arc(cr,
- x1 + impl->radius_bl, y2 - impl->radius_bl,
- impl->radius_bl, 90 * degrees, 180 * degrees);
+ x1 + impl->radius_bl + dr, y2 - impl->radius_bl - dr,
+ impl->radius_bl + dr, 90 * degrees, 180 * degrees);
cairo_arc(cr,
- x1 + impl->radius_tl, y1 + impl->radius_tl,
- impl->radius_tl, 180 * degrees, 270 * degrees);
+ x1 + impl->radius_tl + dr, y1 + impl->radius_tl + dr,
+ impl->radius_tl + dr, 180 * degrees, 270 * degrees);
cairo_close_path(cr);
}
}
@@ -255,15 +256,15 @@ ganv_box_draw(GanvItem* item,
const double y = 0.0 - (STACKED_OFFSET * i);
// Trace basic box path
- ganv_box_path(box, cr, x1 - x, y1 - y, x2 - x, y2 - y);
+ ganv_box_path(box, cr, x1 - x, y1 - y, x2 - x, y2 - y, 0.0);
// Fill
color_to_rgba(fill_color, &r, &g, &b, &a);
cairo_set_source_rgba(cr, r, g, b, a);
- cairo_fill_preserve(cr);
// Border
if (impl->coords.border_width > 0.0) {
+ cairo_fill_preserve(cr);
color_to_rgba(border_color, &r, &g, &b, &a);
cairo_set_source_rgba(cr, r, g, b, a);
cairo_set_line_width(cr, impl->coords.border_width);
@@ -272,8 +273,10 @@ ganv_box_draw(GanvItem* item,
} else {
cairo_set_dash(cr, &dash_length, 0, 0);
}
+ cairo_stroke(cr);
+ } else {
+ cairo_fill(cr);
}
- cairo_stroke(cr);
}
GanvItemClass* item_class = GANV_ITEM_CLASS(parent_class);