mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 05:06:31 +01:00
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.
This commit is contained in:
parent
a1df752095
commit
21582828b7
2 changed files with 16 additions and 5 deletions
|
|
@ -33,10 +33,12 @@ public:
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void set_velocity (double fract);
|
void set_velocity (double fract);
|
||||||
|
void set_fill_color (Gtkmm2ext::Color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool _show_velocity_bars;
|
static bool _show_velocity_bars;
|
||||||
double _velocity;
|
double _velocity;
|
||||||
|
Gtkmm2ext::Color _velocity_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,15 @@ bool Note::_show_velocity_bars = true;
|
||||||
|
|
||||||
Note::Note (Canvas* c)
|
Note::Note (Canvas* c)
|
||||||
: Rectangle (c)
|
: Rectangle (c)
|
||||||
, _velocity (0.5)
|
, _velocity (0.0)
|
||||||
|
, _velocity_color (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Note::Note (Item* parent)
|
Note::Note (Item* parent)
|
||||||
: Rectangle (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;
|
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->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
|
||||||
context->fill ();
|
context->fill ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Note::set_fill_color (Gtkmm2ext::Color c)
|
||||||
|
{
|
||||||
|
Fill::set_fill_color (c);
|
||||||
|
_velocity_color = Gtkmm2ext::HSV (c).opposite().color ();
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue