2 * Copyright (C) 2012 Carl Hetherington <carl@carlh.net>
3 * Copyright (C) 2013-2014 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
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.
21 #include <cairomm/context.h>
23 #include "pbd/compose.h"
24 #include "pbd/convert.h"
26 #include "canvas/item.h"
27 #include "canvas/outline.h"
28 #include "canvas/debug.h"
30 using namespace ArdourCanvas;
32 Outline::Outline (Item& self)
34 , _outline_color (0x000000ff)
35 , _outline_width (1.0)
41 Outline::set_outline_color (Gtkmm2ext::Color color)
43 if (color != _outline_color) {
44 _self.begin_visual_change ();
45 _outline_color = color;
46 _self.end_visual_change ();
51 Outline::set_outline_width (Distance width)
53 if (width != _outline_width) {
54 _self.begin_change ();
55 _outline_width = width;
56 _self._bounding_box_dirty = true;
62 Outline::set_outline (bool outline)
64 if (outline != _outline) {
65 _self.begin_change ();
67 _self._bounding_box_dirty = true;
73 Outline::setup_outline_context (Cairo::RefPtr<Cairo::Context> context) const
75 Gtkmm2ext::set_source_rgba (context, _outline_color);
76 context->set_line_width (_outline_width);