2013-04-15 22:10:18 -04:00
|
|
|
/*
|
|
|
|
|
Copyright (C) 2013 Paul Davis
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-04-11 22:54:12 -04:00
|
|
|
#ifndef __CANVAS_CURVE_H__
|
|
|
|
|
#define __CANVAS_CURVE_H__
|
|
|
|
|
|
2013-12-27 16:24:58 -05:00
|
|
|
#include "canvas/visibility.h"
|
|
|
|
|
|
2013-04-11 22:54:12 -04:00
|
|
|
#include "canvas/poly_item.h"
|
2014-02-28 17:00:19 -05:00
|
|
|
#include "canvas/fill.h"
|
2013-04-11 22:54:12 -04:00
|
|
|
|
|
|
|
|
namespace ArdourCanvas {
|
|
|
|
|
|
2014-02-28 17:00:19 -05:00
|
|
|
class LIBCANVAS_API Curve : public PolyItem, public Fill
|
2013-04-11 22:54:12 -04:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Curve (Group *);
|
|
|
|
|
|
|
|
|
|
void compute_bounding_box () const;
|
|
|
|
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
|
|
|
|
void set (Points const &);
|
|
|
|
|
|
2014-02-28 17:00:19 -05:00
|
|
|
void set_n_segments (uint32_t n);
|
|
|
|
|
void set_n_samples (Points::size_type);
|
|
|
|
|
|
2013-12-09 17:24:34 -05:00
|
|
|
bool covers (Duple const &) const;
|
|
|
|
|
|
2013-04-11 22:54:12 -04:00
|
|
|
private:
|
2014-02-28 17:00:19 -05:00
|
|
|
Points samples;
|
|
|
|
|
Points::size_type n_samples;
|
|
|
|
|
uint32_t n_segments;
|
|
|
|
|
|
|
|
|
|
void smooth (Points::size_type p1, Points::size_type p2, Points::size_type p3, Points::size_type p4,
|
|
|
|
|
double xfront, double xextent);
|
|
|
|
|
double map_value (double) const;
|
|
|
|
|
void interpolate ();
|
2013-04-11 22:54:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|