mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Set background and frame color from the view plus update frame margins.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
#include "cvfMath.h"
|
||||
#include <algorithm>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -31,6 +33,33 @@ bool RiaColorTools::isBrightnessAboveThreshold(cvf::Color3f backgroundColor)
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiaColorTools::computeOffsetColor(cvf::Color3f color, float offsetFactor)
|
||||
{
|
||||
float gridR = 0.0;
|
||||
float gridG = 0.0;
|
||||
float gridB = 0.0;
|
||||
|
||||
if (isBrightnessAboveThreshold(color))
|
||||
{
|
||||
gridR = color.r() - (color.r() * offsetFactor);
|
||||
gridG = color.g() - (color.g() * offsetFactor);
|
||||
gridB = color.b() - (color.b() * offsetFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
gridR = color.r() + (1.0f - color.r()) * offsetFactor;
|
||||
gridG = color.g() + (1.0f - color.g()) * offsetFactor;
|
||||
gridB = color.b() + (1.0f - color.b()) * offsetFactor;
|
||||
}
|
||||
|
||||
return cvf::Color3f(cvf::Math::clamp(gridR, 0.0f, 1.0f),
|
||||
cvf::Math::clamp(gridG, 0.0f, 1.0f),
|
||||
cvf::Math::clamp(gridB, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user