Ardour  8.7-15-gadf511264b
poly_item.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2013-2014 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2015-2016 Robin Gareus <robin@gareus.org>
5  *
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.
10  *
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.
15  *
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.
19  */
20 
21 #ifndef __CANVAS_POLY_ITEM_H__
22 #define __CANVAS_POLY_ITEM_H__
23 
24 #include "canvas/item.h"
25 #include "canvas/outline.h"
26 #include "canvas/visibility.h"
27 
28 namespace ArdourCanvas {
29 
30 class LIBCANVAS_API PolyItem : public Item
31 {
32 public:
35 
36  virtual void compute_bounding_box () const;
37 
38  virtual void set (Points const&);
39  virtual void add_point (Duple const &);
40  virtual void clear ();
41  void pop_back();
42  Points const& get () const;
43 
44  void dump (std::ostream&) const;
45 
46 protected:
47  void render_path (Rect const&, Cairo::RefPtr<Cairo::Context>) const;
48 
50 
51  /* these return screen-cordidates of the most recent render_path() */
52  Duple const& left_edge () const { return _left; }
53  Duple const& right_edge () const { return _right; }
54 
55 private:
56  static bool interpolate_line (Duple&, Duple const&, Coord const);
57 
58  mutable Duple _left;
59  mutable Duple _right;
60 };
61 
62 }
63 
64 #endif
#define LIBCANVAS_API
void dump(std::ostream &) const
virtual void compute_bounding_box() const
Duple const & left_edge() const
Definition: poly_item.h:52
virtual void add_point(Duple const &)
virtual void set(Points const &)
virtual void clear()
Points const & get() const
void render_path(Rect const &, Cairo::RefPtr< Cairo::Context >) const
static bool interpolate_line(Duple &, Duple const &, Coord const)
Duple const & right_edge() const
Definition: poly_item.h:53
std::vector< Duple > Points