diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-11 22:54:12 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-11 22:54:12 -0400 |
commit | 7caf517b27aa93df14519840224104fb8a1f12c1 (patch) | |
tree | 8310fd036083803c1da3472400be8522f4cfa512 /libs/canvas/poly_item.cc | |
parent | ee1f0520a820fb829ef3c1dbfcbb57e37242c2c8 (diff) |
add (bezier) curves to canvas, use for automation lines; fix issue with rectangles missing their upper line segment; more cairo canvas fixes
Diffstat (limited to 'libs/canvas/poly_item.cc')
-rw-r--r-- | libs/canvas/poly_item.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libs/canvas/poly_item.cc b/libs/canvas/poly_item.cc index d6e67ede0c..45faaf2d54 100644 --- a/libs/canvas/poly_item.cc +++ b/libs/canvas/poly_item.cc @@ -61,6 +61,38 @@ PolyItem::render_path (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> cont } void +PolyItem::render_curve (Rect const & area, Cairo::RefPtr<Cairo::Context> context, Points const & first_control_points, Points const & second_control_points) const +{ + bool done_first = false; + + if (_points.size() <= 2) { + render_path (area, context); + return; + } + + Points::const_iterator cp1 = first_control_points.begin(); + Points::const_iterator cp2 = second_control_points.begin(); + + for (Points::const_iterator i = _points.begin(); i != _points.end(); ++i) { + + if (done_first) { + + context->curve_to (cp1->x, cp1->y, + cp2->x, cp2->y, + i->x, i->y); + + cp1++; + cp2++; + + } else { + + context->move_to (i->x, i->y); + done_first = true; + } + } +} + +void PolyItem::set (Points const & points) { begin_change (); |