diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-30 10:38:45 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-30 10:38:45 -0400 |
commit | 471570705d58ee88f852009fee18f51562c34292 (patch) | |
tree | 0542689fdc3e48a349888822fcd0968123068dd5 /gtk2_ardour/utils.cc | |
parent | 4c1f4011fd367c0f5bb7cbc820861914644ef3c4 (diff) |
move contrasting_text_color() into ArdourCanvas
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r-- | gtk2_ardour/utils.cc | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 4c654ee418..417e950431 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -402,38 +402,6 @@ ARDOUR_UI_UTILS::gdk_color_to_rgba (Gdk::Color const& c) return RGBA_TO_UINT (r,g,b,a); } -uint32_t -ARDOUR_UI_UTILS::contrasting_text_color (uint32_t c) -{ - double r, g, b, a; - ArdourCanvas::color_to_rgba (c, r, g, b, a); - - const double black_r = 0.0; - const double black_g = 0.0; - const double black_b = 0.0; - - const double white_r = 1.0; - const double white_g = 1.0; - const double white_b = 1.0; - - /* Use W3C contrast guideline calculation */ - - double white_contrast = (max (r, white_r) - min (r, white_r)) + - (max (g, white_g) - min (g, white_g)) + - (max (b, white_b) - min (b, white_b)); - - double black_contrast = (max (r, black_r) - min (r, black_r)) + - (max (g, black_g) - min (g, black_g)) + - (max (b, black_b) - min (b, black_b)); - - if (white_contrast > black_contrast) { - /* use white */ - return ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0); - } else { - /* use black */ - return ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0); - } -} bool ARDOUR_UI_UTILS::relay_key_press (GdkEventKey* ev, Gtk::Window* win) |