31 , mBlurMethod( StackBlur )
32 , mTransparency( 0.0 )
33 , mBlendMode(
QPainter::CompositionMode_SourceOver )
48 switch ( mBlurMethod )
51 drawStackBlur( context );
54 drawGaussianBlur( context );
63 drawBlurredImage( context, im );
69 drawBlurredImage( context, *im );
100 QPainter::CompositionMode mode = ( QPainter::CompositionMode )props.
value(
"blend_mode" ).toInt( &ok );
112 int level = props.
value(
"blur_level" ).toInt( &ok );
120 mBlurMethod = method;
135 double spread = mBlurLevel * 2.0 + 10;
136 return rect.
adjusted( -spread, -spread, spread, spread );
void setCompositionMode(CompositionMode mode)
static void multiplyOpacity(QImage &image, const double factor)
Multiplies opacity of image pixel values by a factor.
virtual QgsStringMap properties() const override
Returns the properties describing the paint effect encoded in a string format.
bool enabled() const
Returns whether the effect is enabled.
Base class for visual effects which can be applied to QPicture drawings.
QImage copy(const QRect &rectangle) const
QImage * sourceAsImage(QgsRenderContext &context)
Returns the source QPicture rendered to a new QImage.
BlurMethod
Available blur methods (algorithms)
QString number(int n, int base)
static QImage * gaussianBlur(QImage &image, const int radius)
Performs a gaussian blur on an image.
double transparency() const
Returns the transparency for the effect.
QPointF imageOffset(const QgsRenderContext &context) const
Returns the offset which should be used when drawing the source image on to a destination render cont...
A paint effect which blurs a source picture, using a number of different blur methods.
DrawMode
Drawing modes for effects.
Contains information about the context of a rendering operation.
virtual void draw(QgsRenderContext &context) override
Handles drawing of the effect's result on to the specified render context.
virtual QgsPaintEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
static void stackBlur(QImage &image, const int radius, const bool alphaOnly=false)
Performs a stack blur on an image.
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const
iterator insert(const Key &key, const T &value)
const QPicture * source() const
Returns the source QPicture.
static QgsPaintEffect * create(const QgsStringMap &)
Creates a new QgsBlurEffect effect from a properties string map.
virtual void readProperties(const QgsStringMap &props) override
Reads a string map of an effect's properties and restores the effect to the state described by the pr...
const T value(const Key &key) const
virtual QRectF boundingRect(const QRectF &rect, const QgsRenderContext &context) const override
Returns the bounding rect required for drawing the effect.