Set background and frame color from the view plus update frame margins.

This commit is contained in:
Gaute Lindkvist
2018-04-06 11:52:29 +02:00
parent 507229f84b
commit 63ffade452
14 changed files with 90 additions and 51 deletions

View File

@@ -734,30 +734,8 @@ cvf::Vec3f RivGridBoxGenerator::cornerDirection(FaceType face1, FaceType face2)
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::updateFromBackgroundColor(const cvf::Color3f& backgroundColor)
{
double adjustmentFactor = 0.3;
float gridR = 0.0;
float gridG = 0.0;
float gridB = 0.0;
if (RiaColorTools::isBrightnessAboveThreshold(backgroundColor))
{
gridR = backgroundColor.r() - (backgroundColor.r() * adjustmentFactor);
gridG = backgroundColor.g() - (backgroundColor.g() * adjustmentFactor);
gridB = backgroundColor.b() - (backgroundColor.b() * adjustmentFactor);
m_gridLegendColor = RiaColorTools::darkContrastColor();
}
else
{
gridR = backgroundColor.r() + (1.0 - backgroundColor.r()) * adjustmentFactor;
gridG = backgroundColor.g() + (1.0 - backgroundColor.g()) * adjustmentFactor;
gridB = backgroundColor.b() + (1.0 - backgroundColor.b()) * adjustmentFactor;
m_gridLegendColor = RiaColorTools::brightContrastColor();
}
m_gridColor.set(gridR, gridG, gridB);
m_gridColor = RiaColorTools::computeOffsetColor(backgroundColor, 0.3f);
m_gridLegendColor = RiaColorTools::constrastColor(backgroundColor);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -118,7 +118,7 @@ void RivTernarySaturationOverlayItem::renderGeneric(cvf::OpenGLContext* oglConte
this->backgroundColor(),
this->backgroundFrameColor());
}
border = 3.0f;
border = 8.0f;
}
cvf::TextDrawer textDrawer(this->font());
@@ -126,7 +126,7 @@ void RivTernarySaturationOverlayItem::renderGeneric(cvf::OpenGLContext* oglConte
float lineHeightInPixels = (float)(this->font()->textExtent("SWAT").y() + 2);
float textPosY = static_cast<float>(size.y() - lineHeightInPixels);
float textPosY = static_cast<float>(size.y() - lineHeightInPixels - border);
for (size_t it = 0; it < this->titleStrings().size(); it++)
{
cvf::Vec2f pos(border, textPosY);