mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4517 Implement highlighting function for plot curves
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -141,6 +142,18 @@ cvf::Color3f RiaColorTools::fromQColorTo3f(QColor color)
|
||||
return cvf::Color3f(color.redF(), color.greenF(), color.blueF());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor RiaColorTools::blendQColors(const QColor& color1, const QColor& color2, int weight1 /*= 1*/, int weight2 /*= 1*/)
|
||||
{
|
||||
CVF_ASSERT(weight1 > 0 && weight2 > 0);
|
||||
int weightsum = weight1 + weight2;
|
||||
return QColor((color1.red() * weight1 + color2.red() * weight2) / weightsum,
|
||||
(color1.green() * weight1 + color2.green() * weight2) / weightsum,
|
||||
(color1.blue() * weight1 + color2.blue() * weight2) / weightsum);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
static QColor toQColor(cvf::Color4f color);
|
||||
static cvf::Color3f fromQColorTo3f(QColor);
|
||||
|
||||
static QColor blendQColors(const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1);
|
||||
|
||||
private:
|
||||
static float relativeLuminance(cvf::Color3f backgroundColor);
|
||||
static float calculateNonLinearColorValue(float colorFraction);
|
||||
|
||||
Reference in New Issue
Block a user