summaryrefslogtreecommitdiffstats
path: root/src/Canvas.cpp
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/Canvas.cpp
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/Canvas.cpp')
-rw-r--r--src/Canvas.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 6b9c25c..1c8410b 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -247,6 +247,7 @@ struct GanvCanvasImpl {
this->left_grabbed_item = FALSE;
this->in_repick = FALSE;
this->locked = FALSE;
+ this->exporting = FALSE;
#ifdef GANV_FDGL
this->layout_idle_id = 0;
@@ -453,6 +454,9 @@ struct GanvCanvasImpl {
/* Disable changes to canvas */
gboolean locked;
+ /* True if the current draw is an export */
+ gboolean exporting;
+
#ifdef GANV_FDGL
guint layout_idle_id;
gdouble layout_energy;
@@ -2606,9 +2610,11 @@ ganv_canvas_export_image(GanvCanvas* canvas,
// Draw to recording surface
cairo_t* cr = cairo_create(rec_surface);
+ canvas->impl->exporting = TRUE;
(*GANV_ITEM_GET_CLASS(canvas->impl->root)->draw)(
canvas->impl->root, cr,
0, 0, canvas->impl->width, canvas->impl->height);
+ canvas->impl->exporting = FALSE;
cairo_destroy(cr);
// Get draw extent
@@ -2634,7 +2640,9 @@ ganv_canvas_export_image(GanvCanvas* canvas,
// Draw recording to image surface
cr = cairo_create(img);
if (draw_background) {
- cairo_set_source_rgba(cr, 0, 0, 0, 1.0);
+ double r, g, b, a;
+ color_to_rgba(DEFAULT_BACKGROUND_COLOR, &r, &g, &b, &a);
+ cairo_set_source_rgba(cr, r, g, b, a);
cairo_rectangle(cr, 0, 0, w + 2 * pad, h + 2 * pad);
cairo_fill(cr);
}
@@ -3664,7 +3672,9 @@ ganv_canvas_paint_rect(GanvCanvas* canvas, gint x0, gint y0, gint x1, gint y1)
ganv_canvas_c2w(canvas, draw_width, draw_height, &ww, &wh);
// Draw background
- cairo_set_source_rgba(cr, 0, 0, 0, 1.0);
+ double r, g, b, a;
+ color_to_rgba(DEFAULT_BACKGROUND_COLOR, &r, &g, &b, &a);
+ cairo_set_source_rgba(cr, r, g, b, a);
cairo_rectangle(cr, wx1, wy1, ww, wh);
cairo_fill(cr);
@@ -4138,4 +4148,10 @@ ganv_canvas_get_port_order(GanvCanvas* canvas)
return canvas->impl->_port_order;
}
+gboolean
+ganv_canvas_exporting(GanvCanvas* canvas)
+{
+ return canvas->impl->exporting;
+}
+
} // extern "C"