Exemple #1
0
void ColorState::_setInvert( bool invert ){
    bool oldInvert = m_state.getValue<bool>(INVERT );
    if ( invert != oldInvert ){
        m_state.setValue<bool>(INVERT, invert );
        emit colorStateChanged();
    }
}
Exemple #2
0
void ColorState::_setReverse( bool reverse ){
    bool oldReverse = m_state.getValue<bool>(REVERSE);
    if ( reverse != oldReverse ){
        m_state.setValue<bool>(REVERSE, reverse );
        m_state.flushState();
        emit colorStateChanged();
    }
}
Exemple #3
0
void ColorState::_setNanDefault( bool useDefault ){
    bool oldNanDefault = m_state.getValue<bool>( NAN_DEFAULT );
    if ( useDefault != oldNanDefault ){
        m_state.setValue<bool>( NAN_DEFAULT, useDefault );
        m_state.flushState();
        emit colorStateChanged();
    }
}
Exemple #4
0
QString ColorState::_setColorMix( double redValue, double greenValue, double blueValue){
    QString result;
    bool greenChanged = _setColorMix( Util::GREEN, greenValue, result );
    bool redChanged = _setColorMix( Util::RED, redValue, result );
    bool blueChanged = _setColorMix( Util::BLUE, blueValue, result );
    if ( redChanged || blueChanged || greenChanged ){
        emit colorStateChanged();
    }
    return result;
}
Exemple #5
0
QString ColorState::_setGamma( double gamma, double errorMargin, int significantDigits ){
    QString result;
    double oldGamma = m_state.getValue<double>( GAMMA );
    double roundedGamma = Util::roundToDigits(gamma, significantDigits );
    if ( qAbs( roundedGamma - oldGamma) > errorMargin ){
        m_state.setValue<double>(GAMMA, roundedGamma );
        emit colorStateChanged();
    }
    return result;
}
Exemple #6
0
void ColorState::_setBorderDefault( bool useDefault ){
    bool oldBorderDefault = m_state.getValue<bool>( BORDER_DEFAULT );
    if ( useDefault != oldBorderDefault ){
        m_state.setValue<bool>( BORDER_DEFAULT, useDefault );
        _setBorderColor( 0, 0, 0);
        _setBorderAlpha( 255 );
        m_state.flushState();
        emit colorStateChanged();
    }
}
Exemple #7
0
QString ColorState::_setBorderAlpha( int alphaValue ){
    QString result;
    const QString USER_ID = "Border background";
    bool alphaChanged = _setColor( Util::ALPHA, BORDER_COLOR, USER_ID, alphaValue, result );
    if ( alphaChanged ){
        m_state.flushState();
        emit colorStateChanged();
    }
    return result;
}
Exemple #8
0
QString ColorState::_setNanColor( int redValue, int greenValue, int blueValue){
    QString result;
    const QString USER_ID = "Nan color";
    bool greenChanged = _setColor( Util::GREEN, NAN_COLOR, USER_ID, greenValue, result );
    bool redChanged = _setColor( Util::RED, NAN_COLOR, USER_ID, redValue, result );
    bool blueChanged = _setColor( Util::BLUE, NAN_COLOR, USER_ID, blueValue, result );
    if ( redChanged || blueChanged || greenChanged ){
        emit colorStateChanged();
    }
    return result;
}
Exemple #9
0
QString ColorState::_setBorderColor( int redValue, int greenValue, int blueValue){
    QString result;
    const QString USER_ID = "Border background";
    bool greenChanged = _setColor( Util::GREEN, BORDER_COLOR, USER_ID, greenValue, result );
    bool redChanged = _setColor( Util::RED, BORDER_COLOR, USER_ID, redValue, result );
    bool blueChanged = _setColor( Util::BLUE, BORDER_COLOR, USER_ID, blueValue, result );
    if ( redChanged || blueChanged || greenChanged ){
        emit colorStateChanged();
    }
    return result;
}
Exemple #10
0
QString ColorState::_setColorMap( const QString& colorMapStr ){
    QString mapName = m_state.getValue<QString>(COLOR_MAP_NAME);
    QString result;
    if ( m_colors != nullptr ){
       if( m_colors->isMap( colorMapStr ) ){
           if ( colorMapStr != mapName ){
              m_state.setValue<QString>(COLOR_MAP_NAME, colorMapStr );
              m_state.flushState();
              emit colorStateChanged();
           }
        }
       else {
           result = "Invalid ColorState: " + colorMapStr;
       }
    }
    return result;
}
Exemple #11
0
QString ColorState::_setDataTransform( const QString& transformString ){
    QString result("");
    QString transformName = m_state.getValue<QString>(TRANSFORM_DATA);
    if ( m_dataTransforms != nullptr ){
        QString actualTransform;
        bool recognizedTransform = m_dataTransforms->isTransform( transformString, actualTransform );
        if( recognizedTransform ){
            if ( actualTransform != transformName ){
                m_state.setValue<QString>(TRANSFORM_DATA, actualTransform );
                m_state.flushState();
                emit colorStateChanged();
            }
        }
        else {
           result = "Invalid data transform: " + transformString;
        }
    }
    return result;
}
Exemple #12
0
void Layer::_updateColor(){
    emit colorStateChanged();
}