globally change all use of "frame" to refer to audio into "sample".
[ardour.git] / libs / canvas / canvas / curve.h
index 93c14386dc9794f31e165a844559156cfc7765d2..fad1119b39b6479118d7641b5f5b841fa9b2fbec 100644 (file)
 
 #include "canvas/visibility.h"
 
+#include "canvas/interpolated_curve.h"
 #include "canvas/poly_item.h"
+#include "canvas/fill.h"
 
 namespace ArdourCanvas {
 
-class LIBCANVAS_API Curve : public PolyItem
+class XFadeCurve;
+
+class LIBCANVAS_API Curve : public PolyItem, public InterpolatedCurve
 {
-public:
-    Curve (Group *);
-    
+  public:
+    Curve (Canvas*);
+    Curve (Item*);
+
+    enum CurveFill {
+           None,
+           Inside,
+           Outside,
+    };
+
     void compute_bounding_box () const;
     void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
     void set (Points const &);
 
+    void set_points_per_segment (uint32_t n);
+
     bool covers (Duple const &) const;
+    void set_fill_mode (CurveFill cf) { curve_fill = cf; }
 
-  protected:
-    void render_path (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
-    void render_curve (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
-    
   private:
-    Points first_control_points;
-    Points second_control_points;
+    Points samples;
+    Points::size_type n_samples;
+    uint32_t points_per_segment;
+    CurveFill curve_fill;
 
-    
-    static void compute_control_points (Points const &,
-                                       Points&, Points&);
-    static double* solve (std::vector<double> const&);
+    void interpolate ();
 };
-       
+
 }
 
 #endif