35 switch ( mBlurMethod )
38 drawStackBlur( context );
41 drawGaussianBlur( context );
51 drawBlurredImage( context, im );
58 drawBlurredImage( context, *im );
62 void QgsBlurEffect::drawBlurredImage(
QgsRenderContext &context, QImage &image )
67 QPainter *painter = context.
painter();
69 painter->setCompositionMode( mBlendMode );
70 painter->drawImage(
imageOffset( context ), image );
77 props.insert( QStringLiteral(
"enabled" ),
mEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
78 props.insert( QStringLiteral(
"draw_mode" ), QString::number(
static_cast< int >(
mDrawMode ) ) );
79 props.insert( QStringLiteral(
"blend_mode" ), QString::number(
static_cast< int >( mBlendMode ) ) );
80 props.insert( QStringLiteral(
"opacity" ), QString::number( mOpacity ) );
81 props.insert( QStringLiteral(
"blur_level" ), QString::number( mBlurLevel ) );
84 props.insert( QStringLiteral(
"blur_method" ), QString::number(
static_cast< int >( mBlurMethod ) ) );
91 QPainter::CompositionMode mode =
static_cast< QPainter::CompositionMode
>( props.value( QStringLiteral(
"blend_mode" ) ).toInt( &ok ) );
96 if ( props.contains( QStringLiteral(
"transparency" ) ) )
98 double transparency = props.value( QStringLiteral(
"transparency" ) ).toDouble( &ok );
101 mOpacity = 1.0 - transparency;
106 double opacity = props.value( QStringLiteral(
"opacity" ) ).toDouble( &ok );
113 mEnabled = props.value( QStringLiteral(
"enabled" ), QStringLiteral(
"1" ) ).toInt();
115 double level = props.value( QStringLiteral(
"blur_level" ) ).toDouble( &ok );
119 if ( !props.contains( QStringLiteral(
"blur_unit" ) ) )
122 mBlurLevel *= 0.2645;
130 mBlurMethod = method;
145 return rect.adjusted( -spread, -spread, spread, spread );