diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-04 00:32:52 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-04 00:32:52 -0400 |
commit | aaea166135ace01709f7e0be64f40be80f4107ec (patch) | |
tree | 0e794ef7a723e4aaf909b841a6816e405b4ceca1 /libs/canvas/polygon.cc | |
parent | 1d8bac08c0c00d44e22c581768a275e1b21a99a7 (diff) |
initial commit of hand merging, plus getting "ancient" waf script to work correctly
Diffstat (limited to 'libs/canvas/polygon.cc')
-rw-r--r-- | libs/canvas/polygon.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libs/canvas/polygon.cc b/libs/canvas/polygon.cc new file mode 100644 index 0000000000..b89a7ca880 --- /dev/null +++ b/libs/canvas/polygon.cc @@ -0,0 +1,56 @@ +#include "pbd/xml++.h" +#include "canvas/polygon.h" + +using namespace ArdourCanvas; + +Polygon::Polygon (Group* parent) + : Item (parent) + , PolyItem (parent) + , Fill (parent) +{ + +} + +void +Polygon::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const +{ + if (_outline) { + setup_outline_context (context); + render_path (area, context); + + if (!_points.empty ()) { + context->move_to (_points.front().x, _points.front().y); + } + + context->stroke_preserve (); + } + + if (_fill) { + setup_fill_context (context); + context->fill (); + } +} + +XMLNode * +Polygon::get_state () const +{ + XMLNode* node = new XMLNode ("Polygon"); +#ifdef CANVAS_DEBUG + if (!name.empty ()) { + node->add_property ("name", name); + } +#endif + add_poly_item_state (node); + add_outline_state (node); + add_fill_state (node); + return node; +} + + +void +Polygon::set_state (XMLNode const * node) +{ + set_poly_item_state (node); + set_outline_state (node); + set_fill_state (node); +} |