Ardour  9.0-pre0-582-g084a23a80d
xfade_curve.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __CANVAS_XFADECURVE_H__
21 #define __CANVAS_XFADECURVE_H__
22 
23 #include "canvas/visibility.h"
24 #include "canvas/item.h"
25 #include "canvas/curve.h"
26 
27 namespace ArdourCanvas {
28 
30 {
31 public:
34  End,
35  };
36 
41 
42  void set_fade_position (XFadePosition xfp) { _xfadeposition = xfp; }
43  void set_show_background_fade (bool show) { show_background_fade = show; }
44 
45  void compute_bounding_box () const;
46  void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
47 
48  void set_points_per_segment (uint32_t n);
49  void set_inout (Points const & in, Points const & out);
50 
52  begin_visual_change ();
53  _outline_color = c;
54  end_visual_change ();
55  };
56 
58  begin_visual_change ();
59  _fill_color = c;
60  end_visual_change ();
61  }
62 
63 private:
64  struct CanvasCurve {
65  CanvasCurve() : n_samples(0) { }
68  Points::size_type n_samples;
69  };
70 
71  Cairo::Path * get_path(Rect const &, Cairo::RefPtr<Cairo::Context>, CanvasCurve const &) const;
72  void close_path(Rect const &, Cairo::RefPtr<Cairo::Context>, CanvasCurve const &p, bool) const;
73 
75 
78 
82 
84 
85  void interpolate ();
86 };
87 
88 }
89 
90 #endif
#define LIBCANVAS_API
Gtkmm2ext::Color _fill_color
Definition: xfade_curve.h:81
void set_inout(Points const &in, Points const &out)
XFadePosition _xfadeposition
Definition: xfade_curve.h:79
void render(Rect const &area, Cairo::RefPtr< Cairo::Context >) const
void set_fade_position(XFadePosition xfp)
Definition: xfade_curve.h:42
XFadeCurve(Item *, XFadePosition)
void close_path(Rect const &, Cairo::RefPtr< Cairo::Context >, CanvasCurve const &p, bool) const
Cairo::Path * get_path(Rect const &, Cairo::RefPtr< Cairo::Context >, CanvasCurve const &) const
void set_outline_color(Gtkmm2ext::Color c)
Definition: xfade_curve.h:51
Gtkmm2ext::Color _outline_color
Definition: xfade_curve.h:80
void set_fill_color(Gtkmm2ext::Color c)
Definition: xfade_curve.h:57
void compute_bounding_box() const
XFadeCurve(Canvas *, XFadePosition)
void set_points_per_segment(uint32_t n)
void set_show_background_fade(bool show)
Definition: xfade_curve.h:43
std::vector< Duple > Points
uint32_t Color
Definition: colors.h:33