예제 #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::updateFromBackgroundColor(const cvf::Color3f& backgroundColor)
{
    double adjustmentFactor = 0.3;
    
    float gridR = 0.0;
    float gridG = 0.0;
    float gridB = 0.0;

    if (backgroundColor.r() + backgroundColor.g() + backgroundColor.b() > 1.5f)
    {
        gridR = backgroundColor.r() - (backgroundColor.r() * adjustmentFactor);
        gridG = backgroundColor.g() - (backgroundColor.g() * adjustmentFactor);
        gridB = backgroundColor.b() - (backgroundColor.b() * adjustmentFactor);

        m_gridLegendColor = cvf::Color3f::fromByteColor(10, 10, 10);
    }
    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 = cvf::Color3f::WHITE;
    }

    m_gridColor.set(gridR, gridG, gridB);
}
예제 #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimSummaryCurveAppearanceCalculator::gradeColor(const cvf::Color3f& color, float factor)
{
    CVF_ASSERT(-1.0 <= factor && factor <= 1.0);

    cvf::Vec3f orgC(color.r(), color.g(), color.b());
    cvf::Vec3f targetC;
    if(factor < 0)
    {
        targetC = cvf::Vec3f(0, 0, 0);
    }
    else
    {
        targetC = cvf::Vec3f(1, 1, 1);
    }

    cvf::Vec3f newColor = ((float)fabs(factor)) * (targetC - orgC) + orgC;

    return cvf::Color3f(newColor[0], newColor[1], newColor[2]);
}
예제 #3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void XmlElementImpl::setAttributeColor(const String& attributeName, const cvf::Color3f& color)
{
    String valString =  String::number(color.r()) + " " + String::number(color.g()) + " " + String::number(color.b());

    setAttributeString(attributeName, valString);
}