add ArdourCanvas::change_alpha()

Time to move away from rgba macros
This commit is contained in:
Paul Davis 2014-12-19 09:53:26 -05:00
parent 55d91f71e0
commit a494211e73
2 changed files with 8 additions and 0 deletions

View file

@ -31,6 +31,8 @@ namespace ArdourCanvas
struct LIBCANVAS_API HSV;
struct LIBCANVAS_API HSVA;
extern LIBCANVAS_API Color change_alpha (Color, double alpha);
extern LIBCANVAS_API Color hsva_to_color (double h, double s, double v, double a = 1.0);
extern LIBCANVAS_API void color_to_hsva (Color color, double& h, double& s, double& v, double& a);
extern LIBCANVAS_API void color_to_hsv (Color color, double& h, double& s, double& v);

View file

@ -35,6 +35,12 @@ using namespace ArdourCanvas;
using std::max;
using std::min;
ArdourCanvas::Color
change_alpha (Color c, double a)
{
return ((c & ~0xff) | (lrintf (a*255.0) & 0xff));
}
void
ArdourCanvas::color_to_hsv (Color color, double& h, double& s, double& v)
{