summaryrefslogtreecommitdiff
path: root/libs/canvas
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2018-07-03 11:43:42 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2018-07-03 11:43:42 -0400
commit21582828b7574592a17727a68f163d2d6ef4eb9b (patch)
tree77e59d79494d339ca6518f33e5bf5648ac6b676b /libs/canvas
parenta1df752095f9aec96711b8f9693172fd32cc60ba (diff)
add a guess at appropriate color management for note velocity display
I think that HSV::opposite() is probably too strong here. HSV::darker() might be better. Experimentation needed.
Diffstat (limited to 'libs/canvas')
-rw-r--r--libs/canvas/canvas/note.h6
-rw-r--r--libs/canvas/note.cc15
2 files changed, 16 insertions, 5 deletions
diff --git a/libs/canvas/canvas/note.h b/libs/canvas/canvas/note.h
index 2dd3ac6a7b..1b20830042 100644
--- a/libs/canvas/canvas/note.h
+++ b/libs/canvas/canvas/note.h
@@ -33,10 +33,12 @@ public:
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void set_velocity (double fract);
+ void set_fill_color (Gtkmm2ext::Color);
private:
- static bool _show_velocity_bars;
- double _velocity;
+ static bool _show_velocity_bars;
+ double _velocity;
+ Gtkmm2ext::Color _velocity_color;
};
}
diff --git a/libs/canvas/note.cc b/libs/canvas/note.cc
index 0d029b4bd0..c27a93985a 100644
--- a/libs/canvas/note.cc
+++ b/libs/canvas/note.cc
@@ -30,13 +30,15 @@ bool Note::_show_velocity_bars = true;
Note::Note (Canvas* c)
: Rectangle (c)
- , _velocity (0.5)
+ , _velocity (0.0)
+ , _velocity_color (0)
{
}
Note::Note (Item* parent)
: Rectangle (parent)
- , _velocity (0.5)
+ , _velocity (0.0)
+ , _velocity_color (0)
{
}
@@ -78,8 +80,15 @@ Note::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
return;
}
- Gtkmm2ext::set_source_rgba (context, Gtkmm2ext::contrasting_text_color (fill_color()));
+ Gtkmm2ext::set_source_rgba (context, _velocity_color);
context->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
context->fill ();
}
}
+
+void
+Note::set_fill_color (Gtkmm2ext::Color c)
+{
+ Fill::set_fill_color (c);
+ _velocity_color = Gtkmm2ext::HSV (c).opposite().color ();
+}