void QgsColorEffect::readProperties( const QgsStringMap &props ) { bool ok; QPainter::CompositionMode mode = static_cast< QPainter::CompositionMode >( props.value( "blend_mode" ).toInt( &ok ) ); if ( ok ) { mBlendMode = mode; } double transparency = props.value( "transparency" ).toDouble( &ok ); if ( ok ) { mTransparency = transparency; } mEnabled = props.value( "enabled", "1" ).toInt(); mDrawMode = static_cast< QgsPaintEffect::DrawMode >( props.value( "draw_mode", "2" ).toInt() ); mBrightness = props.value( "brightness", "0" ).toInt(); mContrast = props.value( "contrast", "0" ).toInt(); mSaturation = props.value( "saturation", "1.0" ).toDouble(); mGrayscaleMode = static_cast< QgsImageOperation::GrayscaleMode >( props.value( "grayscale_mode", "0" ).toInt() ); mColorizeOn = props.value( "colorize", "0" ).toInt(); if ( props.contains( "colorize_color" ) ) { setColorizeColor( QgsSymbolLayerV2Utils::decodeColor( props.value( "colorize_color" ) ) ); } mColorizeStrength = props.value( "colorize_strength", "100" ).toInt(); }
void QgsHueSaturationFilter::readXml( const QDomElement& filterElem ) { if ( filterElem.isNull() ) { return; } setSaturation( filterElem.attribute( QStringLiteral( "saturation" ), QStringLiteral( "0" ) ).toInt() ); mGrayscaleMode = ( QgsHueSaturationFilter::GrayscaleMode )filterElem.attribute( QStringLiteral( "grayscaleMode" ), QStringLiteral( "0" ) ).toInt(); mColorizeOn = ( bool )filterElem.attribute( QStringLiteral( "colorizeOn" ), QStringLiteral( "0" ) ).toInt(); int mColorizeRed = filterElem.attribute( QStringLiteral( "colorizeRed" ), QStringLiteral( "255" ) ).toInt(); int mColorizeGreen = filterElem.attribute( QStringLiteral( "colorizeGreen" ), QStringLiteral( "128" ) ).toInt(); int mColorizeBlue = filterElem.attribute( QStringLiteral( "colorizeBlue" ), QStringLiteral( "128" ) ).toInt(); setColorizeColor( QColor::fromRgb( mColorizeRed, mColorizeGreen, mColorizeBlue ) ); mColorizeStrength = filterElem.attribute( QStringLiteral( "colorizeStrength" ), QStringLiteral( "100" ) ).toInt(); }