+class CimgWaveArea : public CimgPlayheadArea
+{
+public:
+ CimgWaveArea (
+ Cairo::RefPtr<Cairo::ImageSurface> sf,
+ Cairo::RefPtr<Cairo::ImageSurface> sf_log,
+ Cairo::RefPtr<Cairo::ImageSurface> sf_rect,
+ Cairo::RefPtr<Cairo::ImageSurface> sf_logrec,
+ float x0, float w)
+ : CimgPlayheadArea (sf, x0, w)
+ , _sf_log (sf_log)
+ , _sf_rect (sf_rect)
+ , _sf_logrec (sf_logrec)
+ , _logscale (false)
+ , _rectified (false)
+ {
+ }
+
+ void set_logscale (bool en) {
+ _logscale = en;
+ set_dirty ();
+ }
+
+ void set_rectified (bool en) {
+ _rectified = en;
+ set_dirty ();
+ }
+
+protected:
+
+ virtual void background (cairo_t* cr, cairo_rectangle_t* r) {
+ if (_logscale && _rectified) {
+ cairo_set_source_surface (cr, _sf_logrec->cobj(), 0, 0);
+ } else if (_logscale) {
+ cairo_set_source_surface (cr, _sf_log->cobj(), 0, 0);
+ } else if (_rectified) {
+ cairo_set_source_surface (cr, _sf_rect->cobj(), 0, 0);
+ } else {
+ cairo_set_source_surface (cr, _surface->cobj(), 0, 0);
+ }
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+ cairo_paint (cr);
+ }
+
+private:
+ Cairo::RefPtr<Cairo::ImageSurface> _sf_log;
+ Cairo::RefPtr<Cairo::ImageSurface> _sf_rect;
+ Cairo::RefPtr<Cairo::ImageSurface> _sf_logrec;
+ bool _logscale;
+ bool _rectified;
+};
+